4.6pre1 Makefile link libraries
Wendell Thompson
wthompson at dsg-test.com
Thu Mar 6 22:39:38 UTC 2003
FYI to anyone interested in these issues, see notes below:
Wendell Thompson wrote:
> Ralf Corsepius wrote:
>
>> Am Die, 2003-03-04 um 23.08 schrieb Wendell Thompson:
>>
>>> gregory.menke at gsfc.nasa.gov wrote:
>>>
>>>> Wendell Thompson writes:
>>>> > For a C++ application with 4.6.0pre1, which link libraries need to
>>>> be > listed in the Makefile?
>>>> > > The linker is complaining about even the C++ basics- operator
>>>> new, > operator delete, etc. Amongst other things.
>>>> >
>>>
>>>
>>
>> This indicates one of these
>>
>> * not using <target>-rtems-g++ to link.
>> * not using make-cxx-exe to build the download-images
>> * not having a make-cxx-exe in your <bsp>.cfg
>>
>
To use <target>-rtems-g++ to link, the rule for make-cxx-exe needs to
use $(LINK.cc) and include $(AM_CXXFLAGS) as below in <bsp>.cfg:
define make-cxx-exe
$(LINK.cc) $(AM_CFLAGS) $(AM_CXXFLAGS) $(AM_LDFLAGS) \
-o $(basename $@).exe \
-Xlinker -Map -Xlinker mapfile $(LINK_OBJS) $(LINK_LIBS)
endef
The $(PGM) target in the application Makefile needs to call
$(make-cxx-exe) instead of $(make-exe):
$(PGM): $(OBJS) $(LINK_FILES)
$(make-cxx-exe)
?? Does anyone know where $(LINK.cc) is documented? I can't find it in
the info page for make.
>
> On to the next problem. The linker insists on including dummy.o from
> librtemscpu.a, even though the Init function is defined in the app files
> (in init5206.c):
>
> m68k-rtems-g++ -B/opt/rtems/m68k-rtems/clc5206_am/lib/ -specs bsp_specs
> -qrtems -g -Wall -O4 -fomit-frame-pointer -g -gstabs+ -m5200
> -DREV_B -DNUM_TL1_PORTS=3 -o o-optimize/rtems_demo.exe -Xlinker
> -Map -Xlinker mapfile o-optimize/console.o o-optimize/init5206.o
> o-optimize/Sys_Task.o o-optimize/Leds.o o-optimize/Dig_Io.o
> o-optimize/Alarms.o o-optimize/Timer.o o-optimize/Ext_Ctrls.o
> o-optimize/Bit_Map.o o-optimize/Switches.o o-optimize/Lib.o
> o-optimize/Tl1_Port.o o-optimize/Port_Task.o o-optimize/Sio.o
> o-optimize/Buffer.o o-optimize/Modem.o o-optimize/Lists.o
> o-optimize/Message.o o-optimize/Am416Rtc.o o-optimize/SioRCF.o
> o-optimize/ds1302.o o-optimize/Globals.o o-optimize/NVRam.o
> o-optimize/tc58f400.o o-optimize/RTEMSTimer.o o-optimize/ModemMx614.o
> o-optimize/HalfDup_Tl1.o o-optimize/init.o
> /opt/rtems/m68k-rtems/clc5206_am/lib/no-dpmem.rel
> /opt/rtems/m68k-rtems/clc5206_am/lib/no-mp.rel
> /opt/rtems/m68k-rtems/clc5206_am/lib/no-part.rel
> /opt/rtems/m68k-rtems/clc5206_am/lib/librtems++.a
> /opt/rtems/m68k-rtems/clc5206_am/lib/librtemscpu.a(dummy.o): In function
> `Init':
> itimerspec/../../../../../../../cpukit/libmisc/dummy/dummy.c:150:
> multiple definition of `Init'
> o-optimize/init.o:/usr/local/projects/cf_am416_revb_rtems-4.6pre1/init.cpp:44:
> first defined here
> /opt/rtems/lib/gcc-lib/m68k-rtems/3.2.1/../../../../m68k-rtems/bin/ld:
> Warning: size of symbol `Init' changed from 2942 to 2 in
> /opt/rtems/m68k-rtems/clc5206_am/lib/librtemscpu.a(dummy.o)
> /opt/rtems/m68k-rtems/clc5206_am/lib/librtemscpu.a(dummy.o)(.data+0x2c):
> undefined reference to `main'
> collect2: ld returned 1 exit status
>
>
This and other mysterious linker errors disappeared with the addition of
"CONFIGURE_INIT" to the start of the application configuration table.
Configure carefully!
More information about the users
mailing list