wxWidgets build on OSX Catalina

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
Нех
In need of some credit
In need of some credit
Posts: 4
Joined: Tue Dec 17, 2019 9:42 pm

wxWidgets build on OSX Catalina

Post by Нех » Tue Dec 17, 2019 9:57 pm

Hi.
Does anybody have a positive experience in building the library on OSX Catalina?
What I've done at the moment.
I've managed to configure build. Here is the command I finally used:

Code: Select all

../configure --enable-debug --with-macosx-sdk=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk --with-macosx-version-min=10.14 CC=clang CXX=clang
I substituted CC and CCX options to fix the compatibility with MacOS sdk and C compiler (looks like GCC is no longer compatible with mac os sdk)

Before that I had to create a symbolic link to standard .h files directory

Code: Select all

sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/* /usr/local/include/
to get rid of configure: error: no. CoreFoundation not available.

after that configure command completed successfully

then I run

Code: Select all

make
command. its last execution words are:

Code: Select all

ar rc /Users/heximal/Downloads/far2l/wxWidgets-3.1.3/build-cocoa-debug/lib/libwxregexu-3.1.a wxregex_regcomp.o wxregex_regexec.o wxregex_regerror.o wxregex_regfree.o
/opt/local/bin/ranlib: object: /Users/heximal/Downloads/far2l/wxWidgets-3.1.3/build-cocoa-debug/lib/libwxregexu-3.1.a(wxregex_regcomp.o) malformed object (unknown load command 1)
ar: internal ranlib command failed
make: *** [/Users/heximal/Downloads/far2l/wxWidgets-3.1.3/build-cocoa-debug/lib/libwxregexu-3.1.a] Error 1
I suspect it's because of I'm using clang instead of GCC?

Can anyone help me? Unfortunately I'm not so much sophisticated in this build stuff ):

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4421
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxWidgets build on OSX Catalina

Post by ONEEYEMAN » Wed Dec 18, 2019 4:03 pm

Hi,
Нех wrote:
Tue Dec 17, 2019 9:57 pm
Hi.
Does anybody have a positive experience in building the library on OSX Catalina?
What I've done at the moment.
I've managed to configure build. Here is the command I finally used:

Code: Select all

../configure --enable-debug --with-macosx-sdk=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk --with-macosx-version-min=10.14 CC=clang CXX=clang
I substituted CC and CCX options to fix the compatibility with MacOS sdk and C compiler (looks like GCC is no longer compatible with mac os sdk)
First of all, the CC and CXX substitution is not really necessary - I believe OSX provide clang by default starting with 10.9.\
Second - "--with-macosx-sdk" is not really necessary either, unless you install Xcode and command line tools in some weird location. But even then this option is not really needed.
Нех wrote:
Tue Dec 17, 2019 9:57 pm
Before that I had to create a symbolic link to standard .h files directory

Code: Select all

sudo ln -s /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/* /usr/local/include
/
This should not be necessary either. Why did you needed to do that? What problem were you trying to fix?
Нех wrote:
Tue Dec 17, 2019 9:57 pm
to get rid of configure: error: no. CoreFoundation not available.

after that configure command completed successfully

then I run

Code: Select all

make
command. its last execution words are:

Code: Select all

ar rc /Users/heximal/Downloads/far2l/wxWidgets-3.1.3/build-cocoa-debug/lib/libwxregexu-3.1.a wxregex_regcomp.o wxregex_regexec.o wxregex_regerror.o wxregex_regfree.o
/opt/local/bin/ranlib: object: /Users/heximal/Downloads/far2l/wxWidgets-3.1.3/build-cocoa-debug/lib/libwxregexu-3.1.a(wxregex_regcomp.o) malformed object (unknown load command 1)
ar: internal ranlib command failed
make: *** [/Users/heximal/Downloads/far2l/wxWidgets-3.1.3/build-cocoa-debug/lib/libwxregexu-3.1.a] Error 1
I suspect it's because of I'm using clang instead of GCC?

Can anyone help me? Unfortunately I'm not so much sophisticated in this build stuff ):
I would uninstall Xcode completely, including "Command Line Tools", get rid of all links you created and start over.
Or even better - reinstall the OS to start a fresh.

Then install Xcode, "Command Line Tools", get wxWidgets and do the following:

Code: Select all

cd wxWidgets
mkdir build OSX
cd buildOSX
../configure --enable-debug --with-macosx-version-min=10.14
make
cd samples/minimal
make
open minimal.app
This should compile and produce the library out the box and the build and run minimal sample.

Keep in mind that you need to install Xcode and "Command Line Tools" with the default options.

Thank you.

Нех
In need of some credit
In need of some credit
Posts: 4
Joined: Tue Dec 17, 2019 9:42 pm

Re: wxWidgets build on OSX Catalina

Post by Нех » Wed Dec 18, 2019 9:26 pm

hi ONEEYEMAN, thank you for the response.
Reinstall the OS is absolutely not an option, it's too extreme for me :) and why? just to compile one library :)
I installed Catalina two days ago, also I installed Xcode13 with command line tools.

Ok, let me try again from the beginning.
I deleted all symlinks, unzipped latest wxWidgets-3.1.3.tar.bz2.
Now I'm following the instructions from install.md.

Code: Select all

mkdir build-cocoa-debug
cd build-cocoa-debug
../configure --enable-debug
This produces following output:

Code: Select all

../configure --enable-debug
checking build system type... x86_64-apple-darwin19.2.0
checking host system type... x86_64-apple-darwin19.2.0
checking for toolkit... osx_cocoa
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... configure: error: in `/Users/heximal/Downloads/far2l/wxWidgets-3.1.3/build-cocoa-debug':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
After long googling this error I came to the solution with all configure arguments and symlinks.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4421
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxWidgets build on OSX Catalina

Post by ONEEYEMAN » Wed Dec 18, 2019 9:56 pm

Hi,
Are you using Xcode 10?
Did you see this?

Нех
In need of some credit
In need of some credit
Posts: 4
Joined: Tue Dec 17, 2019 9:42 pm

Re: wxWidgets build on OSX Catalina

Post by Нех » Wed Dec 18, 2019 10:29 pm

ONEEYEMAN wrote:
Wed Dec 18, 2019 9:56 pm
Hi,
Are you using Xcode 10?
No, I already use Xcode 11.3
ONEEYEMAN wrote:
Wed Dec 18, 2019 9:56 pm
Hi,Did you see this?
yes, I did apply the answer from SO

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4421
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxWidgets build on OSX Catalina

Post by ONEEYEMAN » Wed Dec 18, 2019 10:33 pm

Hi,
Did you try to set upo minimal OSX version to 10.14?

Thank you.

Нех
In need of some credit
In need of some credit
Posts: 4
Joined: Tue Dec 17, 2019 9:42 pm

Re: wxWidgets build on OSX Catalina

Post by Нех » Thu Dec 19, 2019 9:16 am

hey!
yes, I did try this option --with-macosx-version-min=10.14
the result is the same at the moment.
here is a piece of config.log

Code: Select all

configure:13085: gcc -o conftest    conftest.c  >&5
conftest.c:11:19: fatal error: stdio.h: No such file or directory
 #include <stdio.h>
                   ^
compilation terminated.
configure:13089: $? = 1
configure:13096: ./conftest
../configure: line 13098: ./conftest: No such file or directory
configure:13100: $? = 127
configure:13107: error: in `/Users/heximal/Downloads/far2l/wxWidgets-3.1.3/build-cocoa-debug':
configure:13109: error: cannot run C compiled programs.
Last time at that point I googled the solution with symlinks

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4421
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxWidgets build on OSX Catalina

Post by ONEEYEMAN » Thu Dec 19, 2019 3:40 pm

Hi,
This is weird.
I'd suggest to send an E-mail to wx-users ML, as it will hit broader audience, including wx core developers.

Thank you.

Post Reply