Re: ? 4GL compile/link w/ .so (using gcc)
Posted in 1998
In article <34F4A63C.8E10E763@wholefoods.com>, John Bitsche
<john.bitsche@wholefoods.com> writes
>Greetings from the Heart of Texas (Austin):
>
>We are trying to compile/link some 4GL programs using shared objects,
>but have hit a brick wall and we are hoping someone might suggest how we
>can get around it. Situation detailed below...
>
>Many thanks,
>
>John Bitsche
>Programmer/Analyst
>Whole Foods Market
>Austin, Texas
>
>>Date: Wed, 25 Feb 1998 15:50:06 -0600
>> From: Steve
>> To: John
>
>
>######## Specific Questions ###########
>Why are functions in a shared object library not being found by ld, even
>when the error messages clearly indicate that the shared object
>libraries were found as were the function references therein?
>
>We suspect that the .so files may not have been created correctly, but
>are not sure how to test this theory and pinpoint the specific problem.
>
>What is the standard cc/ld command combination to create .so files?
>
There isn;t one, it is OS specific.
>The .so file $INFORMIXDIR/lib/tools gets linked in correctly by ld. None
>of its functions are in the unresolved list.
>
It is compeletly self contained and does NOT call shared functions
OUTSIDE the .so file.
>######### Background and Details #############
>Machine info:
>SunOS wfmris 5.6 Generic sun4u sparc SUNW,Ultra-Enterprise
>
>Informix info:
>INFORMIX-4GL Version 6.05.UD1
>DB-Access Version 7.24.UC2
>
>GNU compiler
>
>Contents of /usr/fourgen/lib (where the subject shared object files are
>located):
>prog_ctl.so report.so scr.so standard.so stubs.so user_ctl.so
>
>Produced by:
>cc -fwritable-strings -fPIC ...
>ld -G ...
>
>Characteristics of the subject shared library files:
>prog_ctl.so: ELF 32-bit MSB dynamic lib SPARC Version 1, dynamically
>linked, not stripped
>report.so: ELF 32-bit MSB dynamic lib SPARC Version 1, dynamically
>linked, not stripped
>scr.so: ELF 32-bit MSB dynamic lib SPARC Version 1, dynamically
>linked, not stripped
>standard.so: ELF 32-bit MSB dynamic lib SPARC Version 1, dynamically
>linked, not stripped
>stubs.so: ELF 32-bit MSB dynamic lib SPARC Version 1, dynamically
>linked, not stripped
>user_ctl.so: ELF 32-bit MSB dynamic lib SPARC Version 1, dynamically
>linked, not stripped
>
>c4gl command executed:
>c4gl -shared account.o bnkrec.o branch.o browse.o chkstk.o detail.o
>fg_funcs.o fg_rcond.o fg_rconh.o globals.o header.o main.o midlevel.o
>reconz.o ../libcod.a ../lib2cod.a ../libwfm.a
>/usr3/fourgen/lib/prog_ctl.so /usr3/fourgen/lib/scr.so
>/usr3/fourgen/lib/user_ctl.so /usr3/fourgen/lib/standard.so
>/usr3/fourgen/lib/c_lib.a /usr3/fourgen/lib/stubs.so -s -o i_bankr.4ge
>
ld checks from STRICTLY from left to right when looking for functions.
Hence /usr3/fourgen/lib/standard.so must only call functions in
/usr3/fourgen/lib/c_lib.a /usr3/fourgen/lib/stubs.so
Try listing the shared libraries twice on the command line.
>resultant gcc command executed:
>cc -fwritable-strings -fPIC -I/usr3/informix7.2/incl/tools
>-I/usr3/informix7.2/incl/esql account.o bnkrec.o branch.o browse.o
>chkstk.o detail.o fg_funcs.o fg_rcond.o fg_rconh.o globals.o header.o
>main.o midlevel.o reconz.o ../libcod.a ../lib2cod.a ../libwfm.a
>/usr3/fourgen/lib/prog_ctl.so /usr3/fourgen/lib/scr.so
>/usr3/fourgen/lib/user_ctl.so /usr3/fourgen/lib/standard.so
>/usr3/fourgen/lib/c_lib.a /usr3/fourgen/lib/stubs.so -s -o i_bankr.4ge
>-L/usr3/informix7.2/lib/tools -l4gsh605
>/usr3/informix7.2/lib/tools/netlib.a -lnsl -lsocket -lm -ltermlib
>
>Resultant error messages:
>Unable to link i_bankr.4ge. Error message:
>-o 2 Undefined first referenced
> symbol in file
>menu_next /usr3/fourgen/lib/prog_ctl.so
>logstart main.o
>textedit /usr3/fourgen/lib/user_ctl.so
>menu_display /usr3/fourgen/lib/prog_ctl.so
>variabletext_prompt /usr3/fourgen/lib/scr.so
>textpick account.o
>menu_mark /usr3/fourgen/lib/prog_ctl.so
>menu_help /usr3/fourgen/lib/prog_ctl.so
>lib_message account.o
>langtrans_strtonative account.o
>lib_delkey /usr3/fourgen/lib/scr.so
>warnync chkstk.o
>lib_chkkey /usr3/fourgen/lib/scr.so
>textput account.o
>put_vararg account.o
>event_prc /usr3/fourgen/lib/user_ctl.so
>num_vararg bnkrec.o
>wait_on /usr3/fourgen/lib/user_ctl.so
>lib_newkey /usr3/fourgen/lib/scr.so
>set_fldtab account.o
>lib_getkey /usr3/fourgen/lib/scr.so
>put_scrlib account.o
>fg_username ../lib2cod.a(security.o)
>oscommand_run /usr3/fourgen/lib/scr.so
>ring_clear fg_rconh.o
>table_exist /usr3/fourgen/lib/standard.so
>fg_error ../lib2cod.a(key_edit.o)
>eror_menu /usr3/fourgen/lib/user_ctl.so
>fg_help /usr3/fourgen/lib/scr.so
>menu_open /usr3/fourgen/lib/prog_ctl.so
>variabletext_error /usr3/fourgen/lib/scr.so
>textview /usr3/fourgen/lib/user_ctl.so
>menu_light /usr3/fourgen/lib/prog_ctl.so
>please_wait /usr3/fourgen/lib/scr.so
>menuhelp ../lib2cod.a(key_pick.o)
>message_window /usr3/fourgen/lib/user_ctl.so
>warnyn fg_rcond.o
>langjoin ../libcod.a(zledcls.o)
>menu_set /usr3/fourgen/lib/prog_ctl.so
>...
>ld: fatal: Symbol referencing errors. No output written to i_bankr.4ge
>Occurred while compiling
>in /usr3/fourgen/accounting/all.4gm/i_bankr.wfm
>
>All unresolved symbols reported by ld are in the .so files listed in the
>error message.
>
>Environment:
>
>PATH=.:/usr3/fourgen/bin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/ccs/bin:/opt/GCC2723>/bin:/usr3/informix7.2/bin:/usr3/fourgen/bin:/usr/local/bin:/usr/bin:/etc:
>
>DBNAME=standard
>DBSRC=/usr3/fourgen/lib/report.RDS:/usr3/fourgen/lib/standard.RDS:/usr3/fourgen/
>lib/stubs.RDS:/usr3/fourgen/accounting/libcod.RDS
>
>shared_libs=Y
>company=wfm_test
>fg=/usr3/fourgen
>SHELL=/bin/ksh
>INFORMIXDIR=/usr3/informix7.2>TERM=vt220
>PWD=/usr3/fourgen/Make
>
>
>
--
David Williams
Maintainer of the Informix FAQ
Primary site (Beta Version) http://www.smooth1.demon.co.uk
Official site http://www.iiug.org/techinfo/faq/faq_top.html
I see you standin', Standin' on your own, It's such a lonely place for you, For@@N