zlib wx versus external : linker error multiple definitions (Issue #22427)

14 views
Skip to first unread message

MortenMacFly

unread,
May 14, 2022, 12:29:40 AM5/14/22
to wx-...@googlegroups.com, Subscribed

wx build command
mingw32-make -j6 -f makefile.gcc CXXFLAGS="-m32 -std=gnu++14 -D_WIN32_IE=0x0603" BUILD=release SHARED=0 MONOLITHIC=1 UNICODE=1 USE_XRC=1 USE_OPENGL=1

Platform and version information

  • wxWidgets version you use: 3.1.6
  • wxWidgets port you use: wxMSW
  • OS and its version: Windows 10.0.19043.1706
  • Compiler being used: gcc 10.3.0

Description of the problem
When linking (statically) against a third party lib that has zlib v1.2.12 included (like libCURL, for example), you get a "multiple definitions" error for:

crc32_combine_op
crc32_combine_gen
crc32_combine_gen64

This was not the case for v1.2.11 of zlib.

The API between these version (v1.2.11 and v1.2.12) has changed and exactly these methods where moved into public (zlib.h).

I've seen that in:
wxWidgets]\src\zlib\zconf.h
...you do a masking of zlib function by using a specific wx prefix. But to be honest I don't fully understand the macros and comments.
Is it the case that this can easily be fixed by adding some prefix to these new public functions? But where? (This will require a recompilation of wx, obviously.)


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/22427@github.com>

MortenMacFly

unread,
May 14, 2022, 12:45:51 AM5/14/22
to wx-...@googlegroups.com, Subscribed

Some more digging... I believe in:
[wxWidgets]\src\zlib\zconf.h
...this section should be modified from:

#  define crc32                 Z_ADD_PREFIX(crc32)
#  define crc32_combine         Z_ADD_PREFIX(crc32_combine)
#  define crc32_combine64       Z_ADD_PREFIX(crc32_combine64)

...to:

#  define crc32                 Z_ADD_PREFIX(crc32)
#  define crc32_combine         Z_ADD_PREFIX(crc32_combine)
#  define crc32_combine64       Z_ADD_PREFIX(crc32_combine64)
+#  define crc32_combine_op       Z_ADD_PREFIX(crc32_combine_op)

...and additionally this section from:

#  undef adler32_combine
#  define adler32_combine       Z_ADD_PREFIX_STD(adler32_combine)
#  undef crc32_combine
#  define crc32_combine         Z_ADD_PREFIX_STD(crc32_combine)

...to:

#  undef adler32_combine
#  define adler32_combine       Z_ADD_PREFIX_STD(adler32_combine)
#  undef crc32_combine
#  define crc32_combine         Z_ADD_PREFIX_STD(crc32_combine)
+#  undef crc32_combine_op
+#  define crc32_combine_op         Z_ADD_PREFIX_STD(crc32_combine_op)

...and the same for the other 2 methods.

Does that sound correct or am I missing something?


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/22427/1126639476@github.com>

oneeyeman1

unread,
May 14, 2022, 1:17:24 AM5/14/22
to wx-...@googlegroups.com, Subscribed

Hi,
What if yo drop the MONOLITHIC from the build configuration and use WITH_ZLIB=0 instead?

Thank you.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/22427/1126643771@github.com>

Maarten

unread,
May 14, 2022, 2:42:43 AM5/14/22
to wx-...@googlegroups.com, Subscribed

Hi, I think this is the same as #22280 and should have been fixed in master by #22341.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/22427/1126655615@github.com>

VZ

unread,
May 14, 2022, 10:06:19 AM5/14/22
to wx-...@googlegroups.com, Subscribed

Indeed, this should be already fixed in master/will be fixed in 3.1.7.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/22427/1126722709@github.com>

VZ

unread,
May 14, 2022, 10:06:21 AM5/14/22
to wx-...@googlegroups.com, Subscribed

Closed #22427.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issue/22427/issue_event/6610032296@github.com>

MortenMacFly

unread,
May 14, 2022, 3:04:58 PM5/14/22
to wx-...@googlegroups.com, Subscribed

For the record: I tried the GIT version and yes, it fixes this error. Thank you and sorry for not noticing the duplicate.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/22427/1126795860@github.com>

Reply all
Reply to author
Forward
0 new messages