[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [kfreebsd-amd64] Problem building glib2.0



> > gcc -fPIC -O2 -Wall -S lib.c -o lib1.s -DFIRST
> > gcc -fPIC -O2 -Wall -S lib.c -o lib2.s
> > gcc -fPIC -O2 -Wall -c lib1.s
> > gcc -fPIC -O2 -Wall -c lib2.s
> > gcc -shared -o liblib.so lib1.o lib2.o
> 
> Sorry I can tell you more, however I have attached the files to the
> mail.

Thanks for them. I didn't find anything strange :-(

I investigated a little bit more, the situation in glib2 
is closer to snippet bellow. 
This one fails also on linux-amd64, but original glib2.0 builds fine.
Why ?

There is difference between final linking of libglib-2.0.so

kfreebsd:
-Wl,-soname -Wl,libglib-2.0.so.0 -Wl,-retain-symbols-file 
-Wl,.libs/libglib-2.0.exp -o .libs/libglib-2.0.so.0.800.6

linux:
-Wl,-soname -Wl,libglib-2.0.so.0 -Wl,-version-script 
-Wl,.libs/libglib-2.0.ver -o .libs/libglib-2.0.so.0.800.6

My guess is that  _g_charset_get_aliases is not in version-script,
it wouldn't be exported and finally can be resolved internally for Linux.

Fix for kfreebsd should be either

-  add prototype also into gutf8.c.
   extern const char **_g_charset_get_aliases (const char *canonical_name) G_GNUC_INTERNAL;
   It should not harm anywhere.


-  use -Wl,-version-script ? 


Petr


> > gcc -fPIC -O2 -Wall -S lib.c -o lib1.s -DFIRST
> > gcc -fPIC -O2 -Wall -S lib.c -o lib2.s
> > gcc -fPIC -O2 -Wall -c lib1.s
> > gcc -fPIC -O2 -Wall -c lib2.s
> > gcc -shared -o liblib.so lib1.o lib2.o


****************************************************

#define NULL 0L
#ifdef FIRST
/* gutf8.c */
const char **_g_charset_get_aliases (const char *canonical_name)
{
return NULL;
}
#else
/* gconvert.c */
extern const char **_g_charset_get_aliases (const char *canonical_name) __attribute__((visibility("hidden")));

const char** fce(int a)
{
if (a)
  return NULL;
return _g_charset_get_aliases (NULL);
}
#endif




Reply to: