StrawberryPerl / build-extlibs

16 stars 11 forks source link

netcdf 4.9.0 test failures with gcc 11.3 #42

Closed shawnlaffan closed 1 year ago

shawnlaffan commented 1 year ago

Need to check if this manifests with other gcc compiler versions.

netcdf is also now at version 4.9.2 and MSYS2 are applying some additional build options. https://github.com/msys2/MINGW-packages/commit/8d0bb1753bb2b303ce02a299f06c0735ffb5a5ce

Making check in unit_test
make[1]: Entering directory '/z/extlib/_bprogressive__.src/netcdf-c-4.9.0/unit_test'
make  tst_nclist.exe test_ncuri.exe test_pathcvt.exe tst_exhash.exe tst_xcache.exe tst_nc4internal.exe
make[2]: Entering directory '/z/extlib/_bprogressive__.src/netcdf-c-4.9.0/unit_test'
depbase=`echo tst_nclist.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I..  -I../include -I../include   -I/z/extlib/_bprogressive__/include  -fno-s
trict-aliasing -MT tst_nclist.o -MD -MP -MF $depbase.Tpo -c -o tst_nclist.o tst_nclist.c &&\
mv -f $depbase.Tpo $depbase.Po
/bin/sh ../libtool  --tag=CC   --mode=link x86_64-w64-mingw32-gcc  -fno-strict-aliasing   -L/z/extlib/_bprogressive__/li
b -o tst_nclist.exe tst_nclist.o ../liblib/libnetcdf.la -ljpeg -lmfhdf -lhdf -ljpeg -lhdf5_hl -lhdf5 -lm -lzlib -ldl -ls
z -lbz2 -lxml2
libtool: link: x86_64-w64-mingw32-gcc -fno-strict-aliasing -o .libs/tst_nclist.exe tst_nclist.o  -L/z/extlib/_bprogressi
ve__/lib ../liblib/.libs/libnetcdf.dll.a -lmfhdf -lhdf -ljpeg -lhdf5_hl -lhdf5 -lzlib -ldl /z/extlib/_bprogressive__/lib
/libsz.dll.a -lbz2 -lxml2 -L/z/extlib/_bprogressive__/lib
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x146): undefined reference to `count_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x1c1): undefined reference to `free_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x1d0): undefined reference to `find_in_NCList_by_name'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x256): undefined reference to `iterate_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x353): undefined reference to `new_NC'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x3d8): undefined reference to `find_in_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x45b): undefined reference to `add_to_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x465): undefined reference to `find_in_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x4eb): undefined reference to `find_in_NCList_by_name'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x573): undefined reference to `iterate_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x5fb): undefined reference to `find_in_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x689): undefined reference to `find_in_NCList_by_name'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x719): undefined reference to `iterate_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x799): undefined reference to `count_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x815): undefined reference to `free_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x82a): undefined reference to `del_from_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x836): undefined reference to `free_NC'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x840): undefined reference to `find_in_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x93e): undefined reference to `new_NC'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x9c5): undefined reference to `add_to_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0x9d2): undefined reference to `find_in_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0xa69): undefined reference to `move_in_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0xae9): undefined reference to `find_in_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0xb75): undefined reference to `del_from_NCList'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0xb81): undefined reference to `free_NC'
z:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: tst_nclist.o:tst_nclist.c
:(.text+0xb8b): undefined reference to `find_in_NCList'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [Makefile:768: tst_nclist.exe] Error 1
make[2]: Leaving directory '/z/extlib/_bprogressive__.src/netcdf-c-4.9.0/unit_test'
make[1]: *** [Makefile:1120: check-am] Error 2
make[1]: Leaving directory '/z/extlib/_bprogressive__.src/netcdf-c-4.9.0/unit_test'
make: *** [Makefile:764: check-recursive] Error 1
shawnlaffan commented 1 year ago

Update: Affects gcc 11, 12 and 13.

sisyphus commented 1 year ago

Just some random thoughts - no need to respond. It looks that libnetcdf.dll.a is supposed to resolve those references.

However, I would have expected the references it defines to be prefixed with _imp\. Are they ? (Don't be afraid to just open the file libnetcdf.dll.a in notepad and do a text search for those undefined referencesymbols..) Those undefined references suggest static symbols to me. Is there a static lib (libnetcdf.a) that you can link to instead ?

The libnetcdf.a that shipped with Strawberry-5.32.1 contained both decorated and undecorated symbols - eg. both free_NCList and __imp_free_NCList.

Cheers, Rob

shawnlaffan commented 1 year ago

The list is below, extracted using the strings utility.

So it would seem several symbols are not defined.

&8libnetcdf_19___dll_iname
_head_libnetcdf_19___dll
getmountpoint
__imp_getmountpoint
NCJunparse
__imp_NCJunparse
NCJreclaim
__imp_NCJreclaim
NCJparsen
__imp_NCJparsen
NCJparse
__imp_NCJparse
NCJnewstringn
__imp_NCJnewstringn
NCJnewstring
__imp_NCJnewstring
NCJnew
__imp_NCJnew
NCJinsert
__imp_NCJinsert
NCJdump
__imp_NCJdump
NCJdictget
__imp_NCJdictget
NCJcvt
__imp_NCJcvt
NCJclone
__imp_NCJclone
NCJappend
__imp_NCJappend
NCJaddstring
__imp_NCJaddstring
shawnlaffan commented 1 year ago

The CI runs for netcdf had the answer.

https://github.com/Unidata/netcdf-c/blob/b30b4e87cff202ab3c6511ade05a58019fc79796/.github/workflows/run_tests_win_mingw.yml#L50-L53

Adding -Wl,--export-all-symbols to LDFLAGS gets all tests to pass.

PR coming soon.