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

Fix cmake build on MacOS #275

Closed
nickwanninger opened this issue Apr 10, 2019 · 13 comments
Closed

Fix cmake build on MacOS #275

nickwanninger opened this issue Apr 10, 2019 · 13 comments

Comments

@nickwanninger
Copy link

I get this error on every single file that the CMake program attempts to compile. Is this a known problem or is my machine not configured correctly?

In file included from /var/folders/33/mjfjj83j3zgc_hfnrkj9wkjw0000gn/T/tmp.HMPg99oq/bdwgc/alloc.c:19:
In file included from /var/folders/33/mjfjj83j3zgc_hfnrkj9wkjw0000gn/T/tmp.HMPg99oq/bdwgc/include/private/gc_priv.h:59:
In file included from /usr/include/stdlib.h:65:
In file included from /usr/include/sys/wait.h:109:
In file included from /usr/include/sys/signal.h:150:
In file included from /usr/include/sys/_types/_sigaltstack.h:40:
/usr/include/machine/types.h:37:2: error: architecture not supported
#error architecture not supported
 ^
@ivmai
Copy link
Owner

ivmai commented Apr 10, 2019

CMake works on Windows. Should work on other hosts but not tested for ages. The script contains some workaround for MacOS:

IF(APPLE)
    IF("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
        SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;x86_64" CACHE STRING "Build architectures for Mac OS X" FORCE)
    ENDIF()
ENDIF(APPLE)

I guess it should not be difficult to fix the build.

@nickwanninger
Copy link
Author

nickwanninger commented Apr 18, 2019

Hmm, I've looked into this and the only way I can get it working is by a) moving that workaround to above the project() call, and b) changing the architectures to only "x86_64".

IF(APPLE)
    IF("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
        SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "Build architectures for Mac OS X" FORCE)
    ENDIF()
ENDIF(APPLE)

Doing this allows me to fully compile using cmake on macos. Or I can call CMake with cmake .. -DCMAKE_OSX_ARCHITECTURES=x86_64 on macos

@ivmai
Copy link
Owner

ivmai commented Apr 18, 2019

If you know how to fix this in GC, please contribute.

@vicroms
Copy link
Contributor

vicroms commented May 25, 2019

@nickwanninger

I've opened a PR (#281) to modify the existing CMakeLists.txt, which I believe is due for modernization.

I'll try to add your workaround there as well.

@vicroms
Copy link
Contributor

vicroms commented Jun 6, 2019

Hi @nickwanninger
It's been a while, but can you test whether the patches in PR #281 work for you?

@nickwanninger
Copy link
Author

Yes I will look into the PR really quick

@nickwanninger
Copy link
Author

@vicroms, #281 doesn't seem to work for me. I simply did a mkdir build; cd build; cmake ..; make and it fails on the final make with the same error as it did before

@vicroms
Copy link
Contributor

vicroms commented Jun 6, 2019

I see, I'll try to get a Mac to make some more local testing.
Thanks @nickwanninger!

@nickwanninger
Copy link
Author

Ill see what I can figure out as well

@nickwanninger
Copy link
Author

@vicroms. So it seems that running cmake with cmake .. -DCMAKE_OSX_ARCHITECTURES=x86_64 allows builds on macos in your PR

@ivmai ivmai changed the title Plans to get cmake working on macos? Fix cmake build on MacOS Jun 7, 2019
@ivmai
Copy link
Owner

ivmai commented Jun 7, 2019

I've looked into this and the only way I can get it working is by a) moving that workaround to above the project() call, and b) changing the architectures to only "x86_64".

@nickwanninger moving that workaround to above the project() is not needed, right?

@nickwanninger
Copy link
Author

nickwanninger commented Jun 7, 2019

It seems like it. I was able to just run with that flag on @vicroms' PR with no modifications

Is there a way to add that flag into the cmakelist?

ivmai pushed a commit that referenced this issue Jun 7, 2019
Issue #275 (bdwgc).

Having "ppc" in CMAKE_OSX_ARCHITECTURES fails the build on Mac
OS X 10.13, at least.

* CMakeLists.txt [APPLE && $CMAKE_OSX_ARCHITECTURES==""]
(CMAKE_OSX_ARCHITECTURES): Set to "x86_64;i386" (instead of
"ppc;i386;x86_64").
@ivmai ivmai closed this as completed Jun 7, 2019
ivmai pushed a commit that referenced this issue Jun 27, 2019
(a cherry-pick of commit f73611c from 'master')

Issue #275 (bdwgc).

Having "ppc" in CMAKE_OSX_ARCHITECTURES fails the build on Mac
OS X 10.13, at least.

* CMakeLists.txt [APPLE && $CMAKE_OSX_ARCHITECTURES==""]
(CMAKE_OSX_ARCHITECTURES): Set to "x86_64;i386" (instead of
"ppc;i386;x86_64").
@ivmai
Copy link
Owner

ivmai commented Aug 27, 2019

Hello @nickwanninger, @vicroms,
I have modified the cmake script in the master branch since this discussion, e.g. multi-threaded builds are on by default now. It would be nice if you test the latest version if it works OK for you.

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

3 participants