Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] Changes from gcc 4.5.4 to 4.7.3
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Varminter
n00b
n00b


Joined: 31 Oct 2008
Posts: 16

PostPosted: Wed Oct 09, 2013 10:41 pm    Post subject: [SOLVED] Changes from gcc 4.5.4 to 4.7.3 Reply with quote

Afternoon all,
I'm recompiling an server side application I had written a few years ago for a customer. The program was written in ANSI C, and it compiles fine using "make" under 4.5.4. But, the main server crashed, so we've built a new one, with a brand new install on the drives, and new faster hardware. I'm getting the following message from gcc during the linking phase on the new machine:
Code:

rphaneuf $ make availity
/usr/bin/gcc availity.o /pistol/availity/availity_fork/4010/object_files/4010lib.a /pistol/availity/availity_fork/5010/object_files/5010lib.a -o @ -O1 -L/pistol/availity/common -L/usr/lib/mysql -lcurl -lssl -lcrypto -lldap -lrt -ldl -lz -lnsl -lmysqlclient /usr/lib/libcurl.a /pistol/availity/common/dmn_init.o -fPIC
availity.o: In function `main':
/pistol/availity/availity_fork/availity.c:723: undefined reference to `do_TA1'
/pistol/availity/availity_fork/availity.c:806: undefined reference to `do_TA1'
/pistol/availity/availity_fork/availity.c:883: undefined reference to `do_TA1'
/pistol/availity/availity_fork/4010/object_files/4010lib.a(do_4010.o): In function `do_4010':
/pistol/availity/availity_fork/4010/do_4010.c:237: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/do_4010.c:271: undefined reference to `add_997'


The old Makefile that works on a different server, under 4.5.4 is:
Code:

#  Assorted Variables:
LOCATION = D2I2
STATUS = PRODUCTION
LINE_STATUS = ONLINE

CFLAGS_TEST     = -g -D$(LOCATION) -D$(STATUS) -D$(LINE_STATUS) -I${CURL_INCLUDES} -I${MYSQL_INCLUDES} -fPIC
CFLAGS_PROD     = -g -D$(LOCATION) -D$(STATUS) -DONLINE -I${CURL_INCLUDES} -I${MYSQL_INCLUDES} -fPIC
LDFLAGS =  -Wl -O1 -lcurl -lssl -lcrypto -lldap -lrt -ldl -lz -lnsl -L$(COMMON) -lmysqlclient -L${MYSQL_LIBDIR} ${CURL_LIBDIR}/libcurl.a ${COMMON}/dmn_init.o -fPIC
COMMON = /bcbso/common
CC = /usr/bin/gcc
MYSQL_INCLUDES = /usr/include/mysql
MYSQL_LIBDIR = /usr/lib/mysql
CURL_INCLUDES = /usr/include/curl
CURL_LIBDIR = /usr/lib
4010_OBJDIR = /bcbso/availity_fork/4010/object_files
5010_OBJDIR = /bcbso/availity_fork/5010/object_files

SRCDIR  =       .

MAKE    =       make -${MAKEFLAGS}

all: availity

clean:
        rm -f *.a *.o  availity.o availity \
        availitymd availitymd1 availitymd1.c

install:
        /bcbso/bin/availity.sh stop
        cp ./availity /bcbso/bin/hipaa
        sleep 1
        /bcbso/bin/availity.sh start

installall:
        /bcbso/bin/availity.sh stop
        cp ./availity /bcbso/bin/hipaa
        sleep 1
        /bcbso/bin/availity.sh start


availity: availity.o ${4010_OBJDIR}/4010lib.a ${5010_OBJDIR}/5010lib.a
        $(CC) availity.o ${4010_OBJDIR}/4010lib.a ${5010_OBJDIR}/5010lib.a $(LDFLAGS) -o $@

availity.o: availity.c ${COMMON}/availity.h ${MYSQL_INCLUDES}/mysql.h
        $(CC) -c $(CFLAGS_TEST) -DHIPAA availity.c


Now, I do realized that the path names have changed between the two servers, and I've gone in and changed them from the /bcbso/* to /pistol/availity/*. And I've successfully recompiled the 4010lib.a and 5010lib.a, and they do exist in the directory that gcc says it is looking in. So as near as I can tell, something has changed with the Makefile arguments between gcc 4.5 and gcc 4.7

I'll admit to not being a Makefile expert, as I usually find one that does what I want and works then copy slavishly from it. So any help would be greatly appreciated.

Thanks in advance

--
Rich


Last edited by Varminter on Thu Oct 10, 2013 4:39 pm; edited 1 time in total
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8594

PostPosted: Thu Oct 10, 2013 1:57 am    Post subject: Reply with quote

Your make output on the new server looks suspicious. It appears to name the output file @. Other than that, please explain why you think this is related to Make. Are you certain that you are using all the same source files and libraries on both servers? What is the full output of make in both environments?
Back to top
View user's profile Send private message
Varminter
n00b
n00b


Joined: 31 Oct 2008
Posts: 16

PostPosted: Thu Oct 10, 2013 2:14 am    Post subject: Reply with quote

Here's the Makefile from the 4.5.4 machine:
Code:

rphaneuf $ cat Makefile
#!/bin/make -f
# @(#) makefile 3.13 94/08/18
#
#  Copyright(c)1992 Open Systems Engineering, Inc.
#  All rights reserved
#
#  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF OSE
#  The copy right notice above does not evidence any
#  actual or intended publication of such source code.
#
#  Change History
#
#    Date       Who     Description
#  08/18/94     WAB     Created
#
#  Assorted Variables:
#               LOCATION: Choose either OSE or BCBSO
LOCATION = D2I2
#STATUS = TEST
STATUS = PRODUCTION
#LINE_STATUS = OFFLINE
LINE_STATUS = ONLINE

CFLAGS_TEST     = -g -D$(LOCATION) -D$(STATUS) -D$(LINE_STATUS) -I${CURL_INCLUDES} -I${MYSQL_INCLUDES} -fPIC
CFLAGS_PROD     = -g -D$(LOCATION) -D$(STATUS) -DONLINE -I${CURL_INCLUDES} -I${MYSQL_INCLUDES} -fPIC
#LDFLAGS        =  -Wl -O1 -xildoff -lcurl -lssl -lcrypto -lldap -lrt -ldl -lz -lnsl -L$(COMMON) -lmysqlclient -L${MYSQL_LIBDIR} ${CURL_LIBDIR}/libcurl.a ${COMMON}/dmn_init.o
LDFLAGS =  -Wl -O1 -lcurl -lssl -lcrypto -lldap -lrt -ldl -lz -lnsl -L$(COMMON) -lmysqlclient -L${MYSQL_LIBDIR} ${CURL_LIBDIR}/libcurl.a ${COMMON}/dmn_init.o -fPIC
COMMON = /bcbso/common
CC = /usr/bin/gcc
MYSQL_INCLUDES = /usr/include/mysql
MYSQL_LIBDIR = /usr/lib/mysql
CURL_INCLUDES = /usr/include/curl
CURL_LIBDIR = /usr/lib
4010_OBJDIR = /bcbso/availity_fork/4010/object_files
5010_OBJDIR = /bcbso/availity_fork/5010/object_files

SRCDIR  =       .

MAKE    =       make -${MAKEFLAGS}
#               GET=${GET}

all: availity

clean:
        rm -f *.a *.o  availity.o availity

install:
        /bcbso/bin/availity.sh stop
        cp ./availity /bcbso/bin/hipaa
        sleep 1
        /bcbso/bin/availity.sh start

installall:
        /bcbso/bin/availity.sh stop
        cp ./availity /bcbso/bin/hipaa
        sleep 1
        /bcbso/bin/availity.sh start


availity: availity.o ${4010_OBJDIR}/4010lib.a ${5010_OBJDIR}/5010lib.a
        $(CC) availity.o ${4010_OBJDIR}/4010lib.a ${5010_OBJDIR}/5010lib.a $(LDFLAGS) -o $@

availity.o: availity.c ${COMMON}/availity.h ${MYSQL_INCLUDES}/mysql.h
        $(CC) -c $(CFLAGS_TEST) -DHIPAA availity.c

#  End of makefile


And the compile of the same program that I'm trying to do on the new box:
Code:

rphaneuf $ make availity
/usr/bin/gcc availity.o /bcbso/availity_fork/4010/object_files/4010lib.a /bcbso/availity_fork/5010/object_files/5010lib.a -Wl -O1 -lcurl -lssl -lcrypto -lldap -lrt -ldl -lz -lnsl -L/bcbso/common -lmysqlclient -L/usr/lib/mysql /usr/lib/libcurl.a /bcbso/common/dmn_init.o -fPIC -o availity
rphaneuf $


And the Makefile was posted in my initial above. Here's the complete output:
Code:

rphaneuf $ make availity
/usr/bin/gcc availity.o /pistol/availity/availity_fork/4010/object_files/4010lib.a /pistol/availity/availity_fork/5010/object_files/5010lib.a -o @ -O1 -L/pistol/availity/common -L/usr/lib/mysql -lcurl -lssl -lcrypto -lldap -lrt -ldl -lz -lnsl -lmysqlclient /usr/lib/libcurl.a /pistol/availity/common/dmn_init.o -fPIC
availity.o: In function `main':
/pistol/availity/availity_fork/availity.c:723: undefined reference to `do_TA1'
/pistol/availity/availity_fork/availity.c:806: undefined reference to `do_TA1'
/pistol/availity/availity_fork/availity.c:883: undefined reference to `do_TA1'
/pistol/availity/availity_fork/4010/object_files/4010lib.a(do_4010.o): In function `do_4010':
/pistol/availity/availity_fork/4010/do_4010.c:237: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/do_4010.c:271: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/do_4010.c:362: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/do_4010.c:469: undefined reference to `make_997'
/pistol/availity/availity_fork/4010/do_4010.c:676: undefined reference to `make_997'
/pistol/availity/availity_fork/4010/object_files/4010lib.a(270_isa.o): In function `check_ISA':
/pistol/availity/availity_fork/4010/270/270_isa.c:109: undefined reference to `do_TA1'
/pistol/availity/availity_fork/4010/270/270_isa.c:117: undefined reference to `do_TA1'
/pistol/availity/availity_fork/4010/270/270_isa.c:125: undefined reference to `do_TA1'
/pistol/availity/availity_fork/4010/270/270_isa.c:133: undefined reference to `do_TA1'
/pistol/availity/availity_fork/4010/270/270_isa.c:143: undefined reference to `do_TA1'
/pistol/availity/availity_fork/4010/object_files/4010lib.a(270_isa.o):/pistol/availity/availity_fork/4010/270/270_isa.c:151: more undefined references to `do_TA1' follow
/pistol/availity/availity_fork/4010/object_files/4010lib.a(270_gs.o): In function `check_GS':
/pistol/availity/availity_fork/4010/270/270_gs.c:70: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/270/270_gs.c:78: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/270/270_gs.c:87: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/270/270_gs.c:102: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/270/270_gs.c:110: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/object_files/4010lib.a(270_gs.o):/pistol/availity/availity_fork/4010/270/270_gs.c:125: more undefined references to `add_997' follow
/pistol/availity/availity_fork/5010/object_files/5010lib.a(270_isa.o): In function `check_ISA_5010':
/pistol/availity/availity_fork/5010/270/270_isa.c:109: undefined reference to `do_TA1'
/pistol/availity/availity_fork/5010/270/270_isa.c:117: undefined reference to `do_TA1'
/pistol/availity/availity_fork/5010/270/270_isa.c:125: undefined reference to `do_TA1'
/pistol/availity/availity_fork/5010/270/270_isa.c:133: undefined reference to `do_TA1'
/pistol/availity/availity_fork/5010/270/270_isa.c:143: undefined reference to `do_TA1'
/pistol/availity/availity_fork/5010/object_files/5010lib.a(270_isa.o):/pistol/availity/availity_fork/5010/270/270_isa.c:151: more undefined references to `do_TA1' follow
/pistol/availity/availity_fork/5010/object_files/5010lib.a(270_gs.o): In function `check_GS_5010':
/pistol/availity/availity_fork/5010/270/270_gs.c:70: undefined reference to `add_997'
/pistol/availity/availity_fork/5010/270/270_gs.c:78: undefined reference to `add_997'
/pistol/availity/availity_fork/5010/270/270_gs.c:87: undefined reference to `add_997'
/pistol/availity/availity_fork/5010/270/270_gs.c:102: undefined reference to `add_997'
/pistol/availity/availity_fork/5010/270/270_gs.c:110: undefined reference to `add_997'
/pistol/availity/availity_fork/5010/object_files/5010lib.a(270_gs.o):/pistol/availity/availity_fork/5010/270/270_gs.c:125: more undefined references to `add_997' follow
collect2: error: ld returned 1 exit status
make: *** [availity] Error 1


