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

Build fails in macOS Ventura #910

Closed
1 task done
ghmanoj opened this issue Jan 30, 2023 · 4 comments
Closed
1 task done

Build fails in macOS Ventura #910

ghmanoj opened this issue Jan 30, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@ghmanoj
Copy link

ghmanoj commented Jan 30, 2023

Operating System

MacOS

What's the issue you encountered?

CMake is identifying the compiler as AppleClang causing the build to fail.

CMake Error at cmake/build_helpers.cmake:339 (message): ImHex can only be compiled with GCC or Clang. AppleClang is not supported. Call Stack (most recent call first): CMakeLists.txt:28 (verifyCompiler)

How can the issue be reproduced?

Build fails when compiling in macOS Ventura.
$ mkdir _build && cd _build
$ cmake ..

ImHex Version

master

ImHex Build Type

  • Nightly or built from sources

Installation type

From Git Clone

Additional context?

Last commit hash 434ced4

@ghmanoj ghmanoj added the bug Something isn't working label Jan 30, 2023
@WerWolv WerWolv closed this as completed Jan 30, 2023
@WerWolv
Copy link
Owner

WerWolv commented Jan 30, 2023

As mentioned in #911, Apple's clang is multiple versions outdated and doesn't support many of the latest C++ features ImHex is using. GCC can however be installed on macOS through homebrew which is able to compile ImHex successfully.

@gtackett
Copy link

gtackett commented Apr 30, 2024

As mentioned in #911, Apple's clang is multiple versions outdated and doesn't support many of the latest C++ features ImHex is using. GCC can however be installed on macOS through homebrew which is able to compile ImHex successfully.

Hmm. My problem seems to be similar to that of @ghmanoj, although I'm trying to build on Big Sur, and I do have gcc et al. installed through homebrew. I followed the MacOS build instructions at (https://github.com/WerWolv/ImHex/tree/master/dist/compiling/macos.md). CMake is nevertheless identifying the compiler as AppleClang causing the build to fail.

  1. Cloned the repo using git clone https://github.com/WerWolv/ImHex --recurse-submodules
  2. Installed all the dependencies using brew bundle --no-lock --file dist/Brewfile
  3. Tried to build ImHex itself using the following commands:
    cd ImHex
    mkdir -p build
    cd build
    CC=$(brew --prefix llvm)/bin/clang
    CXX=$(brew --prefix llvm)/bin/clang++
    OBJC=$(brew --prefix llvm)/bin/clang
    OBJCXX=$(brew --prefix llvm)/bin/clang++
    cmake -G "Ninja"
    -DCMAKE_BUILD_TYPE=Release
    -DCMAKE_INSTALL_PREFIX="./install"
    -DIMHEX_GENERATE_PACKAGE=ON
    ..
    ninja install
    -- Configuring ImHex v1.33.0
    CMake Error at cmake/build_helpers.cmake:421 (message):
    ImHex can only be compiled with GCC or Clang. AppleClang is not supported.
    Call Stack (most recent call first):
    CMakeLists.txt:49 (verifyCompiler)

And yet:

$(brew --prefix llvm)/bin/clang --version
Homebrew clang version 18.1.4
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

So it would appear that cmake is somehow mis-detecting the version of clang.

Just to be thorough:

$ which cmake
/usr/local/bin/cmake
$ cmake --version
cmake version 3.29.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).

@gtackett
Copy link

I wonder if this post on stackoverflow explains the problem?

@gtackett
Copy link

gtackett commented May 1, 2024

I just needed to rm CMakeCache.txt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants