Commit 8abd2dfd1193b6004fa80698da7a22f4200506c6

Authored by Jürgen Knödlseder
1 parent 07659949

Export MACOSX_DEPLOYMENT_TARGET only if --enable-universalsdk option is selected.

The export of MACOSX_DEPLOYMENT_TARGET led to some problems when trying to compile GammaLib on Mac OS X using the MacPorts gcc 4.4 compiler. The problems were uncatched exceptions that occured in some of the unit tests. After some debugging I discovered (by chance) that commenting the export of MACOSX_DEPLOYMENT_TARGET solved the problem.

Going into the Apple documentation (http://developer.apple.com/library/mac/#technotes/tn2064/_index.html) it appears that weak linking could be the root cause of the problems. With the current configuration on the Mac OS X 10.6 system on which the tests were done, MACOSX_DEPLOYMENT_TARGET=10.4. Following Apple's documentation, weak linking is implement from Mac OS X 10.2 on. Not specifying MACOSX_DEPLOYMENT_TARGET will automatically set the version to 10.1, hence no weak linking will be used.

Although I'm not 100% sure that weak linking indeed was the issue, removing the export of MACOSX_DEPLOYMENT_TARGET also removed the problems. I thus moved the export of MACOSX_DEPLOYMENT_TARGET into the --enable-universalsdk block, i.e. the export will only be done of the --enable-universalsdk option is selected. It remains to be seen whether this is the wanted behaviour.
ChangeLog
1   -2012-09-16 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
  1 +2012-09-17 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
2 2  
3 3 * Bug fix version 0.6.2 released
4 4 ================================
... ... @@ -6,6 +6,7 @@
6 6 clang++ compiler precedence is only taken for Mac OS X >= 10.7
7 7 Omit Python checks if Python bindings are disabled
8 8 Enhance OpenMP configuration on Darwin
  9 + Export MACOSX_DEPLOYMENT_TARGET only for --enable-universalsdk
9 10  
10 11 2012-09-15 Juergen Knoedlseder <jurgen.knodlseder@irap.omp.eu>
11 12  
... ...
... ... @@ -2,7 +2,7 @@ New Features and Important Changes in GammaLib 00-06-02
2 2  
3 3 Author(s) : Juergen Knoedlseder
4 4  
5   -September, 16th, 2012
  5 +September, 17th, 2012
6 6  
7 7  
8 8 1. Introduction
... ... @@ -32,6 +32,13 @@ the appropriate code when needed.
32 32 Furthermore, the OPENMP_LIB_LDFLAGS is not set to -lgomp on Darwin
33 33 anymore as this appears not to be needed.
34 34  
  35 +The MACOSX_DEPLOYMENT_TARGET environment variable is now only exported
  36 +when the --enable-universalsdk option is specified. This solved problems
  37 +related to uncatched exceptions in unit tests. Possibly, these uncatched
  38 +exceptions were due to weak linking, a feature that exists since Mac OS
  39 +X version 10.2. By not exporting MACOSX_DEPLOYMENT_TARGET, Mac OS X
  40 +version 10.1 is assumed.
  41 +
35 42  
36 43 3. Application module
37 44 ---------------------
... ...
1 1 GammaLib information
2 2 ====================
3   -Version: 00-06-02 (September 16th, 2012)
  3 +Version: 00-06-02 (September 17th, 2012)
4 4 Author: Juergen Knoedlseder (jurgen.knodlseder@irap.omp.eu)
5 5  
6 6  
... ...
configure.ac
... ... @@ -387,16 +387,17 @@ yes)
387 387 ;;
388 388 esac
389 389  
390   - # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
391   - # environment with a value that is the same as what we'll use
392   - # in the Makefile to ensure that we'll get the same compiler
393   - # environment during configure and build time.
394   - MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
395   - export MACOSX_DEPLOYMENT_TARGET
396   - EXPORT_MACOSX_DEPLOYMENT_TARGET=''
397   -
398 390 # Set compile, link and pre-processor flags dependent on architecture
399 391 if test "${enable_universalsdk}"; then
  392 +
  393 + # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the
  394 + # environment with a value that is the same as what we'll use
  395 + # in the Makefile to ensure that we'll get the same compiler
  396 + # environment during configure and build time.
  397 + MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET"
  398 + export MACOSX_DEPLOYMENT_TARGET
  399 + EXPORT_MACOSX_DEPLOYMENT_TARGET=''
  400 +
400 401 UNIVERSAL_ARCH_FLAGS=""
401 402 if test "$UNIVERSAL_ARCHS" = "32-bit" ; then
402 403 UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386"
... ...