-
Notifications
You must be signed in to change notification settings - Fork 4
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
Don't invoke make directly; use CMAKE_BUILD_TOOL #10
Conversation
This project depends on GNUMake, which may not be called `make` on all systems. Use the more portable `CMAKE_BUILD_TOOL` variable instead.
Use `CMAKE_BUILD_TOOL` instead of `make`.
let's hold off on merging this because erlang-pbc builds are failing on at least macOS after merging a similar PR. It shouldn't break anything, but I want to find the root cause |
@JayKickliter which branch is failing? I can test on MacOS and probably get to that root cause. |
master and patch-1 are failing on big sur |
I see it:
|
Haven't gotten to the bottom of it yet, but I see the issue:
|
That's exactly the error that prompted this PR: helium/erlang-pbc#8 |
What I'm noticing is that invoking It appears that this version of |
I'm currently reading this Cmake article, which may be our solution: https://discourse.cmake.org/t/help-with-cc-clang-environment-and-cmake/2221 |
This works:
Now to just find a portable/easy way to ensure it runs. |
this looks like a potential solution: index e3b1f2b..41249e4 100644
--- a/c_src/CMakeLists.txt
+++ b/c_src/CMakeLists.txt
@@ -12,6 +12,11 @@ include(ASan)
IF (APPLE)
set(CMAKE_MODULE_LINKER_FLAGS "-flat_namespace -undefined suppress")
set(CMAKE_MACOSX_RPATH 1)
+ execute_process(COMMAND
+ xcrun --show-sdk-path
+ OUTPUT_VARIABLE APPLE_SDK_ROOT
+ )
+ set(sludgeOS_SDKENV "SDKROOT=${APPLE_SDK_ROOT}")
ENDIF()
#
diff --git a/c_src/cmake/FindGFComplete.cmake b/c_src/cmake/FindGFComplete.cmake
index 18fa5ba..6cdd09b 100644
--- a/c_src/cmake/FindGFComplete.cmake
+++ b/c_src/cmake/FindGFComplete.cmake
@@ -19,7 +19,8 @@ ExternalProject_Add(gf-complete
$ENV{CONFIGURE_ARGS}
CC=${CMAKE_C_COMPILER}
CFLAGS=${CMAKE_C_FLAGS_${BUILD_TYPE_UC}}
- BUILD_COMMAND make -j
+ ${sludgeOS_SDKENV}
+ BUILD_COMMAND make -j ${sludgeOS_SDKENV}
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/lib/libgf_complete.a
INSTALL_COMMAND make install
)
diff --git a/c_src/cmake/FindJerasure.cmake b/c_src/cmake/FindJerasure.cmake
index 3b7e800..87db016 100644
--- a/c_src/cmake/FindJerasure.cmake
+++ b/c_src/cmake/FindJerasure.cmake
@@ -23,7 +23,8 @@ ExternalProject_Add(jerasure
CC=${CMAKE_C_COMPILER}
"CFLAGS=-I${CMAKE_CURRENT_BINARY_DIR}/include ${CMAKE_C_FLAGS_${BUILD_TYPE_UC}}"
LDFLAGS=-L${CMAKE_CURRENT_BINARY_DIR}/lib
- BUILD_COMMAND make -j
+ ${sludgeOS_SDKENV}
+ BUILD_COMMAND make -j ${sludgeOS_SDKENV}
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/lib/libJerasure.a
INSTALL_COMMAND make install
) the same needs to be done for the jerasure dep and it we'd need to make sure it's portable (unless there's a better, less-ugly fix you can think of) |
It's definitely ugly, but I can't think of anything better for now. I tried this and it Works On My Box. |
do you want to incorporate it into your PR (see updated suggested diff above) so you don't have to rebase? either way is fine |
Yes, I'm testing right now. Will update this branch with OSX fixes. |
thanks! And sorry for mixing concerns and stepping on your PR |
once updated I make check that it still works on older macOS (which I usually run) and linux I still don't know why passing SDKROOT to autools+make fixes the problem. |
Fix builds for Mac OS X hosts using a method that JayKickliter and I derived while researching this current problem with CMake. In the future, CMake will probably come up with some reasonable defaults that update CFLAGS properly on Mac OS X so that it gets the proper `-isysroot <PATH>` that is sorely needed when invoking `clang` as directly as CMake is doing.
Happy to mix concerns here. I am an OS X user as well, so this is a two-bugs with one patch win-win for me. |
Builds under FreeBSD 12.1-amd64 as well, now, too. |
I've confirmed this works on macOS 10.14 Mojave. CI will test linux |
we'll need to add this same fix to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I'll merge when you think you're done tweaking.
I think I'm done! I also updated my |
|
This project depends on GNUMake, which may not be called
make
onall systems. Use the more portable
CMAKE_BUILD_TOOL
variable instead.