Linking problem


 
Thread Tools Search this Thread
Top Forums Programming Linking problem
# 1  
Old 12-05-2011
Linking problem

Hi!

We recently updated the server (server is a big word, it's really just a desktop with Ubuntu that we access with ssh) on which we compile our code. Since the update my code won't compile. The linker is complaining about missing references from almost all .so that I'm linking from. It compiles on my own pc so I don't think it's the problem . Additional info :


The raw g++ command (it's quite long, sorry!) :


Code:
g++ -fPIC -O3 -DNDEBUG -I. -Igen -I../gflags-1.5/src -I../zlib-1.2.5 -DARCH_K8 -Wno-deprecated -I../protobuf-2.3.0/src -I../cbc-2.6.2/include -DUSE_CBC
-I../cbc-2.6.2/include -DUSE_CLP -I../glpk-4.45/include -DUSE_GLPK  -Wl,-rpath /lib/x86_64-linux-gnu/ -L/lib/x86_64-linux-gnu/ -Wl,-rpath ../gflags-1.5/lib
-L../gflags-1.5/lib -lgflags -Wl,-rpath ../zlib-1.2.5/lib -L../zlib-1.2.5/lib -lz -Wl,-rpath ../protobuf-2.3.0/lib -L../protobuf-2.3.0/lib -lprotobuf -lpthread -lrt
objs/nqueensBenchmark.o objs/benchmarkTimer.o librouting.a libconstraint_solver.a libutil.a libbase.a -o bin/benchmark/nqueens

Some of the weirdest error message I get to show that there are linker errors with both standard libraries (librt, libpthread) and libraries specific to my program.

Code:
timer.cc:(.text+0x15d): undefined reference to `clock_gettime'
demon_profiler.pb.cc:(.text+0x6f3): undefined reference to `pthread_once'
assignment.pb.cc:(.text+0x2d80): undefined reference to `google::protobuf::Message::~Message()'


Versions

Ubuntu version : 11.10 (Oneiric Ocelot) 64 bit
GCC version : 4.6.1 (tried with 4.5.4 too)


Things I tried

- Adding "-Wl,-rpath /lib/x86_64-linux-gnu/ -L/lib/x86_64-linux-gnu/" to the compile command (since it's where librt is located)
- Using g++ 4.5.4 instead of 4.6.1

Any ideas?

Philippe Van Kessel

Last edited by philippevk; 12-05-2011 at 11:08 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. SuSE

Problem compiling the kernel and linking problems in OpenSuse 12.3

Hi everyone I installed OpenSuse 12.3 and many development tools but when i propose build the kernel from the source (the first step make menuconfig) i saw this: HOSTLD scripts/kconfig/mconf /usr/lib64/gcc/x86_64-suse-linux/4.7/../../../../x86_64-suse-linux/bin/ld: warning: libdl.so.2,... (2 Replies)
Discussion started by: bacesado
2 Replies

2. Shell Programming and Scripting

Please help on tuxedo linking problem

Dear Unixians, I have try to link my libraries with tuxedo that showing following errors, ] My make file few lines: .... actual linking Please help on this. Thanks,KKL. (1 Reply)
Discussion started by: kkl
1 Replies

3. Solaris

g++ linking problem...

I use Solaris 10, compiling with a custom g++ (3.4.6) and GNU binutils (2.17). Things have gone well on two different systems, but when I tried moving to a third, it all fell over. Basically, it is now using the CC linker, but I need to use options not available to it. I believe I have found the... (0 Replies)
Discussion started by: Elric of Grans
0 Replies

4. UNIX for Dummies Questions & Answers

is linking possible?

how would i link 2 files together? is it the same as copying? (1 Reply)
Discussion started by: trob
1 Replies

5. AIX

linking problem

hello, Is the code compiled under Visual Age C++ Broker (a third party library) - can be used to link against a code compiled from gcc compiler. I have a problem in building xerces in AIX Please reply. Regards, Parthasarathy (1 Reply)
Discussion started by: Parthasarathy
1 Replies

6. Shell Programming and Scripting

Query in linking

Hey guys, i have written the folowing grep command to find an ip address from various files and now i have to find the reverse DNS for it. I wanted to do it via nslookup or host does someone have any clue about how to do it? what i tried was grep -o... (2 Replies)
Discussion started by: snake450
2 Replies

7. Solaris

linking in solaris9

at the end of the compilation in solaris 9. it is showing link error. like..... ld: fatal: library -lgthread-2.0 not found failed to create the binary the library is in /usr/lib and in /usr/local/lib the lib file is present --->libgthread.2.0.so ......etc if i remove... (3 Replies)
Discussion started by: biswajithit
3 Replies

8. AIX

Getting problem in linking using "ldd"

Hi I have one libXYZ.a executable. When i did ldd on that file, it gives me error like "Cannot find /usr/ccs/lib//libpthread.a(shr_xpg5.o)". The same library is loaded by the libABC.a executable. The file location is added to "LIBPATH" variable. And also libpthread.a is present... (4 Replies)
Discussion started by: mail2virag
4 Replies

9. Programming

Linking problem while linking to shared library

Hi I'm getting ld: fatal: option -h and building a dynamic executable are incompatible ld: fatal: Flags processing errors When I run ld -shared -L/usr/dt/lib -lDtSvc -o builtin.so Workspace.o after running gcc -fPIC -I/usr/X11R6/include -I/usr/dt/include -c Workspace.c I'm... (6 Replies)
Discussion started by: laho
6 Replies
Login or Register to Ask a Question