This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: How to make a portable toolchain?


Bin Zhou wrote:
> 
> Actually, I did not mean that libc.a always requires libdl.a. Sorry for the
> misunderstanding.
> But in my case, my source code references to system functions iconv(), and
> futhermore, iconv() references to dlclose(), dlsym() which is in the library
> libdl. See the following error messages I got if I excluded "-ldl" from the
> link options.

 Yes, I saw this and now understand the problem... But the solution isn't yet
clear :(

 On this list has been some discussion about this, but I don't remember the
Solaris2-FAQ being mentioned yet, so let's see what it says about this:

-------------------------- clip -------------------------------------------
6.24) I have problems linking my application statically.

<snip>

    If you don't care about ABI compliance, i.e., you won't
    ship your program as a product and don't care that you may
    need to recompile after an OS upgrade, here are some of your
    options:

    Link statically against all but libdl:

	cc -Bstatic ....  -Bdynamic -ldl -Bstatic

    Link against dl* stubs (gethostbyXXX, getpwXXX etc won't work any
    longer):

	char *dlopen() { return 0;}
	int dlclose() { return 0;}
	char *dlsym() { return 0;}
	char *dlerror() { return "dynamic linking not loaded";}
-------------------------- clip -------------------------------------------

 The 'stubs'-approach was already mentioned here, but whether the first
'mixed' linking works with GNU ld is unclear. Anyway trying something
like:

  sparc-sun-solaris2.8-gcc -static -o my_exe <my_objs> -lc -Bdynamic -ldl -Bstatic

should tell this...

> Are you saying I could link to libc/libstdc++ statically, while linking to
> libdl dynamically(use libdl.so at running time)? How could I do this? I
> guess Rodney is also concerned about this.

 My Solaris2-FAQ is from late 1999, but an up-to-date one should be found via the
'http://www.sunfreeware.com' or something. Anyway my old one claims in the previous
clip that 'mixed mode' executables should be possible. But they clash with the set
'portability' goal, claims the old FAQ...

 Perhaps it could now be the time to get/update our Solaris2-FAQs.

Cheers, Kai


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]