windows port: Help on linker problem needed

Christian Stimming stimming at tuhh.de
Mon Mar 13 09:08:10 EST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

gnucash is "almost ready" for a windows port. All necessary library
requirements on windows/mingw32 exist in some form or another, so
compiling gnucash is really feasible.

However, I encountered a weird linker problem where I don't have any
further ideas right now. On windows, a linker command "gcc -shared ..."
creates two files: One libfoo-0.dll which is the actual DLL/shared
library, and one libfoo.dll.a which is the list of exported symbols in
that DLL. If a symbol is exported correctly, it has to show up in both,
and when linking to libfoo, the symbol list of libfoo.dll.a is used by
the gcc linker.

Some libraries in gnucash, most notably src/core-utils/libcore-utils.la,
are built totally correctly. After libcore-utils-0.dll and
libcore-utils.dll.a are created, I can check by "nm" whether the
to-be-exported symbols are all correctly exported in
libcore-utils.dll.a. However, other libraries in gnucash do *not* export
their symbols correctly, most notably src/gnc-module/libgncmodule.la.
(This prevents me from building gnucash completely, so I need to fix
this before I can proceed.) Although the object file from
src/gnc-module/gnc-module.c correctly lists the relevant symbols as
exported ones, the final libgncmodule.dll.a doesn't list this anymore.

I've tried a lot of comparisons between libcore-utils.dll.a and
libgncmodule.dll.a in order to find the difference that's causing the
symbols not to be exported, but I still don't see an error. (The linker
commands are really exactly identical, except for libgncmodule.la
linking to ltdl, the libtool-dl library, but even that doesn't change a
thing, see below.) Maybe someone has an idea? Eventually I tried to link
the object file of gnc-module.c into libcore-utils.dll.a, and funny
enough, as soon as I did this, libcore-utils.dll.a didn't export its
symbols as well. Maybe this is a hint to someone?

The problem seems to get introduced by linking to gnc-module.o into a
library, so the full symbol table of gnc-module.o is printed at the
bottom of this message. That symbol table has some symbols marked by "C"
- -- is this a problem?

I'm open to any suggestions :-)

Christian


This is what I did, all in src/core-utils/ as working directory:

## Simplified linker command for libcore-utils:
$ gcc -shared .libs/gnc-main.o .libs/gnc-gconf-utils.o
.libs/gnc-gdate-utils.o .libs/gnc-gkeyfile-utils.o
.libs/gnc-gobject-utils.o -Lc:/GTK2-8-10/lib -lgconf-2 -lgobject-2.0
- -lglib-2.0 -Lc:/msys/1.0/lib -lltdl -mms-bitfields -o
.libs/libcore-utils-0.dll -Wl,--image-base=0x10000000
- -Wl,--out-implib,.libs/libcore-utils.dll.a
Creating library file: .libs/libcore-utils.dll.a

## Check the number of exported symbols:
$ nm .libs/libcore-utils.dll.a |grep ' T ' | wc
     59     177    2215
## Correctly exported many symbols.

## Now, as a test, add the gnc-module.o object file here:
$ gcc -shared .libs/gnc-main.o .libs/gnc-gconf-utils.o
.libs/gnc-gdate-utils.o .libs/gnc-gkeyfile-utils.o
.libs/gnc-gobject-utils.o ../gnc-module/.libs/gnc-module.o
- -Lc:/GTK2-8-10/lib -lgconf-2 -lgobject-2.0 -lglib-2.0 -Lc:/msys/1.0/lib
- -lltdl -mms-bitfields -o .libs/libcore-utils-0.dll
- -Wl,--image-base=0x10000000 -Wl,--out-implib,.libs/libcore-utils.dll.a
Creating library file: .libs/libcore-utils.dll.a

## Check the number of exported symbols:
$ nm .libs/libcore-utils.dll.a |grep ' T ' | wc
      0       0       0
## Oops, none available anymore!

## Symbol table of the object file in question:
$ nm ../gnc-module/.libs/gnc-module.o
00000000 b .bss
00000000 d .data
00000000 i .drectve
00000000 r .rdata
00000000 t .text
         U _closedir
         U _g_direct_equal
         U _g_direct_hash
         U _g_free
         U _g_hash_table_foreach
         U _g_hash_table_insert
         U _g_hash_table_lookup
         U _g_hash_table_new
         U _g_hash_table_remove
         U _g_list_append
         U _g_list_free
         U _g_list_prepend
         U _g_log
         U _g_malloc0
         U _g_setenv_utf8
         U _g_strdup
         U _g_strdup_printf
0000016d t _g_string_append_c_inline
         U _g_string_free
         U _g_string_insert_c
         U _g_string_new
         U _getenv
0000077f t _gnc_module_check_loaded
0000048f t _gnc_module_get_info
00000af7 T _gnc_module_load
00000841 t _gnc_module_load_common
00000b19 T _gnc_module_load_optional
00000663 t _gnc_module_locate
000002c7 T _gnc_module_system_init
00000474 T _gnc_module_system_modinfo
00000322 T _gnc_module_system_refresh
00000000 t _gnc_module_system_search_dirs
000001d4 t _gnc_module_system_setup_load_path
00000b3b T _gnc_module_unload
00000756 t _list_loaded
00000000 b _loaded_modules
         U _lt_dlerror
00000010 C _lt_dlfree
         U _lt_dlinit
00000010 C _lt_dlmalloc
         U _lt_dlopen
00000010 C _lt_dlrealloc
         U _lt_dlsym
00000010 b _module_info
         U _opendir
         U _printf
         U _readdir
         U _strcmp
         U _strlen
         U _strncmp

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBRBV8ymXAi+BfhivFAQJU2wP8CFa/jexjW3RuJqiUlBWLulqs0O4ft+sB
G/js9DYfhtchvCytOeVIpDGLVmdmxlN31Y9SzFCW/J9Zb139/PGegBYcoGoLJO49
rqJHrxnVKeIvS/CHsK2z0b+mSNRKER4DSDroSWh48SVCcLJsS648CY9RV0HAasUW
6LSbg6MzVG8=
=Q+gh
-----END PGP SIGNATURE-----


More information about the gnucash-devel mailing list