I'm trying to install the Dovecot plugin deleted_to_trash. However, I need to update the configuration file, according to the readme, but I don't know what to fill in for DOVECOT_INC_PATH.
The directory that the author put, /usr/include/dovecot, doesn't exist.
If I try to make without changing anything, I get:
me#cs:/my-path/dtt# make
cc \
-fPIC -shared -Wall \
-I/usr/include/dovecot \
-I/usr/include/dovecot/src \
-I/usr/include/dovecot/src/lib \
-I/usr/include/dovecot/src/lib-storage \
-I/usr/include/dovecot/src/lib-mail \
-I/usr/include/dovecot/src/lib-imap \
-I/usr/include/dovecot/src/lib-index \
-DHAVE_CONFIG_H \
src/deleted-to-trash-plugin.c -o lib_deleted_to_trash_plugin.so
In file included from src/deleted-to-trash-plugin.c:4:0:
src/deleted-to-trash-plugin.h:4:17: fatal error: lib.h: No such file or directory
compilation terminated.
make: *** [lib_deleted_to_trash_plugin.so] Error 1
I tried to find the missing lib.h, but nothing useful:
me#cs:/my-path/dtt# find / -name "lib.h"
/usr/src/linux-headers-3.8.0-19-generic/include/config/rtc/lib.h
/usr/src/linux-headers-3.8.0-19-generic/include/config/iio/adis/lib.h
/usr/src/linux-headers-3.8.0-19-generic/include/config/snd/opl3/lib.h
/usr/src/linux-headers-3.8.0-19-generic/include/config/snd/firewire/lib.h
/usr/src/linux-headers-3.8.0-19-generic/include/config/snd/oxygen/lib.h
/usr/src/linux-headers-3.8.0-19-generic/include/config/snd/vx/lib.h
/usr/src/linux-headers-3.8.0-19-generic/include/config/ceph/lib.h
/usr/src/linux-headers-3.8.0-19-generic/include/config/x86/speedstep/lib.h
/usr/src/linux-headers-3.8.0-19-generic/include/config/rt2800/lib.h
/usr/src/linux-headers-3.8.0-19-generic/include/config/rt2x00/lib.h
/usr/src/linux-headers-3.8.0-35-generic/include/config/rtc/lib.h
/usr/src/linux-headers-3.8.0-35-generic/include/config/iio/adis/lib.h
/usr/src/linux-headers-3.8.0-35-generic/include/config/snd/opl3/lib.h
/usr/src/linux-headers-3.8.0-35-generic/include/config/snd/firewire/lib.h
/usr/src/linux-headers-3.8.0-35-generic/include/config/snd/oxygen/lib.h
/usr/src/linux-headers-3.8.0-35-generic/include/config/snd/vx/lib.h
/usr/src/linux-headers-3.8.0-35-generic/include/config/ceph/lib.h
/usr/src/linux-headers-3.8.0-35-generic/include/config/x86/speedstep/lib.h
/usr/src/linux-headers-3.8.0-35-generic/include/config/rt2800/lib.h
/usr/src/linux-headers-3.8.0-35-generic/include/config/rt2x00/lib.h
How can I find out the value I need for DOVECOT_INC_PATH?
I think you want to compile dovecot from source.
And I can find lib.h in dovecot-2.2.13.tar.gz from below url.
http://www.dovecot.org/releases/2.2/dovecot-2.2.13.tar.gz
If you installed dovecot as package, how about to install more dovecot related packages as like dovecot-dev or dovecot-source? I think you can find it.
If you can't resolve the problem, please copy lib.h file from sources tarball file to /usr/include/dovecot/src/lib.
Related
So, I have a static library called libtree-sitter.a that I'm trying to use. Here is the compilation command from the documentation:
clang \
-I tree-sitter/lib/include \
test-json-parser.c \
tree-sitter-json/src/parser.c \
tree-sitter/libtree-sitter.a \
-o test-json-parser
The above command successfully compiles and the executable works correctly. I tried changing the loading of the static library into flags so I could make my build system more generic. My changes are below:
clang \
-I tree-sitter/lib/include \
test-json-parser.c \
tree-sitter-json/src/parser.c \
-o test-json-parser \
-Ltree-sitter -ltree-sitter
This compiles, but running the executable gives this error:
dyld: Library not loaded: /usr/local/lib/libtree-sitter.0.dylib
Referenced from: /Users/jason/Downloads/tree sitter test/test-json-parser
Reason: image not found
Can someone please explain the difference between those two examples? From my understanding of -l and -L, it should still find the library in the same place. What is an equivalent combination of flags so I can make loading libraries more generic and easily integrable with Makefile templates (I am using this one)? Thanks for reading.
Your error message says:
dyld: Library not loaded: /usr/local/lib/libtree-sitter.0.dylib
Referenced from: /Users/jason/Downloads/tree sitter test/test-json-parser
Reason: image not found
This gives you several hints about what is happening: It says that it doesn't find libtree-sitter.0.dylib in directory /usr/local/lib which indicates that you have not specified a -L option to search in the subdirectory you say.
First of all, I recommend you to execute clang with option -v to show what command line is it using to call the linker. This will probably don't show the -L option you specified and it's argument.
My guess is that you are using that command line in some script that is deleting some of the \ chars (or you have a space after the \, and you are getting a new line cutting your command line before the linker options. Check this.
The linker you are using will check all directories specified in -L options before any of the system directories, for a file called libyourLibraryName.number.dylib, if it doesn't find, will try libyourLibraryName.a, and then it will try the next directory in the list. If you call the compiler with the -v option you will get the set of options it is using to call the linker. Please, it would be nice if you include that in your question.
I planned on adding sound effects to a smal project.
i downloaded the SDL_Mixer dev-library for mingw32,
moved all the files from its lib folder to the mingw32 lib folder, did the same for include and bin.
But iam still not able to compile anything using #include SDL2/SDL_mixer.h.
´C:/Development/SDL Mixer/include/SDL2/SDL_mixer.h:25:10: fatal error: SDL_stdinc.h: No such file or directory´
Maybe it is my makefile.
´build:
gcc -Wfatal-errors \
-std=c99 \
./*.c \
-I"C:\Development\SDL2 MinGW 64\include" \
-L"C:\Development\SDL2 MinGW 64\lib" \
-I"C:\Development\SDL Mixer\include" \
-L"C:\Development\SDL Mixer\lib" \
-lmingw32 \
-lSDL2main \
-lSDL2 \
-o example.exe´
i dont know why files are missing.
I have a static library .a with several header files provided. I want to link it with .o files into binary using Green hills compiler.
The error I get is:
[elxr] (error #412) unresolved symbols.
I am trying to specify path to header files providing -I filepath to linker.
However, this does not seem to work.
Updated with code.
# Recipe for linking
__GHSRH850_ERRALL += $(__GHSRH850_TARGETERR)
GHSRH850_LIB = SRC\MCU\DROME\RGL\libd1mx_rh850_ghs.a
$(GHSRH850_TARGETEMU): $(__GHSRH850_OBJS) $(GHSRH850_LSCRIPT) $(GHSRH850_LIB) \
$(CORE_MAKPREREQS) | __GHSRH850_DIRS
$(call CORE_REPORTFILE,Linking,$(#F))
$(eval __GHSRH850_ERRDONE += $(__GHSRH850_TARGETERR))
$(GHSRH850_LD) \
$(GHSRH850_LSCRIPT) \
-o $# \
$(GHSRH850_LIB) \
$(__GHSRH850_OBJS) \
$(GHSRH850_LFLAGS) \
> $(__GHSRH850_TARGETERR)
The make file is quite huge, so I cannot put all of it here. Basically library is added with:
GHSRH850_LIB = file\path\to\libname.a
In flags added filepath to headers with:
GHSRH850_LFLAGS += -I file\path\to\headers
Other descriptions are:
GHSRH850_LFLAGS - Linker flags
GHSRH850_LSCRIPT - Linker script file
__GHSRH850_OBJS - Object files list
Compiler that is used ccrh850.exe.
Error code:
[elxr] (error #412) unresolved symbols: 35
_R_UTIL_DHD_Init from drglgmm_dhd.o
_R_UTIL_DHD_Config from drglgmm_dhd.o
_R_DEV_SQRTF from libd1mx_rh850_ghs.a(r_drw2d_main.o)
_R_VDCE_Sys_HsyncActLevelSet from libd1mx_rh850_ghs.a(r_vdce_api.o)
Thanks all for quick answer. The problem was solved.
Basically errors appeared due to other source files were not compiling, because of missing headers and compiler did not throw any notification about that. Thus, when all object files compiled errors have gone. The correct way to add library is either to add path as I did or use -lname as mentioned by Ian Abbot.
I want to compile mex files without installing xcode, using only Command Line Tools (from apple developer center).
Apple Command Line Tools install the compiler and adds standard libraries and headers to the system in a package much smaller than xcode (which is several GBs).
Running mex on linux is possible - I see no reason why matlab mex should require the huge SDKs required for macos. A long evening of trial and error and hacking configuration files hasn't helped. Does anyone have a minimal working example of how to compile a mex file outside matlab, or a simple way to use mex without having xcode installed?
Best Regards, Magnus
Well, I have another option here:
Edit the files under /Applications/MATLAB_R2016b.app/bin/maci64/mexopts (probably there should be 3.xml file, all needs the same modification).
Locate the <XCODE_AGREED_VERSION> portion, comment the whole xml tag, e.g. wrap them with <!-- and --> like this:
<!--XCODE_AGREED_VERSION>
<and diagnostic="Xcode is installed, but its license has not been accepted. Run Xcode and accept its license agreement." >
<or>
<cmdReturns name="defaults read com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense"/>
<cmdReturns name="defaults read /Library/Preferences/com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense"/>
</or>
<cmdReturns name="
agreed=$$
if echo $agreed | grep -E '[\.\"]' >/dev/null; then
lhs=`expr "$agreed" : '\([0-9]*\)[\.].*'`
rhs=`expr "$agreed" : '[0-9]*[\.]\(.*\)$'`
if echo $rhs | grep -E '[\."]' >/dev/null; then
rhs=`expr "$rhs" : '\([0-9]*\)[\.].*'`
fi
if [ $lhs -gt 4 ] || ( [ $lhs -eq 4 ] && [ $rhs -ge 3 ] ); then
echo $agreed
else
exit 1
fi
fi" />
</and>
</XCODE_AGREED_VERSION -->
Some notes:
These files are read only by default, you need to issue sudo chmod
644 * in that directory
after comment out all necessary files, issue this command in matlab:
mex -setup C++
Then you are done
After spending more time, I wound up learning more stuff and answering my own question. I'll post my solution here if anyone else needs it in the future.
Make sure the cord is connected to your computer and that MATLAB is installed, and also install the command line tools from apple. Then call the following makefile to compile arrayProduct.c (comes with matlab) from the terminal as follows:
make mex=arrayProduct
Put this makefile code in the same folder in a file called makefile(edit to your own needs if you have to):
all:
clang -c\
-DMX_COMPAT_32 \
-DMATLAB_MEX_FILE \
-I"/Applications/MATLAB_R2016b.app/extern/include" \
-I"/Applications/MATLAB_R2016b.app/simulink/include" \
-fno-common \
-arch x86_64 \
-fexceptions \
-O2 \
-fwrapv \
-DNDEBUG \
"/Applications/MATLAB_R2016b.app/extern/version/c_mexapi_version.c" \
$(mex).c
clang \
-Wl,-twolevel_namespace \
-undefined error \
-arch x86_64 \
-bundle \
-Wl,-exported_symbols_list,"/Applications/MATLAB_R2016b.app/extern/lib/maci64/mexFunction.map" \
$(mex).o \
c_mexapi_version.o \
-O \
-Wl,-exported_symbols_list,"/Applications/MATLAB_R2016b.app/extern/lib/maci64/c_exportsmexfileversion.map" \
-L"/Applications/MATLAB_R2016b.app/bin/maci64" \
-lmx \
-lmex \
-lmat \
-lc++ \
-o $(mex).mexmaci64
The above makefile is a bare minimum working example, you should edit it to comply with your requirements.
Edit:
Option 2
You can make MATLAB understand how to use the Command Line Tools by editing the xml file containing the compiler options instead. Open the file located at
/User/username/Library/Application Support/MathWorks/MATLAB/R2016b/mex_C_maci64.xml
Remove all compiler and linker options related to ISYSROOT. This will make the compiler search for header files in /usr/include etc instead of in the SDK-folder in XCode.
I fully understand you and I'm a big advocate of non-using the enormous Xcode. From my saver here, run the following to trick mex into seeing an accepted license (no sudo needed).
Here I use the current version 13.0 at the time of writing, to be adapted.
defaults write com.apple.dt.Xcode IDEXcodeVersionForAgreedToGMLicense 13.0
I want to add a system call to linux kernel 3.14.61 that print 'hello world'.
First I downloaded kernel 3.14.61 source code then followed these steps.
1- I add 316 64 hello sys_hello line to arch/x86/syscalls/syscall_64.tbl file.
2- Then I add asmlinkage long sys_hello(void); line to include/linux/syscalls.h file.
3- I create a new file named hello.c in kernel. Address of hello.c file is kernel/hello.c, and I put in it this:
#include <linux/kernel.h>
asmlinkage long sys_hello(void) {
printk("hello world\n");
return 0;
}
4- Then I add hello.o to kernel/Makefile at the end of obj-y like this:
obj-y = fork.o exec_domain.o panic.o \
cpu.o exit.o itimer.o time.o softirq.o resource.o \
sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \
signal.o sys.o kmod.o workqueue.o pid.o task_work.o \
extable.o params.o posix-timers.o \
kthread.o sys_ni.o posix-cpu-timers.o \
hrtimer.o nsproxy.o \
notifier.o ksysfs.o cred.o reboot.o \
async.o range.o groups.o smpboot.o hello.o
5- After top 4 steps I tried to compile custom kernel. So I ran these commands, one by one:
make localmodconfig
make oldconfig
make –j2
sudo make modules_install
But when I ran the last command (sudo make modules_install) I saw this error:
The present kernel configuration has modules disabled.
Type 'make config' and enable loadable module support.
Then build a kernel with module support enabled.
make: *** [modules_install] Error 1
How can I fix it?
Apparently, your kernel config has loadable modules disabled, thus it doesn't make much sense to install them.
There is probably something wrong with your kernel config.