The source is the same. I tar'd the entire directory tree on the old server and brought it over to the new one. Then the only change I did was to change the initial "/bcbso/" to the new path of "/pistol/availity/". Here's the contents of the /pistol/availity/availity_fork/4010/object_files/ directory, as you can see, I got all those to compile clean.
Code:

rphaneuf $ cd 4010/object_files/
rphaneuf $ ls
total 2152
-rw-r--r-- 1   15896 Oct  9 12:04 270_amt.o
-rw-r--r-- 1   33464 Oct  9 12:03 270_bht.o
-rw-r--r-- 1   26944 Oct  9 12:04 270_dmg.o
-rw-r--r-- 1   16832 Oct  9 12:04 270_dtp.o
-rw-r--r-- 1   19944 Oct  9 12:04 270_eq.o
-rw-r--r-- 1   48048 Oct  9 12:03 270_gs.o
-rw-r--r-- 1   23528 Oct  9 12:03 270_hl.o
-rw-r--r-- 1   33608 Oct  9 12:04 270_iii.o
-rw-r--r-- 1   40656 Oct  9 12:04 270_ins.o
-rw-r--r-- 1   86272 Oct  9 12:03 270_isa.o
-rw-r--r-- 1   14720 Oct  9 12:04 270_n3.o
-rw-r--r-- 1   22520 Oct  9 12:04 270_n4.o
-rw-r--r-- 1   78536 Oct  9 12:03 270_nm1.o
-rw-r--r-- 1   20896 Oct  9 12:04 270_per.o
-rw-r--r-- 1   25392 Oct  9 12:04 270_prv.o
-rw-r--r-- 1   24120 Oct  9 12:04 270_ref.o
-rw-r--r-- 1   22992 Oct  9 12:03 270_st.o
-rw-r--r-- 1   18344 Oct  9 12:04 270_trn.o
-rw-r--r-- 1   12280 Oct  9 12:08 271_aaa.o
-rw-r--r-- 1   13368 Oct  9 12:08 271_bht.o
-rw-r--r-- 1   13456 Oct  9 12:08 271_dmg.o
-rw-r--r-- 1   13880 Oct  9 12:08 271_dtp.o
-rw-r--r-- 1   16920 Oct  9 12:08 271_eb.o
-rw-r--r-- 1   12888 Oct  9 12:08 271_ge.o
-rw-r--r-- 1   16320 Oct  9 12:08 271_gs.o
-rw-r--r-- 1   13128 Oct  9 12:08 271_hl.o
-rw-r--r-- 1   13896 Oct  9 12:08 271_hsd.o
-rw-r--r-- 1   11040 Oct  9 12:08 271_iea.o
-rw-r--r-- 1   14296 Oct  9 12:08 271_iii.o
-rw-r--r-- 1   17512 Oct  9 12:08 271_ins.o
-rw-r--r-- 1   12240 Oct  9 12:08 271_isa.o
-rw-r--r-- 1    9920 Oct  9 12:08 271_le.o
-rw-r--r-- 1    9920 Oct  9 12:08 271_ls.o
-rw-r--r-- 1   11864 Oct  9 12:08 271_msg.o
-rw-r--r-- 1   15256 Oct  9 12:08 271_n3.o
-rw-r--r-- 1   17288 Oct  9 12:08 271_n4.o
-rw-r--r-- 1   18912 Oct  9 12:08 271_nm1.o
-rw-r--r-- 1   14792 Oct  9 12:08 271_per.o
-rw-r--r-- 1   13528 Oct  9 12:08 271_prv.o
-rw-r--r-- 1   13120 Oct  9 12:08 271_ref.o
-rw-r--r-- 1   12736 Oct  9 12:08 271_se.o
-rw-r--r-- 1   11776 Oct  9 12:08 271_st.o
-rw-r--r-- 1   13016 Oct  9 12:08 271_trn.o
-rw-r--r-- 1 1029194 Oct  9 12:08 4010lib.a
-rwxr-xr-x 1    2021 Oct  9 11:51 Makefile
-rw-r--r-- 1   11192 Oct  9 12:04 add_ge.o
-rw-r--r-- 1   11304 Oct  9 12:04 add_iea.o
-rw-r--r-- 1   11608 Oct  9 12:04 add_se.o
-rw-r--r-- 1   75512 Oct  9 11:51 do_4010.o
-rw-r--r-- 1   29776 Oct  9 11:51 do_997.o
-rw-r--r-- 1   12216 Oct  9 11:51 do_TA1.o

All the Makefile does in this directory is combine the *.o files into the 4010lib.a file. There's a matching directory and similar output in the 5010 path (/pistol/availity/availity_fork/5010/object_files)

And the reason why I think it's the Makefile is that when I tried to compile the files, I got the linking errors. The only thing I initially did to the base Makefile, the one that compiles availity.o and availity, was to change the path from /bcbso/* to /pistol/availity/*.

The second thing I had changed, after the failures, was to move the "-o @" from the end of the makefile line to right after the 5010lib.a. This was after some reading / searching and people were saying to put the -o@ after the object file and put the includes / libraries at the end.

Here's the results from having the -o @ at the end of the line:
Code:

rphaneuf $ make availity
/usr/bin/gcc availity.o /pistol/availity/availity_fork/4010/object_files/4010lib.a /pistol/availity/availity_fork/5010/object_files/5010lib.a -O1 -L/pistol/availity/common -L/usr/lib/mysql -lcurl -lssl -lcrypto -lldap -lrt -ldl -lz -lnsl -lmysqlclient /usr/lib/libcurl.a /pistol/availity/common/dmn_init.o -fPIC -o @
availity.o: In function `main':
/pistol/availity/availity_fork/availity.c:723: undefined reference to `do_TA1'
/pistol/availity/availity_fork/availity.c:806: undefined reference to `do_TA1'
/pistol/availity/availity_fork/availity.c:883: undefined reference to `do_TA1'
/pistol/availity/availity_fork/4010/object_files/4010lib.a(do_4010.o): In function `do_4010':
/pistol/availity/availity_fork/4010/do_4010.c:237: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/do_4010.c:271: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/do_4010.c:362: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/do_4010.c:469: undefined reference to `make_997'
/pistol/availity/availity_fork/4010/do_4010.c:676: undefined reference to `make_997'
/pistol/availity/availity_fork/4010/object_files/4010lib.a(270_isa.o): In function `check_ISA':
/pistol/availity/availity_fork/4010/270/270_isa.c:109: undefined reference to `do_TA1'
/pistol/availity/availity_fork/4010/270/270_isa.c:117: undefined reference to `do_TA1'
/pistol/availity/availity_fork/4010/270/270_isa.c:125: undefined reference to `do_TA1'
/pistol/availity/availity_fork/4010/270/270_isa.c:133: undefined reference to `do_TA1'
/pistol/availity/availity_fork/4010/270/270_isa.c:143: undefined reference to `do_TA1'
/pistol/availity/availity_fork/4010/object_files/4010lib.a(270_isa.o):/pistol/availity/availity_fork/4010/270/270_isa.c:151: more undefined references to `do_TA1' follow
/pistol/availity/availity_fork/4010/object_files/4010lib.a(270_gs.o): In function `check_GS':
/pistol/availity/availity_fork/4010/270/270_gs.c:70: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/270/270_gs.c:78: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/270/270_gs.c:87: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/270/270_gs.c:102: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/270/270_gs.c:110: undefined reference to `add_997'
/pistol/availity/availity_fork/4010/object_files/4010lib.a(270_gs.o):/pistol/availity/availity_fork/4010/270/270_gs.c:125: more undefined references to `add_997' follow
/pistol/availity/availity_fork/5010/object_files/5010lib.a(270_isa.o): In function `check_ISA_5010':
/pistol/availity/availity_fork/5010/270/270_isa.c:109: undefined reference to `do_TA1'
/pistol/availity/availity_fork/5010/270/270_isa.c:117: undefined reference to `do_TA1'
/pistol/availity/availity_fork/5010/270/270_isa.c:125: undefined reference to `do_TA1'
/pistol/availity/availity_fork/5010/270/270_isa.c:133: undefined reference to `do_TA1'
/pistol/availity/availity_fork/5010/270/270_isa.c:143: undefined reference to `do_TA1'
/pistol/availity/availity_fork/5010/object_files/5010lib.a(270_isa.o):/pistol/availity/availity_fork/5010/270/270_isa.c:151: more undefined references to `do_TA1' follow
/pistol/availity/availity_fork/5010/object_files/5010lib.a(270_gs.o): In function `check_GS_5010':
/pistol/availity/availity_fork/5010/270/270_gs.c:70: undefined reference to `add_997'
/pistol/availity/availity_fork/5010/270/270_gs.c:78: undefined reference to `add_997'
/pistol/availity/availity_fork/5010/270/270_gs.c:87: undefined reference to `add_997'
/pistol/availity/availity_fork/5010/270/270_gs.c:102: undefined reference to `add_997'
/pistol/availity/availity_fork/5010/270/270_gs.c:110: undefined reference to `add_997'
/pistol/availity/availity_fork/5010/object_files/5010lib.a(270_gs.o):/pistol/availity/availity_fork/5010/270/270_gs.c:125: more undefined references to `add_997' follow
collect2: error: ld returned 1 exit status
make: *** [availity] Error 1


I guess there could be something else, but at this point, I've been zombified.

Thanks,

Rich
Back to top
View user's profile Send private message
cwr
Veteran
Veteran


Joined: 17 Dec 2005
Posts: 1632

PostPosted: Thu Oct 10, 2013 10:30 am    Post subject: Reply with quote

The first check I'd try is the absence of tabs in the Makefile, where they are required.
Generally when make has fits, that's the cause.

Will
Back to top
View user's profile Send private message
yoshi314
l33t
l33t


Joined: 30 Dec 2004
Posts: 817
Location: PL

PostPosted: Thu Oct 10, 2013 10:33 am    Post subject: Reply with quote

every next version of gcc gets more and more strict.

I would check your includes, as there might be something missing.
_________________
~amd64, ~x86
shrink your /usr/portage with squashfs+aufs
Back to top
View user's profile Send private message
Varminter
n00b
n00b


Joined: 31 Oct 2008
Posts: 16

PostPosted: Thu Oct 10, 2013 4:38 pm    Post subject: Reply with quote

Got it fixed. I did 3 things, and I'm not sure which of the 3 did it.
1) Changed 4010lib.a and 5010lib.a to be lib4010.a and lib5010.a respectively, per section 3.13 in the GCC 4.7.2 manual
2) Moved the do_TA1.o and do_997.o to the beginning of the lib4010.a compile list. The seemed to be the problem children in this issue, see section 3.13 of the GCC 4.7.2 manual on how libraries are included

Just so we all can know about this here's 3.13 of GCC 4.7.2 manual, it's in the code block because the Quote block removes leading spaces.
Code:

-llibrary
-l library
    Search the library named library when linking. (The second alternative with
the library as a separate argument is only for POSIX compliance and is not
recommended.)
    It makes a difference where in the command you write this option; the linker
searches and processes libraries and object files in the order they are specified.
Thus, ‘foo.o -lz bar.o’ searches library ‘z’ after file ‘foo.o’ but before
‘bar.o’. If ‘bar.o’ refers to functions in ‘z’, those functions may not be loaded.
    The linker searches a standard list of directories for the library, which is actually
a file named ‘liblibrary.a’. The linker then uses this file as if it had been
specified precisely by name.
    The directories searched include several standard system directories plus any
that you specify with ‘-L’.
    Normally the files found this way are library files—archive files whose members
are object files. The linker handles an archive file by scanning through it for
members which define symbols that have so far been referenced but not defined.
But if the file that is found is an ordinary object file, it is linked in the usual
fashion. The only difference between using an ‘-l’ option and specifying a file
name is that ‘-l’ surrounds library with ‘lib’ and ‘.a’ and searches several
directories.


Thanks for the help guys!

--
Rich
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum