OS X, extern and autotools
Apparently, building C++ code against C or Fortran on OS X introduces an unexpected error of duplicate symbol
declarations. "Apparently", because I don't have a Mac of my own anymore --- I'm relying on others' reports here. What
seems to happen is that forward-declaring a non-C++ symbol using the extern
keyword actually creates a fully-fledged
symbol, and then the linker goes mental when it finds the "duplicate" definition --- i.e. the real one.
It seems that the MACOSX_DEPLOYMENT_TARGET
environment variable can fix this if set to the appropriate OS X version
number: 10.3
, 10.4
, etc. Here's a configure.ac
snippet which apparently solves the problem for projects using GNU
autotools:
## OS X AC_CHECK_TOOL(SWVERS, sw_vers) if test x$SWVERS != x; then MACOSX_DEPLOYMENT_TARGET=`$SWVERS -productVersion | cut -f 1,2 -d.` AC_MSG_NOTICE([MACOSX_DEPLOYMENT_TARGET = $MACOSX_DEPLOYMENT_TARGET]) fi
Comments
Comments powered by Disqus