while installing nix I am getting this error.when I doing make.
LD src/libstore/libnixstore.so
/usr/bin/ld: cannot find -lsqlite3
/usr/bin/ld: cannot find -lbz2
collect2: error: ld returned 1 exit status
make: *** [src/libstore/libnixstore.so] Error 1
I already set LDFLAGS to the directory containing libsqlite3.* and libbz2.*
update:
here is output of make V=1
Makefile:28: Makefile.config: No such file or directory
rm -f Makefile.config && ./config.status --quiet --file=Makefile.config
g++ -o /home/kapil/nix/src/nix-1.8/src/libstore/libnixstore.so -shared -Wl,--no-copy-dt-needed-entries src/libstore/build.o src/libstore/derivations.o src/libstore/gc.o src/libstore/globals.o src/libstore/local-store.o src/libstore/misc.o src/libstore/optimise-store.o src/libstore/pathlocks.o src/libstore/references.o src/libstore/remote-store.o src/libstore/store-api.o -lsqlite3 -lbz2 -Wl,-z,defs -Wl,-soname=libnixstore.so -Wl,-rpath,/home/kapil/nix/src/nix-1.8/src/libutil -Lsrc/libutil -lnixutil -Wl,-rpath,/home/kapil/nix/src/nix-1.8/src/boost/format -Lsrc/boost/format -lnixformat
/usr/bin/ld: cannot find -lsqlite3
/usr/bin/ld: cannot find -lbz2
collect2: error: ld returned 1 exit status
make: *** [src/libstore/libnixstore.so] Error 1
Related
I've install raylib according to this wiki page.
My Project Folder is look like this:
[this][1]
> ..\build>mingw32-make
g++ ../main.cpp -o test.exe -O2 -Wall -Wno-missing-braces -I ../include/ -L ../lib/ -lraylib -lopeng132 -lgdi32 -lwinmm
D:/Software/raylib/mingw/bin/../lib/gcc/i686-w64-mingw32/8.1.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lopeng132
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [Makefile:2: default] Error 1```
[1]: https://i.stack.imgur.com/QK2X3.png
It seems you have typed openg132 instead of opengl132. You have mistaken the letter l for the number 1
I am trying to link a program with a custom GLIBC installation. I have tried the following options, but got the same error
objs/ngx_modules.o \
-Wl,--emit-relocs -Wl,--dynamic-linker=/opt/glibc-2.23-install/lib/ld-2.23.so -ldl -Wl,-rpath-link,/opt/glibc-2.23-install/lib -lcrypt -lpcre -lz \
-Wl,-E
/usr/bin/ld: objs/src/core/ngx_shmtx.o: undefined reference to symbol 'sem_post##GLIBC_2.2.5'
/opt/glibc-2.23-install/lib/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
and
objs/ngx_modules.o \
-Wl,--emit-relocs -Wl,--dynamic-linker=/opt/glibc-2.23-install/lib/ld-2.23.so -ldl -L/opt/glibc-2.23-install/lib -lcrypt -lpcre -lz \
-Wl,-E
/usr/bin/ld: objs/src/core/ngx_shmtx.o: undefined reference to symbol 'sem_post##GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
objs/Makefile:226: recipe for target 'objs/nginx' failed
and
objs/ngx_modules.o \
-Wl,--emit-relocs -Wl,--dynamic-linker=/opt/glibc-2.23-install/lib/ld-2.23.so -ldl -L/opt/glibc-2.23-install/lib/libpthread.so -lcrypt -lpcre -lz \
-Wl,-E
/usr/bin/ld: objs/src/core/ngx_shmtx.o: undefined reference to symbol 'sem_post##GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
objs/Makefile:226: recipe for target 'objs/nginx' failed
Any alternative then?
-Wl,--emit-relocs -Wl,--dynamic-linker=/opt/glibc-2.23-install/lib/ld-2.23.so -ldl -L/opt/glibc-2.23-install/lib/libpthread.so -lcrypt -lpcre -lz \
-Wl,-E
Furious activity is no substitute for understanding. The command you want:
gcc objs/ngx_modules.o \
-Wl,-E -Wl,--dynamic-linker=/opt/glibc-2.23-install/lib/ld-2.23.so \
-L/opt/glibc-2.23-install/lib \
-lcrypt -lpcre -lz -lpthread
I'm trying to compile a C file against a shared library at a specific location (/home/user/cuda_sync_analyzer-install/lib/libInsertTimingInstr.so), but ld cannot seem to find it -
$ gcc -g -I/home/user/tools/cuda_sync_analyzer/src/InsertTimingInstr \
-L/home/user/cuda_sync_analyzer-install/lib/ \
callback.c -o callback -lInsertTimingInstr.so
/usr/bin/ld: cannot find -lInsertTimingInstr.so
collect2: error: ld returned 1 exit status
I also tried
$ gcc -g -I/home/user/tools/cuda_sync_analyzer/src/InsertTimingInstr \
-L/home/user/cuda_sync_analyzer-install/lib/ \
-lInsertTimingInstr.so callback.c -o callback
/usr/bin/ld: cannot find -lInsertTimingInstr.so
collect2: error: ld returned 1 exit status
as well as setting LD_LIBRARY_PATH
$ export LD_LIBRARY_PATH=/home/user/cuda_sync_analyzer-install/lib/
$ gcc -g -I/home/user/tools/cuda_sync_analyzer/src/InsertTimingInstr \
callback.c -o callback -lInsertTimingInstr.so
/usr/bin/ld: cannot find -lInsertTimingInstr.so
collect2: error: ld returned 1 exit status
The file libInsertTimingInstr.so is present in the directory -
$ ls -l /home/user/cuda_sync_analyzer-install/lib/ | grep Timing
-rw-r--r-- 1 user user 51992 Mar 18 18:04 libInsertTimingInstr.so
but ld cannot seem to find it
This command line: gcc ... -lInsertTimingInstr.so ... asks the linker to link against libInsertTimingInstr.so.a or libInsertTimingInstr.so.so, neither of which exists.
You want: gcc ... -lInsertTimingInstr ... (i.e. drop the lib prefix and the .so suffix).
Alternatively, you could do this: gcc ... /home/user/cuda_sync_analyzer-install/lib/libInsertTimingInstr.so ...
I can't compile yacc i lex:
$ cc gramatyka.c gramatyka.h semantyka.c -ly -ll
output error:
/usr/bin/ld: cannot find -ly collect2: error: ld returned 1 exit status
How to fix it?
Most probably you are missing the -L path/to/dir/with/liby in your LDFLAGS (in case liby is in the same folder, just prepend -L. before -ly).
The reason you are getting this error is because compiler is not able to link this library. Add the complete path using "-L" option if you are not sure about default location of this library.
I am trying to compile a program which depends upon GLib's libgthread. The library is installed in my machine (Ubuntu 12.04) and pkg-config finds it:
$ pkg-config --libs gthread-2.0
-pthread -lgthread-2.0 -lrt -lglib-2.0
I tried to run configure setting $CFLAGS with such output:
$ CFLAGS=`pkg-config --libs gthread-2.0` ./configure
but it did not work:
$ make
[...]
gcc -g -O2 -I/include -I/home/adam/fs//include -I/usr/include/libxml2 -pthread -lgthread-2.0 -lrt -lglib-2.0 -o ama [...] -lxml2
ama-ama.o: In function `main':
/home/adam/software/ama/src/ama.c:89: undefined reference to `g_thread_init'
collect2: ld returned 1 exit status
make[2]: ** [ama] Erro 1
make[2]: Saindo do diretório `/home/adam/software/ama/src'
make[1]: ** [all-recursive] Erro 1
make[1]: Saindo do diretório `/home/adam/software/ama'
make: ** [all] Erro 2
I tried to set $LDFLAGS, too:
$ LDFLAGS=`pkg-config --libs gthread-2.0` ./configure
and got the same error.
What should I do?
The correct variable to set is $LIBS:
$ LIBS=`pkg-config --libs gthread-2.0` ./configure