fatal error with trunk built on OS X

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 423
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

fatal error with trunk built on OS X

Post by raananb » Fri Jul 24, 2015 5:05 pm

Today's trunk, built correctly for Cocoa wxOSX/on OS X Yosemite using DialogBlocks. Other builds with DialogBlocks were always error-free and applications compiled with no problems.

But compiling my application produces an error message:

/wxWidgets/include/wx/strvararg.h:27:18 fatal error: 'tr1/type_traits' file not found. this was invoked from string.h:37

Evidently there is an incorrect #define, but where and which #defines are needed for OSX?

Same problem with 3.0.2.

No problems with MSW or GTK.

raananb
Super wx Problem Solver
Super wx Problem Solver
Posts: 423
Joined: Fri Oct 27, 2006 4:35 pm
Location: Paris, France
Contact:

Re: fatal error with trunk built on OS X

Post by raananb » Sat Jul 25, 2015 11:31 am

The problem went away with

#undef HAVE_TYPE_TRAITS
#undef HAVE_TR1_TYPE_TRAITS

before #if defined(HAVE_TYPE_TRAITS)

However, since I have no idea what undefining these value implies, care must be taken...

stegemma
Earned a small fee
Earned a small fee
Posts: 16
Joined: Mon May 11, 2009 3:15 pm
Contact:

Re: fatal error with trunk built on OS X

Post by stegemma » Mon Aug 24, 2015 10:43 am

I've the same error on Mac OS X Yosemite, with the "stable" 3.0.2 but I can't find the options HAVE_TYPE_TRAITS in setup.h.

It's various days that I try to use wxWidgets 3.0.2 on Mac OS X Yosemite and it is really a pain: the library itself compiles without errors but when you try to create your own library or application, nothing works. I've try xCode, CodeLite and Eclipse. I've compiled the library with xCode (it works, but a little patch of WebKit) and compiles minimal but my code that compile and links well on Windows doesn't compile on Mac OS X, nor with xCode or eclipse.

Tested finally on eclipse, compiled the library from console: ok, it compile but still my library in eclipse doesn't, with the reported error:

Code: Select all

Description	Resource	Path	Location	Type
fatal error: 'tr1/type_traits' file not found	lwxBase		line 30, external location: /Users/stefano/Development/wxWidgets/include/wx/strvararg.h	C/C++ Problem
This is the exploded command (i use wx-config in g++ parameters in eclipse):

Code: Select all

g++ -I..//Users/stefano/Development/wxWidgets/include/ -O3 -Wall -c -fmessage-length=0 `/Users/stefano/Development/wxWidgets/build-release/wx-config --cxxflags` -MMD -MP -MF"lwxBase/clsMDIChildFrame.d" -MT"lwxBase/clsMDIChildFrame.d" -o "lwxBase/clsMDIChildFrame.o" "/Users/stefano/Documents/A/LIGS/LWX/lwxLibraries/lwxBase/clsMDIChildFrame.cpp"
Here's what wx-config reports from console, in my build-release folder:

Code: Select all

MAC:build-release stefano$ ./wx-config --cxxflags
-I/Users/stefano/Development/wxWidgets/build-release/lib/wx/include/osx_cocoa-unicode-static-3.0 -I/Users/stefano/Development/wxWidgets/include -D_FILE_OFFSET_BITS=64 -DwxDEBUG_LEVEL=0 -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__ 
Maybe my configure options are wrong? Here's it:

Code: Select all

../configure --with-osx_cocoa --with-macosx-version-min=10.7 --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk --prefix="$(pwd)" --with-opengl --disable-debug --disable-shared --enable-unicode --with-libjpeg=builtin --with-libpng=builtin --with-regex=builtin --with-libtiff=builtin --with-zlib=builtin --with-expat=builtin
Note the "MacOSX10.10.sdk" stuff, there is not .7 SDK in my xCode version (6.4).

A tutorial on how to setup your own project to compile and link properly with the library would be very useful.

I use:

OS X Yosemite 10.10.5
iMac 21.5" end 2010
Intel Core i3 3.06 GHz

Eclipse CDT Mars
xCode Version 6.4 (6E35b)
wxWidgets 3.0.2 (stable release from .tar.bz2)

stegemma
Earned a small fee
Earned a small fee
Posts: 16
Joined: Mon May 11, 2009 3:15 pm
Contact:

Re: fatal error with trunk built on OS X [SOLVED]

Post by stegemma » Mon Aug 24, 2015 1:57 pm

Because the library compiles fine, I've checked the command line parameters of the wxWidgets library build between my sources build. To make it works, I should have to add this command-line parameters:

Code: Select all

-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -mmacosx-version-min=10.7
In eclipse: project properties -> GCC C++ compiler -> Miscellaneous -> Other flags

The full SDK path should be replaced with a variable but I'm enough happy this way! :)

BeerSmith
Earned a small fee
Earned a small fee
Posts: 24
Joined: Mon Mar 07, 2011 8:39 pm

Re: fatal error with trunk built on OS X

Post by BeerSmith » Tue Oct 13, 2015 3:26 pm

I ran into this problem building on El-Capitan.

The root cause of the issue is using a mix of libc++ and libstdc++. The new version is libc++ which is used when you compile with 10.9 or higher. You can explicitly specify libc++ when configuring wxwidgets by using the following when configuring.

Code: Select all

CXXFLAGS="-stdlib=libc++ -std=c++11" OBJCXXFLAGS="-stdlib=libc++ -std=c++11" LDFLAGS="-stdlib=libc++"
However as I found out this may not solve your entire problem. You also need to set the min version within XCode on all of your products and libraries to be 10.9 or higher and set the CFLAGS for those compiles to use the new library. If you have the min version set to something below 10.9 it will compile with the earlier lib and give errors.

Brad
BeerSmith.com

Post Reply