-
Notifications
You must be signed in to change notification settings - Fork 60
Fix CMake on OSX 10.10 #769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
So on my RHEL6 with gcc 4.9.2, this PR fails with: It's weird it cannot find it, as the build script is as follows: I fixed that by: diff --git a/pkgs/cmake.yaml b/pkgs/cmake.yaml
index 135252f..b3f32c1 100644
--- a/pkgs/cmake.yaml
+++ b/pkgs/cmake.yaml
@@ -26,6 +26,7 @@ build_stages:
'--system-zlib',
'--',
'-DCMAKE_PREFIX_PATH=${CURL_DIR}/lib;${ZLIB_DIR}/lib;${BZIP2_DIR}/lib',
+ '-DCURL_INCLUDE_DIR=${CURL_DIR}/include',
]
when_build_dependency:Then it finds curl (but not bzip2): But then it fails with: But the ssl library seems to have a proper rpath: So I don't know why the linker can't find it. I wonder if this is related: http://stackoverflow.com/questions/24598047/why-does-ld-need-rpath-link-when-linking-an-executable-against-a-so-that-needs |
|
I see what the problem is, here is how to reproduce it. Create a program #include <curl/curl.h>
int main(void)
{
return 0;
}and compile using (adjust: the paths to your it gives: Since the curl itself seems to have the rpath set correctly: The linker is then not following the and recompile: It works! The rpaths are followed and it can find all the libraries, but it doesn't work with The solution seems to be to either remove --- a/pkgs/cmake.yaml
+++ b/pkgs/cmake.yaml
@@ -1,7 +1,7 @@
extends: [autotools_package]
dependencies:
- build: [zlib, bzip2, curl]
+ build: [zlib, bzip2, curl, openssl, libidn]
sources:
- key: tar.gz:vxuu43rwaodxivs7flwyqzsbkrbuit5x@dagss, @ahmadia, @cekees this is a problem for our plan to use |
This way CMake does not build its own versions, but rather uses Hashstack versions. We also made sure the proper RPATH will be used in the `cmake` executable via the CMAKE_PREFIX_PATH option. Only three other libraries are still build as part of CMake: expat, jsoncpp, libarchive, so we commented out options that disable them for now. As a bonus, this patch also fixes a problem on OSX 10.10 where the curl component of CMake fails to build with gcc (we now use Hashstack's version that builds).
On OSX 10.10, one gets errors of the type: [cmake] CMake Error at Modules/Platform/Darwin.cmake:76 (message): [cmake] CMAKE_OSX_DEPLOYMENT_TARGET is '10.10' but CMAKE_OSX_SYSROOT: [cmake] [cmake] "" [cmake] [cmake] is not set to a MacOSX SDK with a recognized version. Either set [cmake] CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to [cmake] empty. [cmake] Call Stack (most recent call first): [cmake] Modules/CMakeSystemSpecificInformation.cmake:36 (include) [cmake] CMakeLists.txt:16 (project) Unless the CMAKE_OSX_DEPLOYMENT_TARGET is set to empty. We set it to empty by unsetting the MACOSX_DEPLOYMENT_TARGET environment variable. Similar problem happens when cmake is used to build other packages. There the fix is to unset the CMAKE_OSX_DEPLOYMENT_TARGET variable on the command line.
ld does not seem to follow the $ORIGIN in recursive dependencies properly. The workaround is to specify the recursive dependencies (in this case openssl, libidn) explicitly, then the rpath is properly constructed and things work at link time. Also add full include paths to the dependencies.
|
As of 9aed126, this is ready for review. |
|
Thanks for pointing out the $ORIGIN issue. |
|
I don't have a mac, but I confirmed that your cmake package works with my stack on ubuntu as a replacement for host-cmake. +1 to merge. |
|
Thanks. Since it wasn't working on a Mac before, and now it is for me, I think it's good to merge. We can improve upon it later if needed. |
See the commit messages for more information.
This is a change in an important package, so let's check that it (at the latest commit 9aed126):
Fixes #746.
This is ready for review.