Mac OS X linker issue

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
silcreval
Earned a small fee
Earned a small fee
Posts: 12
Joined: Sat Mar 28, 2020 5:41 pm

Mac OS X linker issue

Post 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 :?
silcreval
Earned a small fee
Earned a small fee
Posts: 12
Joined: Sat Mar 28, 2020 5:41 pm

Re: Mac OS X linker issue

Post by silcreval »

Aah - configure missed that it needed a libwebp.a, I've added that manually and they all compile OK now :)
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Mac OS X linker issue

Post 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.
silcreval
Earned a small fee
Earned a small fee
Posts: 12
Joined: Sat Mar 28, 2020 5:41 pm

Re: Mac OS X linker issue

Post 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.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Mac OS X linker issue

Post by ONEEYEMAN »

Hi,
I understood that.
But why does it needed and how did you determined that it is?

Thank you.
silcreval
Earned a small fee
Earned a small fee
Posts: 12
Joined: Sat Mar 28, 2020 5:41 pm

Re: Mac OS X linker issue

Post 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.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Mac OS X linker issue

Post by ONEEYEMAN »

Hi,
What is your exact configure line when building wxWidgets?

Thank you.
silcreval
Earned a small fee
Earned a small fee
Posts: 12
Joined: Sat Mar 28, 2020 5:41 pm

Re: Mac OS X linker issue

Post by silcreval »

../configure --disable-shared
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Mac OS X linker issue

Post 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.
silcreval
Earned a small fee
Earned a small fee
Posts: 12
Joined: Sat Mar 28, 2020 5:41 pm

Re: Mac OS X linker issue

Post by silcreval »

Hi, posted a ticket.

I wasnt able to get the main library to compile with shared enabled.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Mac OS X linker issue

Post by ONEEYEMAN »

Hi,
What is an error you encountered?
I presume you tried:

Code: Select all

../configure --enable-shared && make
Thank you.
silcreval
Earned a small fee
Earned a small fee
Posts: 12
Joined: Sat Mar 28, 2020 5:41 pm

Re: Mac OS X linker issue

Post 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 :)
Post Reply