2

Normally for my OS X builds I have been compiling my applications on an old Mac Book Pro that runs 10.6. This assures that I support this version of OS X.

However for various reasons, the MBP is no longer a long term option so I have been compiling on a more recent device which runs 10.8. However when I do this, my application does not work on 10.6 even with the -mmacosx-version-min=10.6 flag set. The error that happens when I set the flag is "Symbol not found: _wcsdup" in libSystem.B.dynlib

I looked up this error and the only recommendations I can find is to directly link against the 10.6 SDK. However when I tried copying the 10.6 SDK from my MPB to the new machine (because 10.6 SDK is not installed on 10.8), it fails to compile with errors like "error: bits/c++config.h: No such file or directory" I assume this is because of the way I "installed" the SDK, although others have had success with this.

Does anyone have a solution?

latreides
  • 379
  • 1
  • 4
  • 14
  • Do you happen to be compiling with `-std=c++11`? If so this won't work under 10.6 as it does not contain the library file; you need to use `-std=gnu++11` to work on 10.6 to 10.8. – trojanfoe Nov 14 '12 at 08:03
  • Yes as a matter of fact I am, that's interesting, I will have to attempt a compile with that flag instead and see if it is successful. – latreides Nov 14 '12 at 15:09
  • You might need to make some changes to the code if you've used any C++11. Some of it can be replaced with `tr1::` classes, however, but certainly not all. – trojanfoe Nov 14 '12 at 15:12
  • @trojanfoe Unfortunately, double checking reveals that this is one of my apps that I have not compiled with C++11 support, so this is not the cause of my troubles with this particular app. – latreides Nov 15 '12 at 02:38

2 Answers2

0

Run 10.6 in a VM, like VMWare or VirtualBox.

Brian Campbell
  • 322,767
  • 57
  • 360
  • 340
  • This requires having the installation disc or dmg for 10.6 or a recovery partition where one might be stored, I have neither. – latreides Nov 14 '12 at 15:07
  • In addition you cannot (legally) run OS X in a virtual machine unless its the server version, which makes obtaining a legal copy even more difficult. – latreides Nov 15 '12 at 02:41
0

I am able to reinstall older SDKs and compilers with this procedure: How can we restore ppc/ppc64 as well as full 10.4/10.5 SDK support to Xcode 4?

You need to change the path of xcode installs in the script.

Also you probably won't be able to use -std=c++11 when targeting 10.6 since you will mostly also need -stdlib=libc++ which is only available when targeting 10.7 or above.

Apple only distributes libc++ binaries since 10.7. You could build your own libc++ and deploy it with your app to 10.6 machines. But Apple hard coded the compiler to disallow -stdlib=libc++ when targeting anything lower than 10.7.

Community
  • 1
  • 1
Stephen Chu
  • 12,724
  • 1
  • 35
  • 46