Hi I have built Poco on OSX 10.11 using the following commands:
./configure --static --no-tests --no-samples --omit=Data/ODBC,Data/MySQL,Data/MongoDB --include-path=$OPENSSL_INCLUDE_PATH
make -j2
My deployment target in XCODE is set to 10.10 and hence when I run the project I get several warnings of type:
ld: warning: object file (libPocoNetSSL.a(PrivateKeyFactory.o) was built for newer OSX version (10.11) than being linked (10.10)
How can I build POCO for 10.10, Is there any custom flag or directive that can be used?
Any help would be appreciable.
Try adding -mmacosx-version-min=10.10 to Darwin-clang.
Related
Does anyone know how to do specify the Mac OS X SDK to build against with CMake? I have searched for cmake mac "base sdk" but this turned up nothing.
I am using CMake to generate Unix makefiles.
Update
On my 10.6 install, I see that /Developer/SDKs has the following:
MacOSX10.4u.sdk
MacOSX10.5.sdk
MacOSX10.6.sdk
Perhaps I can get CMake to pass one of these paths to the compiler somehow?
Also, my 10.7 install only has:
MacOSX10.6.sdk
MacOSX10.7.sdk
Does this mean that it can only build for these platforms?
Update 2
Damn, I just realised that actually I'm not using Xcode -- so this may affect some answers. Also, I am now trying with Mac OS X 10.8 developer preview (with some weird results, see my answer).
After trying sakra's valid answer (valid as far as CMake is suposed to behave) unsucessfully, I had a dig around and found that if I specify the --sysroot flag to the compiler, it seems to use the correct SDK!
However, I now see this error when I compile against 10.7 (which I don't see with 10.8):
Undefined symbols for architecture i386:
"_NXArgv", referenced from:
execSelfNonDaemonized() in libarch.a(CArchDaemonUnix.o)
CArchDaemonUnix::daemonize(char const*, int (*)(int, char const**)) in libarch.a(CArchDaemonUnix.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/synergyc] Error 1
make[1]: *** [src/cmd/synergyc/CMakeFiles/synergyc.dir/all] Error 2
make: *** [all] Error 2
Note: CArchDaemonUnix is a class in Synergy (an open source project I'm working on).
Update:
Just tried this on my 10.6 install, and I was getting a linker error when trying to compile for 10.5 -- turns out you also need to specify the MACOSX_DEPLOYMENT_TARGET environment variable!
Anyway, here's what I'm doing when running on Mountain Lion (OSX 10.8) to compile for 10.7:
Command line:
MACOSX_DEPLOYMENT_TARGET=10.7
cmake -G "Unix Makefiles" -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.7.sdk/ -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 ../..
CMakeLists.txt:
set(CMAKE_CXX_FLAGS "--sysroot ${CMAKE_OSX_SYSROOT} ${CMAKE_CXX_FLAGS}")
I hope this helps someone! :-)
Add the following commands on your CMakeLists.txt
set(CMAKE_OSX_SYSROOT macosx10.10)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5")
This should be fine.
You can set the variable CMAKE_OSX_SYSROOT to the chosen SDK upon configuring the project. E.g.:
cmake -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.4u.sdk/ ..
See the documentation here.
Also note that CMake versions before 2.8.8 do not support Xcode 4.3.
I've tweaked a script for building libjpeg framework here. The key configuration is as follows,
../configure --target i386-apple-darwin9.0 --build i386-apple-darwin9.0 --prefix=$OSXPREFIXDIR/osx-build --disable-dependency-tracking --enable-static=yes --enable-shared=no CFLAGS="-isysroot $XCODE_ROOT/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.5.sdk"
I've been able to create the framework, However it is still built for macOS 10.12 when I use otool -l to check libjpeg object file. Could anyone share a thought?
I have no solution for your compilation problem but if you just want a working libjpeg binary for OS X 10.5+ then you can download it from libjpeg-turbo (either as a static library or as a dynamic one, and both libjpeg and libturbojpeg).
Check: https://libjpeg-turbo.org/Documentation/OfficialBinaries
You'll find a .dmg file on their SourceForge.
Try adding -mmacosx-version-min=10.5 to the CFLAGS. You may not need the target/build parameters, and it may be possible to compile against the latest SDK rather than needing the 10.5 SDK.
this question has been asked before, but none of the answers seem to be currently working.. whether that's because they are incomplete, or things have changed, I don't know.
I build my code for a deployment target of 10.7 (my clients use their machines for music production, so they often prefer to stick with what they know works rather than updated with every new OS release).
I'm using boost.
So when I buid I get a bunch of warnings
ld: warning: object file (/usr/local/lib/libboost_filesystem.a(path.o)) was built for newer OSX version (10.10) than being linked (10.7)
ld: warning: object file (/usr/local/lib/libboost_system.a(error_code.o)) was built for newer OSX version (10.10) than being linked (10.7)
and so on.
So, I want to build boost (version 1.58 currently, unfortunately cmake is usually a couple of versions behind in what it can find) for a deployment target of 10.7
It seems the magic instruction is
macosx-version-min=10.7
except I can't make it work.
./bootstrap.sh
sudo ./b2 -a macosx-version-min=10.7 install
Just doesn't do it, nor do any of the other things I've tried (I'm not familar with how b2 works, so I'm grasping in the dark).
I expect I'm missing something simple, but some help would be much appreciated
regards
Jon
I ran into the same issue and could only fix it by building boost with the 10.7 library. I've used XCode 8.2.1. Here is what I did:
Modifying "Darwin.Jam". Look for this line: feature macosx-version-min : : propagated optional ;
and add this line below feature.extend macosx-version-min : 10.7 ;
Modify "Info.plist" in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform and set <key>MinimumSDKVersion</key>
<string>10.11</string>
Make sure your XCode.app has the 10.7 SDK installed. This is the right location: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs You can extract or copy it from an earlier version of XCode.
Now build boost with these options: cxxflags="-stdlib=libc++ -std=c++11 -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"
E.g. ./b2 -a cxxflags="-stdlib=libc++ -std=c++11 -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk"
The solution above will build Boost with the 10.7 SDK instead just setting the Target SDK to 10.7
I'm trying to compile WxWidgets 3.0.2 on my mac OSX 10.10
and I get the following message:
Blockquote
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/.../wxWidgets-3.0.2/build_rel/lib/libwx_osx_cocoau-3.0.0.2.0.dylib] Error 1
I'm compiling using these flags
../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 CC=clang CXX=clang++ CXXFLAGS="-stdlib=libc++ -std=c++11" OBJCXXFLAGS="-stdlib=libc++ -std=c++11" LDFLAGS=-stdlib=libc++ --enable-universal-binary=x86_64 --enable-monolithic --enable-unicode --with-expat=builtin --with-zlib=builtin --with-libtiff=builtin --with-regex=builtin --with-libpng=builtin --with-libjpeg=builtin
As you can see I added the enable-universal-binary=x86_64 as suggested in other topics.
If you can suggest other flags that I might have not added or I should remove
that would be great..
Thanks
The other way:
brew install wxwidgets
you will get compiled wxWidgets in /usr/local/Cellar.
In principle, this should work, but what is the point of using --enable-universal-binary=x86_64? It's not universal if there is only a single architecture... You probably wanted to use --enable-macosx_arch=x86_64 instead.
BTW, I think the various stdlib-related options are unnecessary as well, clang is the default compiler under 10.10. And --enable-unicode is definitely superfluous.
If you need wx3.0.0 osx 10.7+ monolitic, shared library can get it from here wxphp stub bundle
Library is included in app/contents/resources , use it if you want. but you need headers c++, get it from wx side.
As posted here, you can use --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/ as a workaround. There is an fixed issue about it and will probably be released on 3.0.3.
I'm trying to build a static, universal Qt from source on Mac OS X 10.6 using the following command:
sh configure -static -opensource -universal
The problem, I have been told, is that PPC is not supported on 10.6 so I am getting many errors and the build eventually fails.
So I need to build for a different target version of OS X - 10.4 or 10.5. How can I do that? Do I need to add some parameters to my configure line and, if so, which ones?
Try using the -sdk option to configure. e.g.
./configure -sdk /Developer/SDKs/MacOSX10.5.sdk -opensource -universal
...if you want to make binaries targeting OSX 10.5 and later.
Statically linking is a separate issue again. I would not recommend it, especially since OSX already supports app bundles anyway, which I believe gives most of the same benefits to the end-user as static linking.