Skip to content
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

Can't compile on OS X 12.4 #307

Open
dr-kd opened this issue Aug 1, 2022 · 3 comments
Open

Can't compile on OS X 12.4 #307

dr-kd opened this issue Aug 1, 2022 · 3 comments

Comments

@dr-kd
Copy link

dr-kd commented Aug 1, 2022

Here's the error log after following the build instructions:

$ cmake ..
CMake Error at /usr/local/Cellar/cmake/3.23.2/share/cmake/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/Library/Developer/CommandLineTools/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /Users/kd/Desktop/dev/Camomile/build/CMakeFiles/CMakeTmp
    
    Run Build Command(s):/usr/bin/make -f Makefile cmTC_ba6fc/fast && /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_ba6fc.dir/build.make CMakeFiles/cmTC_ba6fc.dir/build
    Building C object CMakeFiles/cmTC_ba6fc.dir/testCCompiler.c.o
    /Library/Developer/CommandLineTools/usr/bin/cc   -arch  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk -mmacosx-version-min=10.9 -MD -MT CMakeFiles/cmTC_ba6fc.dir/testCCompiler.c.o -MF CMakeFiles/cmTC_ba6fc.dir/testCCompiler.c.o.d -o CMakeFiles/cmTC_ba6fc.dir/testCCompiler.c.o -c /Users/kd/Desktop/dev/Camomile/build/CMakeFiles/CMakeTmp/testCCompiler.c
    clang: error: invalid arch name '-arch -isysroot'
    clang: warning: /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk: 'linker' input unused [-Wunused-command-line-argument]
    make[1]: *** [CMakeFiles/cmTC_ba6fc.dir/testCCompiler.c.o] Error 1
    make: *** [cmTC_ba6fc/fast] Error 2

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:8 (project)

xcode version is:

$ xcode-select -v
xcode-select version 2395.
@hyperpenelope
Copy link
Contributor

hyperpenelope commented Aug 4, 2022

Clearly, when CMake was generating the command to compile the test program, it put an empty string as the value for the -arch option.

This is a wild guess: could you make this change to the top of CMakeLists.txt and try again?

 cmake_minimum_required(VERSION 3.12)
 
 set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")
-set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)" CACHE STRING "" FORCE)
+set(CMAKE_OSX_ARCHITECTURES "${ARCHS_STANDARD}" CACHE STRING "" FORCE)

That is, change the round brackets to curly brackets around ARCHS_STANDARD.

@dr-kd
Copy link
Author

dr-kd commented Aug 6, 2022

Applying that patch caused a successful build. Thank you very much.

In lieu of a pull request, here's the actual diff - I'll leave it to someone who knows better to do the mechanics of it:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a57ef15..0a5b3af 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
 cmake_minimum_required(VERSION 3.12)
 
 set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")
-set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)" CACHE STRING "" FORCE)
+set(CMAKE_OSX_ARCHITECTURES "${ARCHS_STANDARD}" CACHE STRING "" FORCE)
 set(JUCE_ENABLE_MODULE_SOURCE_GROUPS ON CACHE BOOL "" FORCE)
 set_property(GLOBAL PROPERTY USE_FOLDERS YES)
 

@hyperpenelope
Copy link
Contributor

@singingfish Good news. I am curious what ARCHS_STANDARD actually is. If you have time, could you add the line

message("ARCHS_STANDARD='${ARCHS_STANDARD}'")

near the top of CMakeLists.txt and run cmake .. in your build directory? You don't have to recompile (i.e. you don't have to run cmake --build .) This should print out its value; I am wondering if it is populated on OSX.

Anyway, I'll do a PR for this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants