inconsistent library link

Mathew Boorman <[email protected]> 06 Feb 2004 21:53:04 +1100
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
The following log is for 2 attempts to build a shared lib and an
application linked against it.

The first time it tries to link the lib with g++, which fails.
Building again and it links the lib with ld -shared which works fine.

[[email protected] aap]$ aap
Aap:  g++       -MM dog.cpp > build-Linux2_4_20_8/dog.cpp.aap
Aap: g++    -O2  -fPIC -c -o build-Linux2_4_20_8/dog.sho dog.cpp
Aap: g++  -O2 -o libdog.so build-Linux2_4_20_8/dog.sho
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o(.text+0x18): In
function `_start':
../sysdeps/i386/elf/start.S:77: undefined reference to `main'
collect2: ld returned 1 exit status
Aap: Error in recipe "/home/mat/aap/main.aap" line 5: Error executing
commands for builddll default: Error in recipe
"/usr/local/lib/aap/Exec-1.049/default.aap" line 493: Error executing
commands for cxx_build default: Error in recipe
"/usr/local/lib/aap/Exec-1.049/default.aap" line 427: Shell command
returned 1


[[email protected] aap]$ aap
Aap: ld  -shared -o libdog.so build-Linux2_4_20_8/dog.sho
Aap:  g++       -MM go1.cpp > build-Linux2_4_20_8/go1.cpp.aap
Aap: g++    -O2  -c -o build-Linux2_4_20_8/go1.o go1.cpp
Aap: g++ -L. -O2 -o go1 build-Linux2_4_20_8/go1.o -ldog


Rule file was:
# aap sample
:dll dog : dog.cpp

:program go1 
	{var_LIBS= -ldog }
	{var_LDFLAGS= -L. }
	:
 	go1.cpp






-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn