g++ -Wl,-rpath,/usr/local/lib -o /path-to/executable {list of .o files} -L/usr/X11R6/lib -L/usr/local/lib -lQtGui -L/usr/local/lib -L/usr/openwin/lib -lSM -lICE -lXext -lX11 -lresolv -lsocket -lnsl -lQtCore -lm -lrt -ldl -lpthread
I'm using the above command to compile an executable. Well actually a makefile is doing it for me..but regardless.
I'm getting an error with the above command:
ld: fatal: option -dn and -P are incompatible
ld: fatal: Flags processing errors
I don't see where -dn or -P are being supplied to the linker anywhere in the command or in the makefile. Where is the linker getting this info?
By trying to temporarily remove each segment of the linking command, I found that removing ",rpath,/usr/local/lib" made the thing work. Which got me thinking that I was setting linker options somewhere else in linux world.
Further investigation proved that I was setting LD_LIBRARY_PATH which included some linker options that caused the conflict. Upon changing that LD_LIBRARY_PATH, things worked as they should have.
Related
I did not get response from Qualcomm forum so I decided to post here. When I was trying to run examples of Halide for Hexagon by running make run as written in the document. Then I got the following issue. The -lc++abi is missing.
clang++ -std=c++11 -I /opt/qcom/Hexagon_SDK/4.3.0.0/tools/HALIDE_Tools/2.3.03/Halide/include -stdlib=libc++ -O3 -g -fno-rtti -rdynamic conv3x3_generator.cpp /opt/qcom/Hexagon_SDK/4.3.0.0/tools/HALIDE_Tools/2.3.03/Halide/lib/libHalide.a /opt/qcom/Hexagon_SDK/4.3.0.0/tools/HALIDE_Tools/2.3.03/Halide/tools/GenGen.cpp -o /opt/qcom/Hexagon_SDK/4.3.0.0/tools/HALIDE_Tools/2.3.03/Halide/Examples/build/offload/hexagon_benchmarks/bin/conv3x3.generator -lz -lrt -ldl -lpthread -lm
/usr/bin/ld: cannot find -lc++abi
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I checked the /usr/lib and find. So it should be there?
./x86_64-linux-gnu/libc++abi.so.1.0
./x86_64-linux-gnu/libc++abi.so.1
./llvm-10/lib/libc++abi.so.1.0
./llvm-10/lib/libc++abi.so.1
Did I miss anything or make anything stupid? Thanks!
ld is your system's host linker -- that's GNU BFD ld. clang++ must be in your PATH but it's the host clang++ and not the hexagon-clang++ that would be with Halide/Hexagon tools.
I contacted the person from Qualcomm. I am not supposed to use either /usr/bin/clang++ nor hexagon-clang++. I downloaded clang+llvm-7.0.1-x86_64-linux-gnu-ubuntu-18.04.tar.xz from https://releases.llvm.org/7.0.1/. You should use clang++ under the bin folder after you extract it. Now it works for me.
I am trying to build the RTI perftest in an i86 QNX architecture. When I try to build the makefile that I generated, I get the following:
Checking directory obj/i86QNX6.6qcc_cpp4.7.3/Release
Checking directory ../bin/i86QNX6.6qcc_cpp4.7.3/Release
qcc -V4.7.3,gcc_ntox86 -Y_cpp -lang-c++ -m64 -Wall -o ../bin/i86QNX6.6qcc_cpp4.7.3/Release/perftest_cpp obj/i86QNX6.6qcc_cpp4.7.3/Release/test.o obj/i86QNX6.6qcc_cpp4.7.3/Release/testPlugin.o obj/i86QNX6.6qcc_cpp4.7.3/Release/testSupport.o obj/i86QNX6.6qcc_cpp4.7.3/Release/Property.o obj/i86QNX6.6qcc_cpp4.7.3/Release/RTIDDSImpl.o obj/i86QNX6.6qcc_cpp4.7.3/Release/perftest_cpp.o -L/opt/RTI/ndds.5.1.0/lib/i86QNX6.6qcc_cpp4.7.3 -lnddscppz -lnddscz -lnddscorez -lm -lsocket -lpthread -lnsl -lrt -L/usr/lib/nptl
/opt/qnx/6.6.0/host/linux/x86/usr/bin/i486-pc-nto-qnx6.6.0-ld: cannot find -lpthread
/opt/qnx/6.6.0/host/linux/x86/usr/bin/i486-pc-nto-qnx6.6.0-ld: cannot find -lnsl
/opt/qnx/6.6.0/host/linux/x86/usr/bin/i486-pc-nto-qnx6.6.0-ld: cannot find -lrt
cc: /opt/qnx/6.6.0/host/linux/x86/usr/bin/i486-pc-nto-qnx6.6.0-ld error 1
make: *** [../bin/i86QNX6.6qcc_cpp4.7.3/Release/perftest_cpp] Error 1
I am not to familiar with QNX and its libraries, but when I remove those flags I get a ton of errors. Any tips on how to build the perftest for QNX or dealing with this error would be great, thanks!
My makefile has the following build line which resolves all symbols and results in a running executable:
qcc -o ../bin/i86QNX6.6qcc_cpp4.7.3/Release/perftest_cpp
obj/i86QNX6.6qcc_cpp4.7.3/Release/test.o
obj/i86QNX6.6qcc_cpp4.7.3/Release/testPlugin.o
obj/i86QNX6.6qcc_cpp4.7.3/Release/testSupport.o
obj/i86QNX6.6qcc_cpp4.7.3/Release/RTIDDSImpl.o
obj/i86QNX6.6qcc_cpp4.7.3/Release/perftest_cpp.o
-L/opt/RTI/rti_connext_dds-5.2.3/lib/i86QNX6.6qcc_cpp4.7.3
-lnddscppz -lnddscz -lnddscorez -lm -lsocket
-V4.7.3,gcc_ntox86 -Y_cpp -lang-c++ -Wall
Note that it has none of the libraries that you mention.
I've been trying to install eureka-1.11 program (DooM map editor for Linux) and when I ran make command, I got the error:
user_nout#linux-u90c:~/eureka-1.11-source> sudo make
root's password:
g++ obj_linux/editloop.o obj_linux/e_basis.o obj_linux/e_checks.o obj_linux/e_checks2.o obj_linux/e_cutpaste.o obj_linux/e_linedef.o obj_linux/e_loadsave.o obj_linux/e_nodes.o obj_linux/e_path.o obj_linux/e_sector.o obj_linux/e_things.o obj_linux/e_vertex.o obj_linux/im_arrows.o obj_linux/im_color.o obj_linux/im_img.o obj_linux/levels.o obj_linux/lib_adler.o obj_linux/lib_file.o obj_linux/lib_util.o obj_linux/main.o obj_linux/m_bitvec.o obj_linux/m_config.o obj_linux/m_files.o obj_linux/m_game.o obj_linux/m_keys.o obj_linux/m_select.o obj_linux/m_strings.o obj_linux/objects.o obj_linux/r_grid.o obj_linux/r_render.o obj_linux/sys_debug.o obj_linux/ui_about.o obj_linux/ui_browser.o obj_linux/ui_canvas.o obj_linux/ui_default.o obj_linux/ui_dialog.o obj_linux/ui_file.o obj_linux/ui_hyper.o obj_linux/ui_infobar.o obj_linux/ui_linedef.o obj_linux/ui_menu.o obj_linux/ui_misc.o obj_linux/ui_nombre.o obj_linux/ui_nodes.o obj_linux/ui_pic.o obj_linux/ui_prefs.o obj_linux/ui_replace.o obj_linux/ui_sector.o obj_linux/ui_scroll.o obj_linux/ui_sidedef.o obj_linux/ui_thing.o obj_linux/ui_tile.o obj_linux/ui_vertex.o obj_linux/ui_window.o obj_linux/w_loadpic.o obj_linux/w_flats.o obj_linux/w_sprite.o obj_linux/w_texture.o obj_linux/w_wad.o obj_linux/x_hover.o obj_linux/x_loop.o obj_linux/x_mirror.o obj_linux/glbsp/analyze.o obj_linux/glbsp/blockmap.o obj_linux/glbsp/glbsp.o obj_linux/glbsp/level.o obj_linux/glbsp/node.o obj_linux/glbsp/reject.o obj_linux/glbsp/seg.o obj_linux/glbsp/system.o obj_linux/glbsp/util.o obj_linux/glbsp/wad.o -o eureka -L /lib64 -lfltk_images -lfltk_gl -lfltk -lX11 -lXext -lXft -lfontconfig -lXinerama -lpng -ljpeg -lGL -lz -lm
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: /usr/local/lib64/libfltk.a(Fl_Native_File_Chooser.o): undefined reference to symbol 'dlsym##GLIBC_2.2.5'
/lib64/libdl.so.2: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:158: recipe for target 'eureka' failed
make: *** [eureka] Error 1
I was searching a lot about this type of error, but in each topic it was something different comparing to my problem.
For note: there is no configure file; also I tried to put another LDFLAGS in make file.
System: linux openSUSE Leap 42.1
The part of the makefile, if needed:
INSTALL_DIR=$(PREFIX)/share/eureka
CXXFLAGS=$(OPTIMISE) -Wall -D$(OS) \
-Iglbsp_src \
-D_THREAD_SAFE -D_REENTRANT
LDFLAGS=-L/usr/X11R6/lib
LIBS= \
-lfltk_images -lfltk_gl -lfltk \
-lX11 -lXext -lXft -lfontconfig -lXinerama \
-lpng -ljpeg -lGL -lz -lm
Any ideas how to overcome this issue?
The question can be closed - Knud Larsen has published an answer in the comment above.
All the thing was in not valid fltk on my system.
For reading the full answer to my question, see the comment, as I have already mentioned.
Thanks for help!
Testing eureka-111 with OpenSuse Leap 42.1 :
# zypper in gcc-c++ fltk-devel fltk-devel-static libXft-devel libjpeg8-devel libpng12-devel xdg-utils
cd eureka-1.11-source/ && make ... and the executable eureka is created.
P.S. : Reason for a difference with a manual build of fltk : The Suse 42.1 fltk packages were built with a different configure file ( Line 2685 edited ) :
- DSOCOMMAND="\$(CXX) \$(DSOFLAGS) -Wl,-soname,\$# \$(LDLIBS) -shared -fPIC $DEBUGFLAG -o"
+ DSOCOMMAND="\$(CXX) -Wl,--as-needed -Wl,--no-undefined \$(DSOFLAGS) -Wl,-soname,\$# \$(LDLIBS) -shared -fPIC $DEBUGFLAG -o"
Ref. the patch fltk-1.3.2-underlinking.patch in the source SRPM, fltk-1.3.2-9.2.src.rpm
I am rather new to Linux (using Ubuntu 14.04 LTS 64bit), coming from Windows, and am attempting to port over an existing CUDA project of mine.
When linking via
/usr/local/cuda/bin/nvcc -arch=compute_30 -code=sm_30,compute_30 -o Main.o Display.o FileUtil.o Timer.o NeuralNetwork.o -L/usr/lib -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu -L/usr/local/cuda/lib64 -lGLEW -lglfw3 -lGL -lGLU -lcuda -lcudart
I encounter the following error:
/usr/bin/ld: /usr/local/lib/libglfw3.a(x11_clipboard.c.o): undefined reference to symbol 'XConvertSelection'
//usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [CUDANN] Error 1
The answer seems closely related to the solutions in this post (Strange linking error: DSO missing from command line), though given my inexperience with Linux I was unable to adapt them to my own problem.
Any ideas on what the problem could be?
Here is the full output during compilation: https://gist.github.com/wbolden/857eddd11e4dcb915c02
And here is my attempt at a Makefile:
https://gist.github.com/wbolden/135033daae04ed0d8cf3
Hopefully this will be of help to those, like me, who are new to Linux and don't find anything related to Linux to be particularly obvious.
As noted by talonmies, I am not able to link indirectly and as such need to specify any additional libraries required by the libraries I am using. That is to say, if I link library A, which requires libraries B and C, I need to link all three libraries for the program to link correctly.
To find what other libraries were needed I used the pkg-config command, for which I found a guide here. Running pkg-config --print-requires --print-requires-private glfw3 gave the following output, which is the list of packages required by glfw3.
x11
xrandr
xi
xxf86vm
gl
I was then able to find what libraries I needed to include by running pkg-config --libs, followed by the name of the library. For example, pkg-config --libs x11 yielded -lX11.
Note: you can pass multiple items to pkg-config as input, so running
pkg-config --libs $(pkg-config --print-requires --print-requires-private glfw3)
will print out all the additional libraries you need to link (-lX11 -lXrandr -lXi -lXxf86vm -lGL).
My program now links successfully, I hope this helpful to anyone with a similar problem.
Your linker need X11 library,You need to specify -lX11 to linker
Try
/usr/local/cuda/bin/nvcc -arch=compute_30 -code=sm_30,compute_30 -o Main.o Display.o FileUtil.o Timer.o NeuralNetwork.o -L/usr/lib -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu -L/usr/local/cuda/lib64 -lGLEW -lglfw3 -lGL -lGLU -lcuda -lcudart -lX11
Try to add -pthread at the end of the library list (command line) in the Makefile.
It worked for me.
Use the following commands to fix the issue:
FLAGS=-lX11 ./configure --prefix=/usr --disable-static
make
make install
I have a problem with compiling zabbix-server on CentOS 6.2.
Command line is:
./configure --enable-server --with-mysql --with-net-snmp --with-libcurl
--with-jabber --with-ssh2 --with-openipmi --with-ldap --enable-static
But error occures:
checking for main in -lz... no
configure: error: Not found z library;
Full configure output is here: http://pastebin.ru/WmDP7UL0
I already tried to do:
yum install zlib zlib-devel zlib-static zlibrary zlibrary-devel
But it was unsuccessfully.
Thank you for your attention.
UPD. Config log posted here: http://pastebin.ru/WNtQu9eR and shows this error:
configure:7366: checking for main in -lz
configure:7385: gcc -o conftest -g -O2 -rdynamic -static conftest.c -lz -lm -lrt -lresolv >&5
/usr/bin/ld: cannot find -lm
collect2: ld returned 1 exit status
Here's the actual error:
/usr/bin/ld: cannot find -lm
But it is found previously, which points to something else. Check your ulimits to make sure you don't have a low max open file count.