ld

Telling ld where to look for directories via an environment variable

I'm grading C and C++ files for a class, and this assignment uses the GSL library. Since I don't have root permission on my computer, my GSL library is installed in my home directory, and thus I need to tell compilers and linkers where to find it. This isn't a problem when I write a program myself, because I just add the appropriate -L...

ld linkage problems: /usr/bin/ld: cannot find [libraryname]

Im using Qmake to build a shared library on Ubuntu 9.10 This shared library (A) has a dependency on another shared library (B). project B has been successfully built. in the .pro file for project A, my LIBS variable looks like this: LIBS += -L../datelib/bin -llibdatelib_release.so.1.0.0 (I used the full shlib name because the libra...

Avoiding exporting symbols from executables on Linux

I'm finding that when I link an executable against a static library (.a), the symbols from the static library end up being exported by the executable file. I would like to avoid this and export nothing. I've tried providing a version script, but it seems to make no difference. The contents of my version script are as follows: { glo...

Unknown linking error

I'm developing my own OS, but for this I need to touch on linking, then I've done this linking script to build it: ENTRY (loader) SECTIONS{ . = 0x00100000 .text : { *(.text) } .bss : { sbss = .; *(COMMON) *(.bss) ebss = .; } } .data ALIGN (0x1000) : { start_ctors = .; *(.ctor*) e...

GNU ld removes section

I'm writing a boot script for an ARM-Cortex M3 based device. If I compile the assembler boot script and the C application code and then combine the object files and transfer them to my device everything works. However, if I use ar to create an archive (libboot.a) and combine that archive with the C application there is a problem: I've ...

link to a different libc file

I want to supply the shared libs along with my program rather than using the target system's due to version differences: ldd says my program uses these shared libs: linux-gate.so.1 => (0xf7ef0000)(made by kernel) libc.so.6 => /lib32/libc.so.6 (0xf7d88000)(libc-2.7.so) /lib/ld-linux.so.2 (0xf7ef1000)(ld-2.7.so) I have successfully lin...

glui /usr/bin/ld: cannot find -lXmu

Hello: I have downloaded the latest GLUI source code and now I am trying to compile it. When I do so, I get the following error: g++ -O0 -Wall -pedantic -I./ -I./include -I/usr/X11R6/include -o bin/example1 example/example1.cpp -L./lib -lglui -L/usr/X11R6/lib/libXdmcp.a -lglut -lGLU -lGL -lXmu -lXext -lX11 -lXi -lm /usr/bin/ld: cannot...

Where can I find documentation on assembler?

I wrote a very short program that parses a "program" using python and converts it to assembler, allowing me to compile my little proramming language to an executable. You can read my blog for more information here http://spiceycurry.blogspot.com/2010/05/simple-compilable-programming-language.html my question is... Where can I find m...

Gcc and ld arguments

Hi, how can I pass the option --enable-auto-import to ld from gcc? ...

combine two GCC compiled .o object files into a third .o file

How does one combine two GCC compiled .o object files into a third .o file? $ gcc -c a.c -o a.o $ gcc -c b.c -o b.o $ ??? a.o b.o -o c.o $ gcc c.o other.o -o executable If you have access to the source files the -combine GCC flag will merge the source files before compilation: $ gcc -c -combine a.c b.c -o c.o However this only wo...

_dl_runtime_resolve -- When do the shared objects get loaded in to memory?

We have a message processing system with high performance demands. Recently we have noticed that the first message takes many times longer then subsequent messages. A bunch of transformation and message augmentation happens as this goes through our system, much of it done by way of external lib. I just profiled this issue (using cal...

ld doesn't recognize object file

I'm having problems with compiling a project I'm working on. Everything else works just fine, but when I compile, I get this error message: /usr/bin/ld:obj/content/xmSound.o: file format not recognized; treating as linker script I have no idea why this happens. It's probably some error in the code, but I don't know. The source file xm...

Force linker to export a resolved symbol when creating shared library

I am creating a shared library using c++ -shared (which is gcc running on x86_64). I can't manage to strip my problem down to a minimal test case, but the issue I'm having is that I am creating a .so out of a bunch of .o files. One of those .o files exports a symbol (nm shows 'D') that I want exported from the .so. Others of the .o's req...

AIX 6.1 linker error

I'm trying to compile my application on AIX. It builds fine on Linux, Solaris x86 and Windows but this is the first time we've tried to build on AIX. I've managed to get to the point of linking all of the libraries together and I get the error message: Linking... ld: 0711-101 FATAL ERROR: Allocation of 96864 bytes failed in rout...

gcc linker error: version node not found for symbol ...

Hi, I'm trying to build a shared library, and I get the following error: libavformat.so: version node not found for symbol av_dup_packet@LIBAVFORMAT_52 ld: failed to set dynamic section sizes: Bad value Does anybody knows what this error means? Host is i586-linux target is arm-linux Edit: Resolved, see comments ...

Adding MEMORY specifications to a GNU linker script causes segfault

I obtained a generic linker script using "ld --verbose test.o" and simply added a memory section. From what I understand this should work fine, but no matter how I setup the memory section the resulting program never functions properly. (ld generated linker script can be found here). tl;dr; How do you use MEMORY{...} correctly in GNU ...

Fedora 8/EC2: ld cannot find library

I'm trying to get gcc to work on an Amazon EC2 image of Fedora 8, but I'm running into an issue with the libraries. ld is not finding -lz -lm -lbz2. I've tried adding -L /lib and -L /usr/lib to the arguments for gcc, but it is still not working. What am I missing? ...

GNU ld cannot find library which is there

The packages I'm toying with here are rather unknown, but nevertheless the problem is rather generic. Basically, I'm trying to compile Python module (called rql) with C++ extension. The extension uses external framework called gecode, which contains several libraries. I compiled gecode and installed locally. Now, let the output speak for...

How to get around "multiple defined symbols" in linking with gcc.

I am using an older system that has gcc 2.95.3, I have to link in two objects that although they have nothing to do with each other, they each have similarly named methods. I can't rename either of them, but I would hope there is a way to build them as to not have the linker complain. The methods it is complaining about are each intern...

ld can't find lib to link

The following is an example to describe my problem: ld -Lpath1 -Lpath2 -lA -lB -Xlinker -T -Xlinker \ -W1,-rpath,/usr/local/lib -l-o target ld: cannot find -lA collect2: ld returned 2 exit status Both path1 and path2 are relative paths, and I can find the library A according to the ld's pwd, so why did the ld output this error msg...