Sponsored Content
Full Discussion: Linking problem
Top Forums Programming Linking problem Post 302579501 by philippevk on Monday 5th of December 2011 10:03:16 PM
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..
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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. 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

7. 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

8. 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

9. 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
xml2-config(1)						      General Commands Manual						    xml2-config(1)

NAME
xml2-config - script to get information about the installed version of libxml SYNOPSIS
xml2-config [--prefix[=DIR]] [--libs] [--cflags] [--version] [--help] DESCRIPTION
xml2-config is a tool that is used to determine the compile and linker flags that should be used to compile and link programs that use libxml. OPTIONS
xml2-config accepts the following options: --version Print the currently installed version of libxml on the standard output. --libs Print the linker flags that are necessary to link a libxml program. --cflags Print the compiler flags that are necessary to compile a libxml program. --prefix=PREFIX If specified, use PREFIX instead of the installation prefix that libxml was built with when computing the output for the --cflags and --libs options. This option must be specified before any --libs or --cflags options. AUTHOR
This manual page was written by Fredrik Hallenberg <hallon@lysator.liu.se>, for the Debian GNU/linux system (but may be used by others). NOTES
Source for libxml is available in the SUNWlxmlS package. Documentation for libxml is available on-line at http://www.xmlsoft.org/ 3 July 1999 xml2-config(1)
All times are GMT -4. The time now is 10:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy