ld

How to install gnu ld on mac os x 10.6 ?

Hi, I'm having a lot of trouble compiling the otherwise excellent Contiki OS on my macbook pro (with mac os x 10.6). Contiki actually uses a lot of GNU-specific features and options of GCC, AR, LD, and so on. So I installed those utilities via macports, but it looks like "port install binutils" does not install GNU ld, does it ? So, th...

Easy check for unresolved symbols in shared libraries?

I am writing a fairly large C++ shared-object library, and have run into a small issue that makes debugging a pain: If I define a function/method in a header file, and forget to create a stub for it (during development), since I am building as a shared object library rather than an executable, no errors appear at compile-time telling me...

ld: linker error

ld: foo.o: relocation R_X86_64_PC32 against undefined symbol `bar' can not be used when making a shared object; recompile with -fPIC I recompile with -fPIC and it still produces this error. ...

how a function in shared library to link an un-implmented function?

Is it possible to make a shared library in which exist some function that are not implemented? I'l like to make a shared library testDele.so and leave some of the functions in the testDele.so to be implimented by other people for example: library provider make the files: ====== testDele.c ============== #include <stdlib.h> #include...

Reason and solution for error -"/usr/bin/ld: cannot find -levent "?

While compiling my program which is using libevent library I am using gcc option -levent. But I am getting this error - /usr/bin/ld: cannot find -levent I do not have libevent on my system so I am statically linking to it while compiling using gcc -o Hello -static -I libevent-1.4.12-stable/ hello.c -levent How can i resolve this? ...

Why doesn't ld honor the '-rpath-link' option?

I detect this using strace: 8480 execve("/usr/lib/gcc-lib/i486-slackware-linux/3.3.4/../../../../i486-slackware-linux/bin/ld", [ "/usr/lib/gcc-lib/i486-slackware-linux/3.3.4/../../../../i486-slackware-linux/bin/ld", ... "-L/home/bjack/lib", ... "-rpath-link", "/root/src/firmware/Bj-bg/ab-BJ-gameprom-modules/src/dis...

Selective Static Linking Of Library Functions In Shared Library

I want to create a shared library that uses functions from a 3rd-party static library. For example, foo and bar from libfoobar.a. I know that my main application is also using foo and will be exporting that symbol. So I simply want to link in bar to save code size and leave 'foo' unresolved (as it will be provided by main application). I...

Linking in Xcode

How do I make Xcode link object files properly? The file containing "main" and all the dependencies compile properly (and I can easily link them in the command line to generate the executable). However, Xcode seems to refuse to do it, resulting in ld errors of "symbol not found". This is what my current setup looks like. All the depend...

python-config ldflags on mac

I have a problem with python-config --ldflags on OS X 10.6.2. Using my non-system python.org python install: robin-mbp:~ robince$ which python /Library/Frameworks/Python.framework/Versions/2.5/bin/python robin-mbp:~ robince$ python-config --ldflags -L/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/config -ldl -lpython2....

Questions on GCC linker

Apologize because for the moment I don't have the environment to experiment and sort out the following questions myself: 1) Let's say I have four library files: libmylib_super.a and libmylib_super.so, mylib_dumb.a and mylib_dumb.so. While specifying libraries to link to, what are the differences between the following approaches: A) -l:...

Why doesn't g++ link with the dynamic library I create?

I've been trying to make some applications which all rely on the same library, and dynamic libraries were my first thought: So I began writing the "Library": /* ThinFS.h */ class FileSystem { public: static void create_container(string file_name); //Creates a new container }; /* ThinFS.cpp */ #include "ThinFS.h" void FileSystem::...

'hidden fstat' linking error with gcc4.2 on Ubuntu amd64

I've got a pile of code that builds in many places. I just turned on the build on Ubuntu 8.0.4 LTS with gcc 4.2 and ccache, and received for my trouble an error from the linker that I've never seen before. Googling leads to suggestions that I've got a shared object built with naked ld involved, but, in fact, I do not. What do I have? /u...

Mono 'asmonly' option

I created a simple mono executable using MonoDevelop that prints "hello world". I wanted to try the AOT 'asmonly' option. So: [root@localhost Debug]# ls abc.exe [root@localhost Debug]# mono --aot=full,static,asmonly abc.exe Mono Ahead of Time compiler - compiling assembly /home/alon/Projects/abc/abc/bin/Debug/abc.exe Code: 1538 Info: 5...

Relink a shared library to a different version of libc

I have a linux shared library (.so) compiled with a specific version of libc (GLIBC2.4) and I need to use it on a system with different version of libc. I do not have sources for the library in question so I cannot recompile for the new system. Is it somehow possible to change the dependencies in that library to a different libc? ...

Resources To Learn How To Use ld

I'm now doing some upgrades in my own OS and now I need to use ld, but I don't understand much about how to use it, then I'm asking for a good tutorial for really beginners. ...

Implicit Declaration Of Function

I've just organized my code by using headers, but just as I've done this, I got a warning that turned into an error when linking. I have a code(use of a function that is inside a header) in test.c that is like this: #include "test1.h" /* Some code */ main() { Testing(); } And my test1.h header is like this: void Testing(); void ...

solaris elfedit: Is there something similar for linux ? (a shared library editor)?

Linux: It there a way to edit a compiled shared library ? specifically I am searching on how to add the DT_SYMBOLIC flag on an already compiled binary shared library? Here is why I am asking this: our application is composed of our own libraries (static libXXX.a) some 3rd party libs (binary-only shared libraries libYYY.so) Every...

ELF shared library: relocation offset out of bounds

There is a software package elfutils which includes a program called eu-elflint for checking ELF binaries (just as lint for C - hence the name). Just for curiosity I have checked our own shared libraries with this tool and it found a lot of issues, e.g.: eu-elflint libUtils.so section [ 2] '.dynsym': _DYNAMIC symbol size 0 does not ma...

Convert a Static Library to a Shared Library (create libsome.so from libsome.a): where's my symbols?

the title of this question is an exact dupe, but the answers in that question don't help me. I have a bunch of object files packed in a static library: % g++ -std=c++98 -fpic -g -O1 -c -o foo.o foo.cpp % g++ -std=c++98 -fpic -g -O1 -c -o bar.o bar.cpp % ar -rc libsome.a foo.o bar.o I'd like to generate libsome.so from libsome.a inste...

Use gcc On ELKS

I'm using PocketDOS to emulate ELKS, but I want to develop on it using gcc and ld, how can I do this? ...