JuliaHubOSS / llvm-cbe

resurrected LLVM "C Backend", with improvements
Other
826 stars 141 forks source link

Fix make command in README #108

Closed XAMPPRocky closed 3 years ago

XAMPPRocky commented 3 years ago

On macOS, I tried following the instructions to build, however I couldn't get it to work until I specified the source folder with -S.

hikari-no-yume commented 3 years ago

Huh. I am also on macOS and cmake .. worked fine for me. Could it be a CMake version thing? Are you building it together with LLVM or using a pre-built version?

XAMPPRocky commented 3 years ago

I'm using a prebuilt LLVM 10.0.1 from pkgin with CMake 3.20.0

hikari-no-yume commented 3 years ago
$ cmake --help
Usage

  cmake [options] <path-to-source>
  cmake [options] <path-to-existing-build>
  cmake [options] -S <path-to-source> -B <path-to-build>

Is it possible that you had what CMake thinks is an “existing build” in your llvm-cbe directory and that's what confused it? Because otherwise I think -S would be redundant.

Anyway, on my macOS setup with cmake 3.17.3 (from Homebrew) and on my Ubuntu setup with cmake 3.16.3, adding -S seems to be harmless, so if this is the only fix for your problem then merging it seems okay.

XAMPPRocky commented 3 years ago

For reference, this is the output when running cmake .. and cmake -S ... If I had a guess (I don't use CMake day-to-day), it would be that cmake .. is changing the current directory for the program, where as -S doesn't.

➜  build git:(master) ✗ cmake ..
CMake Warning at /usr/local/Cellar/cmake/3.20.0/share/cmake/Modules/Platform/Darwin-Initialize.cmake:303 (message):
  Ignoring CMAKE_OSX_SYSROOT value:

   /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk

  because the directory does not exist.
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.20.0/share/cmake/Modules/CMakeSystemSpecificInitialize.cmake:21 (include)
  CMakeLists.txt:3 (project)

-- Found LLVM 10.0.1
-- Using LLVMConfig.cmake in: /opt/pkg/lib/cmake/llvm
-- Linker detection: ld64
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/src/llvm-cbe
➜  build git:(master) ✗ cmake -S ..
-- The C compiler identification is AppleClang 12.0.5.12050022
-- The CXX compiler identification is AppleClang 12.0.5.12050022
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found LLVM 10.0.1
-- Using LLVMConfig.cmake in: /opt/pkg/lib/cmake/llvm
-- Linker detection: ld64
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/src/llvm-cbe/build