Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Nov 2002 11:24:20 -0800
From:      Jordan K Hubbard <jkh@queasyweasel.com>
To:        The Anarcat <anarcat@anarcat.ath.cx>
Cc:        libh@FreeBSD.ORG, Alexander Langer <alex@big.endian.de>
Subject:   Re: serious libh linking problems
Message-ID:  <820539DB-F73D-11D6-9957-000393BB9222@queasyweasel.com>
In-Reply-To: <20021113042057.GC9054@lenny.anarcat.ath.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
Well, it was just a guess, and I see you'd already guessed it. :-)

Hmmm.  This does appear to be a linker mystery, alright.  What do John 
Polstra and David O'Brien have to say about this?

- Jordan

On Tuesday, November 12, 2002, at 08:20 PM, The Anarcat wrote:

> Wow! Quick response! Yay! I'm very happy that you're there to help 
> Jordan.
>
> That's an interesting proposition. -l declaration order can have such
> an effect? Let's see:
>
> g++31  -O -pipe  -I../../include -I/usr/local/include/tcl8.3     
> -L/usr/local/lib -L/usr/lib -o pkg_create pkg_create.o -ltcl83 -lh 
> -lhsysinstall -lhtcl -lhdatabase -lhfile
> /usr/lib/libhsysinstall.so: undefined reference to 
> `LanguageInterface::LanguageInterface(bool)'
>
> g++31  -O -pipe  -I../../include -I/usr/local/include/tcl8.3     
> -L/usr/local/lib -L/usr/lib -o pkg_create pkg_create.o -ltcl83 
> -lhsysinstall -lh -lhtcl -lhdatabase -lhfile
> /usr/lib/libhsysinstall.so: undefined reference to 
> `LanguageInterface::LanguageInterface(bool)'
>
>  g++31  -O -pipe  -I../../include -I/usr/local/include/tcl8.3     
> -L/usr/local/lib -L/usr/lib -o pkg_create pkg_create.o -ltcl83 -lhtcl 
> -lh -lhsysinstall  -lhdatabase -lhfile
> /usr/lib/libhsysinstall.so: undefined reference to 
> `LanguageInterface::LanguageInterface(bool)'
>
> g++31  -O -pipe  -I../../include -I/usr/local/include/tcl8.3     
> -L/usr/local/lib -L/usr/lib -o pkg_create pkg_create.o -ltcl83 -lhtcl 
> -lhsysinstall -lh  -lhdatabase -lhfile
> /usr/lib/libhsysinstall.so: undefined reference to 
> `LanguageInterface::LanguageInterface(bool)'
>
> I got tired of trying about then. :) Note that I tried that
> before. I've been struggling with such problems in libh for a while
> now. Note that tclh links properly. The tclh commandline is:
>
> gcc31 -pipe -g -I/usr/local/include/tcl8.3 -fpic -DPIC 
> -I/usr/home/anarcat/cvs-work/libh/bin/tclh/../../include   -Wall  
> -static -o tclh.static tclh.o 
> -L/usr/home/anarcat/cvs-work/libh/compile/none -lhtcl -lh -lhtclfile 
> -lhfile  -lhtcldisk -lhdisk -lhtclhui -lhui  -lhtclsysinstall 
> -lhsysinstall  -lhdatabase  -ltcl83 -lm -L/usr/local/lib -lstdc++ 
> -ldisk -lfetch -lz -lcom_err -lssl -lcrypto -lm
>
> But tclh is statically linked. I've never been able to dynamically
> link tclh. linking fails miserably again, but it's interesting to note
> that it fails similarly:
>
> anarcat@lenny[~/libh/compile/none]% gcc31 -pipe -g 
> -I/usr/local/include/tcl8.3 -fpic -DPIC 
> -I/usr/home/anarcat/cvs-work/libh/bin/tclh/../../include   -Wall  -o 
> tclh tclh.o -L/usr/home/anarcat/cvs-work/libh/compile/none -lhtcl -lh 
> -lhtclfile -lhfile  -lhtcldisk -lhdisk -lhtclhui -lhui  
> -lhtclsysinstall -lhsysinstall  -lhdatabase  -ltcl83 -lm 
> -L/usr/local/lib -lstdc++ -ldisk -lfetch -lz -lcom_err -lssl -lcrypto 
> -lm
> /usr/home/anarcat/cvs-work/libh/compile/none/libhsysinstall.so: 
> undefined reference to `cerr'
> /usr/home/anarcat/cvs-work/libh/compile/none/libhsysinstall.so: 
> undefined reference to `LanguageInterface::LanguageInterface(bool)'
>
> This is because "-L/usr/lib" is missing (???). Adding it gives us the
> exact same result as trying to link pkg_create:
>
> anarcat@lenny[~/libh/compile/none]% gcc31 -pipe -g 
> -I/usr/local/include/tcl8.3 -fpic -DPIC 
> -I/usr/home/anarcat/cvs-work/libh/bin/tclh/../../include   -Wall  -o 
> tclh tclh.o -L/usr/home/anarcat/cvs-work/libh/compile/none -lhtcl -lh 
> -lhtclfile -lhfile  -lhtcldisk -lhdisk -lhtclhui -lhui  
> -lhtclsysinstall -lhsysinstall  -lhdatabase  -ltcl83 -lm 
> -L/usr/local/lib -lstdc++ -ldisk -lfetch -lz -lcom_err -lssl -lcrypto 
> -lm -L/usr/lib
> /usr/home/anarcat/cvs-work/libh/compile/none/libhsysinstall.so: 
> undefined reference to `LanguageInterface::LanguageInterface(bool)'
> [...]
>
> However, trying to link pkg_create statically doesn't give any better
> results and actually spews thousands of undefined references.
>
> Do you know which gcc wizard I could redirect this too?
>
> A.
>
> On Tue Nov 12, 2002 at 08:07:23PM -0800, Jordan K Hubbard wrote:
>> Link order?  What happens when you stick -lhsysinstall *earlier* in 
>> the
>> link line, say before -lhtcl?
>>
>> On Tuesday, November 12, 2002, at 08:02 PM, The Anarcat wrote:
>>
>>> Hi all
>>>
>>> I write this to you in an attempt to solve a recurring problem I'm
>>> having with libh that is *really* hindering development, for me.  I'm
>>> currently trying to rewrite our pkg_create sh script in C++ (from a 
>>> sh
>>> script). I just checked-in the source in libh/bin/pkg_create. You
>>> haven't seen the mail because of DNS problems on rtp1.
>>>
>>> Anyways, I'm having problem linking the final program. I've seen
>>> similar problems when trying to switch to rhtvision and link other
>>> programs against libh.
>>>
>>> The source file is being properly compiled, g++ can find its headers,
>>> etc, and I can generate the .o file. However, when trying to link, I
>>> get:
>>>
>>> g++31  -O -pipe  -I../../include -I/usr/local/include/tcl8.3    -c
>>> pkg_create.cc
>>> g++31  -O -pipe  -I../../include -I/usr/local/include/tcl8.3
>>> -L/usr/local/lib -L/usr/lib -o pkg_create pkg_create.o -ltcl83 -lh
>>> -lhtcl -lhdatabase -lhfile -lhsysinstall
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `LanguageInterface::LanguageInterface(bool)'
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `LanguageInterface::Object type_info node'
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `LanguageInterface::languageUnref(LanguageInterface::Object const &)
>>> const'
>>> /usr/lib/libhsysinstall.so: undefined reference to `LanguageInterface
>>> type_info function'
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `LanguageInterface::referenced(LanguageInterface::Object const *)
>>> const'
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `LanguageInterface::languageRef(LanguageInterface::Object const &)
>>> const'
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `LanguageInterface::referenced(LanguageInterface::Object const &)
>>> const'
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `LanguageInterface::Object type_info function'
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `LanguageInterface::gc(void) const'
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `LanguageInterface::referencedObjects(void)'
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `LanguageInterface::referenceObject(LanguageInterface::Object const 
>>> *)
>>> const'
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `Shared::onHeap(void const *)'
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `LanguageInterface::dereferenceObject(LanguageInterface::Object const
>>> *) const'
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `LanguageInterface::object2string(LanguageInterface::Object const *)'
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `Shared::isOnHeap(Shared const *)'
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `LanguageInterface::~LanguageInterface(void)'
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `LanguageInterface::languageRef(LanguageInterface::Object const *)
>>> const'
>>> /usr/lib/libhsysinstall.so: undefined reference to
>>> `LanguageInterface::languageUnref(LanguageInterface::Object const *)
>>> const'
>>> /usr/lib/libhsysinstall.so: undefined reference to `LanguageInterface
>>> type_info node'
>>> collect2: ld returned 1 exit status
>>> *** Error code 1
>>>
>>> Stop in /usr/home/anarcat/cvs-work/libh/bin/pkg_create.
>>>
>>> I have just installed that library (libhsysinstall). What I don't
>>> understand is that I can't find that damn symbol anywhere:
>>>
>>> anarcat@lenny[~/libh/compile/none]% for f in libh*
>>> do; nm -C $f 2>/dev/null | grep LanguageInterface::Language  && echo
>>> "$f"
>>> done
>>>         U LanguageInterface::LanguageInterface(bool)
>>> libhsysinstall.a
>>>         U LanguageInterface::LanguageInterface(bool)
>>> libhsysinstall.so
>>>         U LanguageInterface::LanguageInterface(bool)
>>> libhsysinstall.so.0
>>> 00000000 W LanguageInterface::LanguageInterface(bool)
>>> libhtcl.a
>>> 000519da W LanguageInterface::LanguageInterface(bool)
>>> libhtcl.so
>>> 000519da W LanguageInterface::LanguageInterface(bool)
>>> libhtcl.so.0
>>> 00000000 W LanguageInterface::LanguageInterface(bool)
>>> libhtcldisk.a
>>> 00043798 W LanguageInterface::LanguageInterface(bool)
>>> libhtcldisk.so
>>> 00043798 W LanguageInterface::LanguageInterface(bool)
>>> libhtcldisk.so.0
>>> 00000000 W LanguageInterface::LanguageInterface(bool)
>>> libhtclfile.a
>>> 00049a12 W LanguageInterface::LanguageInterface(bool)
>>> libhtclfile.so
>>> 00049a12 W LanguageInterface::LanguageInterface(bool)
>>> libhtclfile.so.0
>>> 00000000 W LanguageInterface::LanguageInterface(bool)
>>> libhtclhui.a
>>> 0007969e W LanguageInterface::LanguageInterface(bool)
>>> libhtclhui.so
>>> 0007969e W LanguageInterface::LanguageInterface(bool)
>>> libhtclhui.so.0
>>> 00000000 W LanguageInterface::LanguageInterface(bool)
>>> libhtclsysinstall.a
>>> 000a4e32 W LanguageInterface::LanguageInterface(bool)
>>> libhtclsysinstall.so
>>> 000a4e32 W LanguageInterface::LanguageInterface(bool)
>>> libhtclsysinstall.so.0
>>>
>>> Some symbols are defined, however. For example, Shared::onHeap() is
>>> defined in libh.so:
>>>
>>> 0003a746 T Shared::onHeap(void const*)
>>> libh.so
>>>
>>> The thing itself is kinda very important to libh. It is defined in
>>> libh/include/LanguageInterface.hh:
>>>
>>> class LanguageInterface
>>> {
>>>     friend class H;
>>>     friend class HObjectsReferences;
>>>
>>>  public:
>>>     LanguageInterface( bool enableGC ) : mGC( enableGC ) {}
>>> ...
>>> }
>>>
>>> Why it's not linking anywhere is beyond me.
>>>
>>> Also, why tclh is linking at all is also a great mystery for me.
>>>
>>> Please, any hint will help greatly. I'm completly confused and pretty
>>> desperate to solve this problem.
>>>
>>> If I can't get this program to link I don't see very well where we
>>> should be going next. Is it really impossible/forbidden to link
>>> against LibH?
>>>
>>> A.
>>>
>>> -- 
>>> Advertisers, not governments, are the primary censors of media 
>>> content
>>> in the United States today.
>>>                        - C. Edwin Baker
>>>                        http://www.ad-mad.co.uk/quotes/freespeech.htm
>>> <mime-attachment>
>> --
>> Jordan K. Hubbard
>> Engineering Manager, BSD technology group
>> Apple Computer
>>
>
>
> -- 
> Why bother building more nukes until we use the ones we already have?
> <mime-attachment>
--
Jordan K. Hubbard
Engineering Manager, BSD technology group
Apple Computer


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-libh" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?820539DB-F73D-11D6-9957-000393BB9222>