I installed boost using pacman -S boost boost-libs.
When I try to compile a program that uses boost::thread, and I got the following error:
/usr/bin/ld: /tmp/cc3AkelG.o: warning: relocation against `_ZTVN5boost6detail16thread_data_baseE' in read-only section `.text._ZN5boost6detail16thread_data_baseC2Ev[_ZN5boost6detail16thread_data_baseC5Ev]'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
Why does this happen and how can I fix it?
I find the answer in an other question.
I had to compile using -pthread -lboost_thread.
thanks for your answer.
Related
I tried to install ZKTECO Linux SDK on my ubuntu 20.04
It shows an error when running build.sh
/usr/bin/ld: warning: ../lib/x86/linux-64/libzksensorcore.so, needed by ./lib64/libzkfv.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: /usr/local/lib/libidkit.so.2: undefined reference to `MD5#OPENSSL_0.9.8'
collect2: error: ld returned 1 exit status
I exported the .so files to the classpath and ld_library but nothing changed
I am open to any suggestion
I've attempted to build g++ v5.1.0 on my Centos 6 system. The build seems to have worked, but when I try to compile and >link< a program, the linker fails thus:
[seesdev#sees15-lin ~]$ g++ -o testcpp testcpp.cpp
/usr/bin/ld: unrecognized option '-plugin'
/usr/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
Do I have to get a newer version of "ld"? How?
when i update gcc 4.1 to gcc 5.1
i want to use occi11.2 connect to oracle11g
and have install
oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm
oracle-instantclient11.2-odbc-11.2.0.4.0-1.x86_64.rpm
a link error is:
/usr/bin/ld: Dwarf Error: found dwarf version '4', this reader only handles version 2 information.
output/MaintainEventList.o: In function _ZL20EventCommonStoreToDBP13st_SINGLELISTPN6oracle4occi10ConnectionE':
MaintainEventList.cpp:(.text+0x36a4): undefined reference to_ZNK6oracle4occi12SQLException10getMessageB5cxx11Ev'
MaintainEventList.cpp:(.text+0x3edb): undefined reference to `_ZNK6oracle4occi12SQLException10getMessageB5cxx11Ev'
collect2: error: ld returned 1 exit status
make: *** [bin/depositor] Error 1
how to deal with ?
PROBLEM SOLVED:::
I am using LEDA library in c++.
command used to make object file.
g++ -I$LEDAROOT/incl -c mult.cpp
this command runs fine
I am getting eroor while linking step.
HERE IS THE EROOR
varun#Kinley:~/Documents/LEDA/test/numbers$ g++ -L$LEDAROOT mult.o -lleda -lX11 -lm
/usr/bin/ld: cannot find -lX11
collect2: error: ld returned 1 exit status
I think I need to install some package,because when I googled this error the most of problems are solved by installing some package .
I didn't find lx11 error
some of the eroor messages that I googled.
error 1
/usr/bin/ld: cannot find -lfreetype collect2: ld returned 1 exit
status
error 2
/usr/bin/ld: cannot find -lz collect2: ld returned 1 exit status
Links where I find these posts
http://www.qtcentre.org/threads/21069-collect2-ld-returned-1-exit-status
http://www.cyberciti.biz/faq/centos-rhel-redhat-usrbinld-cannot-findlc-error/
Do I need to install some package or there is some other problem
Could be two things
1) The X11 library is installed in a non-standard path. Use the search command to see if libX11.a or libX11.so is available on your system. If yes add the directory path to the -L option.
2) You are missing the libX11 library.
In this case, login as admin and use yum (assuming linux) to install this library.
Eg:
"yum install libX11.i386" or "yum install libX11.x86_64", depending on your architecture (32 bit or 64 bit).
I got the following error when compiling a simple hello world program on debian amd64 wheezy(testing) with g++ -m32:
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
I don't have any problems with gcc -m32. I also installed lib32stdc++ package, but it does not seem to work. Thanks.
Pretty sure you need to install g++-4.6-multilib (it would appear you already have gcc-4.6-multilib).
Try installing ia32-libs-dev package.