OSX linking error, architecture-related?

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.
askg
In need of some credit
In need of some credit
Posts: 4
Joined: Sat Mar 24, 2018 12:56 pm

OSX linking error, architecture-related?

Post by askg »

I have tried various ways to configure and build wxWidgets-3.0.3 in OS X High Sierra, version 10.13.3. On the latest effort:

./configure CC="gcc -arch x86_64" CXX="g++ -arch x86_64" CPP="gcc -E" CXXCPP="g++ -E" --prefix=/usr/local/wxWidgets --with-osx_cocoa --with-macosx-version-min=10.9 --disable-mediactrl

and then make

I get the following error from ld

ld: can't write output file: /Users/askg/Documents/Paket_skivor/wxWidgets-3.0.3/lib/libwx_osx_cocoau_ribbon-3.0.0.3.0.dylib for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/askg/Documents/Paket_skivor/wxWidgets-3.0.3/lib/libwx_osx_cocoau_ribbon-3.0.0.3.0.dylib] Error 1
make: *** Waiting for unfinished jobs....

I would be glad if someone could give me a hint on how to build wxWidgets in this environment. I am new to this Forum, hope this is the place to ask.
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France

Re: OSX linking error, architecture-related?

Post by eranon »

Hello,

And did you use -v to see detailed invocation? Does it fails to link or write on disk: this is the question.
Also, you could try to add --enable-macosx_arch=x86_64
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7481
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: OSX linking error, architecture-related?

Post by ONEEYEMAN »

Hi,
Are you trying to build inside Xcode or using the Terminal?

Thank you.
askg
In need of some credit
In need of some credit
Posts: 4
Joined: Sat Mar 24, 2018 12:56 pm

Re: OSX linking error, architecture-related?

Post by askg »

Thanks for input, and follow-up questions!
I have tried building in Terminal only (the ordinary untar-configure-make chain) and did not use -v to show the invocations. That I will do now, and also test the suggested architecture flag.
/GA
askg
In need of some credit
In need of some credit
Posts: 4
Joined: Sat Mar 24, 2018 12:56 pm

Re: OSX linking error, architecture-related?

Post by askg »

askg wrote:Thanks for input, and follow-up questions!
I have tried building in Terminal only (the ordinary untar-configure-make chain) and did not use -v to show the invocations. That I will do now, and also test the suggested architecture flag.
/GA
The result, after trying to configure, and build, for both architectures is still negative, although the ld error now is preceded by a compilation error.

Configure thus:
./configure -v --prefix=/usr/local/wxWidgets --with-osx_cocoa --with-macosx-version-min=10.9 --disable-mediactrl --enable-universal-binary=i386 --enable-macosx_arch=x86_64

Error output:
-I./.pch/wxprec_basedll -D__WXOSX_COCOA__ -DWXBUILDING -I/Users/askg/Documents/Paket_skivor/wxWidgets-3.0.3/src/tiff/libtiff -I./src/tiff/libtiff -I./src/jpeg -I./src/png -I./src/regex -DwxUSE_GUI=0 -DWXMAKINGDLL_BASE -DwxUSE_BASE=1 -dynamic -fPIC -DPIC -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wno-deprecated-declarations -D_FILE_OFFSET_BITS=64 -I/Users/askg/Documents/Paket_skivor/wxWidgets-3.0.3/lib/wx/include/osx_cocoa-unicode-3.0 -I./include -DWX_PRECOMP -O2 -fno-strict-aliasing -arch i386 -fno-common -fvisibility=hidden -fvisibility-inlines-hidden ./src/common/filtall.cpp
./src/common/filefn.cpp:914:5: error: use of undeclared identifier 'verify_noerr'
verify_noerr( err );
^
1 error generated.
make: *** [basedll_filefn.o] Error 1

I hope, by the way, that this was the proper use of invocation flag -v. If not please inform me how to use it.
Rgds /GA
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France

Re: OSX linking error, architecture-related?

Post by eranon »

For me, there's an initial problem here: you request an universal binary with one arch only (i386) and the arch you indicate beside (x86_64) is not the same. If it's universal, it's at least two architectures inside, and your other build options should match. So, here it should be "--enable-universal-binary=i386,x86_64" which should be the same than indicating "-arch i386 -arch x86_64" for the different *FLAGS (C, CPP, CXX, LD); and, in this case, I guess (not verified) you don't need "--enable-macosx-arch" anymore.

This said, not sure it will change something about your specific error... Searching quickly I found this about building of wxWidgets 3.0.3 in macOS 10.13 High Sierra: https://github.com/cjcliffe/CubicSDR/issues/603.

Where we can read:
righthalfplane commented on Feb 2

I was able to compile wxWidgets 3.0.3 on High Sierra by first defining a cpp flag -

CPPFLAGS=-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1

and then

./configure --prefix=/usr/local/wxWidgets --with-macosx-version-min=10.9

This built what I needed
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]
askg
In need of some credit
In need of some credit
Posts: 4
Joined: Sat Mar 24, 2018 12:56 pm

Re: OSX linking error, architecture-related?

Post by askg »

eranon wrote:For me, there's an initial problem here: you request an universal binary with one arch only (i386) and the arch you indicate beside (x86_64) is not the same. If it's universal, it's at least two architectures inside, and your other build options should match. So, here it should be "--enable-universal-binary=i386,x86_64" which should be the same than indicating "-arch i386 -arch x86_64" for the different *FLAGS (C, CPP, CXX, LD); and, in this case, I guess (not verified) you don't need "--enable-macosx-arch" anymore.

This said, not sure it will change something about your specific error... Searching quickly I found this about building of wxWidgets 3.0.3 in macOS 10.13 High Sierra: https://github.com/cjcliffe/CubicSDR/issues/603.

Where we can read:
righthalfplane commented on Feb 2

I was able to compile wxWidgets 3.0.3 on High Sierra by first defining a cpp flag -

CPPFLAGS=-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1

and then

./configure --prefix=/usr/local/wxWidgets --with-macosx-version-min=10.9

This built what I needed
Thanks a lot for your assistance! Finally I got wxWidgets to install successfully.

The solution is thus twofold:
1. Define an environment variable
CPPFLAGS=-D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1


2. Compile for both architectures
stiegl:wxWidgets-3.0.3 askg$ ./configure -v --prefix=/usr/local/wxWidgets --with-macosx-version-min=10.9 --disable-mediactrl --enable-universal-binary=i386,x86_64

After "sudo make install" the shell reports

--------------------------------------------------------
The installation of wxWidgets is finished. [...]
--------------------------------------------------------

One final question then: Is there some simple test procedure to run that shows the successful operation of wxWidgets? Some kind of "Hello world!" in this graphical environment.

I also want to add that the reason I wanted this build to succeed was that I am building Erlang language environment and want it to be complete in the sense that also wxWidgets is accessible through the Erlang/OTP libraries.

Rgds /GA
User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France

Re: OSX linking error, architecture-related?

Post by eranon »

To test your wxWidgets is ready, you can simply issue this command:

Code: Select all

wx-config --version
If you used a custom prefix, you have to be in the concerned directory and do:

Code: Select all

./wx-config --version
or indicate the full path upstream:

Code: Select all

/Users/eln/Dev/devlibs/wxWidgets-3.1.0/static_release_clang_x64/wx-config --version
If wxWidgets is up and running, it will display its version. And, of course, afterward, you can build the samples (at least the one called "minimal").
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]