stcorp / coda

The Common Data Access toolset
http://stcorp.github.io/coda/doc/html/index.html
BSD 3-Clause "New" or "Revised" License
39 stars 17 forks source link

Coda 2.21 includes some functions of of libz which leads to name clash #43

Closed WalterZimmer314 closed 4 years ago

WalterZimmer314 commented 4 years ago

We compile coda with the following configure command: ./configure --prefix=$INSTALLPATH --disable-shared --with-hdf4 --with-hdf5 We want to have a static library that we can link to our final binary.

In the final link step we link coda, then hdf4, then hdf5, then libz, and get the following error:

/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: /data/upas2-resources/inst-eval/lib64/libz.a(inflate.o): in function inflateValidate: inflate.c:(.text+0x3468): multiple definition of inflateValidate; /data/upas2-resources/inst-eval/lib64/libcoda.a(libz_internal_la-inflate.o):/data/zimm_wa/projects/dockertest/dockerfile2/upaslibcompile/coda-2.21/libcoda/zlib/inflate.c:109: first defined here /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: /data/upas2-resources/inst-eval/lib64/libz.a(inflate.o): in function inflateCodesUsed: inflate.c:(.text+0x355d): multiple definition of inflateCodesUsed; /data/upas2-resources/inst-eval/lib64/libcoda.a(libz_internal_la-inflate.o):/data/zimm_wa/projects/dockertest/dockerfile2/upaslibcompile/coda-2.21/libcoda/zlib/inflate.c:109: first defined here /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: /data/upas2-resources/inst-eval/lib64/libz.a(adler32.o): in function adler32_z: adler32.c:(.text+0x0): multiple definition of adler32_z; /data/upas2-resources/inst-eval/lib64/libcoda.a(libz_internal_la-adler32.o):/data/zimm_wa/projects/dockertest/dockerfile2/upaslibcompile/coda-2.21/libcoda/zlib/adler32.c:72: first defined here /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: /data/upas2-resources/inst-eval/lib64/libz.a(crc32.o): in function crc32_z: crc32.c:(.text+0xd): multiple definition of crc32_z; /data/upas2-resources/inst-eval/lib64/libcoda.a(libz_internal_la-crc32.o):/data/zimm_wa/projects/dockertest/dockerfile2/upaslibcompile/coda-2.21/libcoda/zlib/crc32.c:207: first defined here

So it seems that some funtions in libz.a are defined in libcoda.a with the same name.

On the other hand, if we don't link against libz, there are some (other) functions missing.

So what can we do? This was never a problem, so it might be new in 2.21. Thanks!

svniemeijer commented 4 years ago

In 2.21 we updated CODA to use more recent version of zlib/expat/pcre. Apparently those included new symbols that we forgot to name mangle. This is fixed in db81be51788288adaeffd243713f93af42ade8e3