![]() |
|
#1
|
|||
|
|||
ld Linker errorIm having trouble linking my c++ project.
getting 1000's of linker errors like.. Code:
have done a bit of googling and asking round the office also Looked into the manual of gcc ld but can not find any flags to help me. Im a little stuck at the moment. I have a suspicion its not linking to the g++ object files correctly.. export PROJECT=release-1.1.0-alpha export TOOLCHAIN=uclibcgnueabi # You shouldn't need to change these variables export ARCH=arm export TARGET=arm-fusion-linux export CROSS_COMPILE=${TARGET}-${TOOLCHAIN}- export PRJROOT=${DEVROOT}${PROJECT} export HOST=i686-cross-linux-gnu export PREFIX=/opt export ROOTFS=${PRJROOT}/rootfs/${TOOLCHAIN} export IMAGEDIR=${PRJROOT}/images/${TOOLCHAIN} # export TARGET_PREFIX=${PREFIX}/${TARGET} export PATH=${PREFIX}/${TOOLCHAIN}/bin:${PATH} ## C Compiler Configuration ## CC = $(CROSS_COMPILE)gcc CC_SPECIAL_FLAGS = $(CPP_FLAGS) -Wall -c -fPIC -D_REENTRANT CC_DEBUG_FLAGS = -g -ggdb -O0 -DDEBUG -rdynamic -pg CC_RELEASE_FLAGS = -O2 -DNDEBUG CC_OUTPUT_FLAG = -o ## C++ Compiler Configuration ## CXX = $(CROSS_COMPILE)g++ CXX_SPECIAL_FLAGS = $(CC_SPECIAL_FLAGS) -pipe CXX_DEBUG_FLAGS = $(CC_DEBUG_FLAGS) CXX_RELEASE_FLAGS = $(CC_RELEASE_FLAGS) CXX_OUTPUT_FLAG = -o ## Linker Configuration ## LD = $(CROSS_COMPILE)ld LD_SPECIAL_FLAGS = LD_DEBUG_FLAGS = #-pg LD_RELEASE_FLAGS = LD_OUTPUT_FLAG = -o Any help would be much appreciated |
|||
|
#2
|
|||
|
|||
Re: ld Linker errorI have since progressed past these errors by using g++ the link the lib's instead of ld. But am puzzled as you why this cant be done with ld?
Any ideas would be appreciated |
|
#3
|
||||
|
||||
Re: ld Linker errorQuote:
Obviously, it *is* being done by ld, which g++ invokes. You're simply not invoking it properly. $ ld --help > ld.help.txt (using your arm-based ld!) ...read thoroughly and all will be clear. You are likely not invoking ld with the proper arguments. However, as you've found out, g++ oftentimes makes it easier to link because it translates compiler input arguments to linker input arguments, which are a bit more arcane for those who do not regularly independently invoke ld. Most likely, you're not passing enough variables to ld, such as which linker script to use and how to link the objects...assuming that you're even passing the objects. (I glanced at your post, so if it is there and I didn't see it, call me lazy.) There are a LOT of variables that need to be passed to ld, particularly when cross compiling. You often need to pass the machine type, output file type, etc. ld will tell you the kinds of object files it expects and what the output type (choices) will be. Use objcopy to convert from one type to another. Note that machine type can also be specified in the linker script. Writing your own, custom linker script may be suitable for your particular target however, it sounds as if you probably already have a suitable script. You may want to find out what it contains so that you can better understand "the world" according to gcc. While learning, execute all "binutils" binaries using the -v (verbose) option. You'll be inundated with information that, once the confusion passes, makes everything much more clear. Just about every toolchain is an extremely complex world developed over years of work by many people. It is very difficult to assume that anyone would "just know" all of what is contained in that world. MxB |
Recent GIDBlog
Problems with the Navy (Chiefs) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Two-Tier data dissemination code installation problem | nidhibansal1984 | Computer Software Forum - Linux | 6 | 16-Sep-2007 11:13 |
| Linked Lists advice request | promsan | C Programming Language | 74 | 23-May-2007 09:29 |
| Major newbie problem | cynack | MS Visual C++ / MFC Forum | 1 | 08-Apr-2007 12:25 |
| Winsock error when compiling FLTK 2.0 Projects | mauriciorossi | FLTK Forum | 3 | 16-Aug-2005 11:18 |
| Help with syntax errors | PeteGallo | C Programming Language | 7 | 08-Aug-2005 21:30 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The