Implementering af tredie parts bibliotek på SuSE 10.0 platform
Jeg er helt ny mht. linux og makefiler.Jeg skal have implementert et tredie parts bibliotek på vores SuSE 10.0 platform. Vi benytter GCC (version 3.4.3) kompiler til en power PC
Når jeg kompiler/linker for jeg følgende fejl:
"/opt/amltd/powerpc-linux/gcc-3.4.3-glibc-2.3.5/lib/gcc/powerpc-linux/3.4.3/../../../../powerpc-linux/bin/ld: lib/UniKey.a(UniKey.o): Relocations in generic ELF (EM: 3)
lib/UniKey.a: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [pay_pr_shot.debug] Error 1"
Jeg har søgt hjælp hos leverandøren af bibliotekket. Svaret fra leverandøren er
Hi,
The lib has been fully tested under Ubuntu and Fedra. The "Relocations in generic ELF (EM: 3)" error may be caused by that you've set your makefile up to link with the new g++ but you haven't changed the compiler you're using to build the objects in the first place.
The easiest way to fix this is to set environment CXX to the next compiler, i.e.
export CXX=...
or just set it for a given make by adding CXX=... to the command line.
You'll need to make clean first but you'll then use the correct compiler for both the compile and link.
You could also specify a new how-to-compile-C++ files rule in your makefile to specify the new compiler but the environment variable is easier:
.cc.o:
/home/.../g++ $(CPPFLAGS) $(CXXFLAGS) -c
Det jeg har udledt af svaret er at bibliotekket er bygget med en g++ kompiler.
Et uddrag af vores makefile
CC="/opt/amltd/bin/powerpc-linux-gcc"
OBJCOPY="/opt/amltd/bin/powerpc-linux-objcopy"
#CC="gcc"
#echo temporary compiler
C_FLAGS="-Wall -O2 -Iinclude"
LD="/opt/amltd/bin/powerpc-linux-gcc"
#LD="gcc"
#echo temporary linker
L_FLAGS="-Wall -O2 -Wl,-cref -Wl,-Map -Wl,application.map"
Spørgsmål:
1. Har jeg forstået det rigtigt, at årsagen til fejlen er, at vi benytter en GCC kompiler og bibliotekket er bygget med en g++ kompiler?
2. Hvad skal jeg ændre i makefilen for at få det til at virke ?
