Page 1 of 1

Mac OS X linker issue

Posted: Sat Mar 28, 2020 6:53 pm
by silcreval
HI

Having trouble with some samples linking on 3.1.3. I'm using Mac OS X 10.15.2 and the latest Xcode (11.4).

The errors are linker errors in the libwxtiff-3.1 module. Its unable to find various funcs.

Some samples work fine - persumably they dont need libwxtiff.

Any ideas?

Thanks

PS - I pasted the linker log - but it kept flagging as 'spam content' - finally locking me out for too many forum posts :?

Re: Mac OS X linker issue

Posted: Sat Mar 28, 2020 9:04 pm
by silcreval
Aah - configure missed that it needed a libwebp.a, I've added that manually and they all compile OK now :)

Re: Mac OS X linker issue

Posted: Sat Mar 28, 2020 10:08 pm
by ONEEYEMAN
Hi,
Could you post the relevant piece of the configure (about this library)?

You shuoldn't be modifying the makefile in any way...

Thank you.

Re: Mac OS X linker issue

Posted: Sun Mar 29, 2020 1:36 pm
by silcreval
Yes sure,

I added -lwebp to the LIBS section in the generated makefile. It is required, but for some reason isnt generated.

This seems to be missing when you run configure. I'm not familiar with cmake / configure so not sure how that would be changed.

Re: Mac OS X linker issue

Posted: Sun Mar 29, 2020 2:25 pm
by ONEEYEMAN
Hi,
I understood that.
But why does it needed and how did you determined that it is?

Thank you.

Re: Mac OS X linker issue

Posted: Sun Mar 29, 2020 3:59 pm
by silcreval
So on the final link, without this library their are undefined references e.g.

Undefined symbols for architecture x86_64:
"_WebPConfigInitInternal", referenced from:
_TWebPSetupEncode in libwxtiff-3.1.a(wxtiff_tif_webp.o)
"_WebPEncode", referenced from:
_TWebPPostEncode in libwxtiff-3.1.a(wxtiff_tif_webp.o)
"_WebPFreeDecBuffer", referenced from:
_TWebPPreDecode in libwxtiff-3.1.a(wxtiff_tif_webp.o)
_TWebPSetupEncode in libwxtiff-3.1.a(wxtiff_tif_webp.o)
_TWebPCleanup in libwxtiff-3.1.a(wxtiff_tif_webp.o)
"_WebPIAppend", referenced from:
_TWebPDecode in libwxtiff-3.1.a(wxtiff_tif_webp.o)
"_WebPIDecGetRGB", referenced from:
_TWebPDecode in libwxtiff-3.1.a(wxtiff_tif_webp.o)

These functions are all in libwebp.a

Adding the reference fixed the issue. This is Macos X 10.15.2 (Catalina) with the latest XCode.

Re: Mac OS X linker issue

Posted: Sun Mar 29, 2020 5:09 pm
by ONEEYEMAN
Hi,
What is your exact configure line when building wxWidgets?

Thank you.

Re: Mac OS X linker issue

Posted: Sun Mar 29, 2020 5:26 pm
by silcreval
../configure --disable-shared

Re: Mac OS X linker issue

Posted: Sun Mar 29, 2020 5:38 pm
by ONEEYEMAN
Hi,
You might open a ticket at trac.wxwidgets.org with the information from this thread.

Also - I would be curious if the dynamic linking has this same issue. Could you please try it?

Thank you.

Re: Mac OS X linker issue

Posted: Sun Mar 29, 2020 5:47 pm
by silcreval
Hi, posted a ticket.

I wasnt able to get the main library to compile with shared enabled.

Re: Mac OS X linker issue

Posted: Sun Mar 29, 2020 5:50 pm
by ONEEYEMAN
Hi,
What is an error you encountered?
I presume you tried:

Code: Select all

../configure --enable-shared && make
Thank you.

Re: Mac OS X linker issue

Posted: Sun Mar 29, 2020 11:21 pm
by silcreval
It looks like it was a bad install :/ - I reinstalled XCode, and ran brew update, and there were a few issues. All cleaned, and re-installed, and ran configure in both shared and static, and all works as expected :)