You are not logged in.

#1 2023-03-24 19:02:46

bertulli
Member
Registered: 2021-11-25
Posts: 48

[SOLVED] CMake can't recognize Arch as UNIX

Hi all!

I'm trying to compile the LLVM-embedded-toolchain-for-Arm. Compilation fails due to CMake not recognizing my system as any known platform:

CMake Error at /home/alessandro/tesi/LLVM-embedded-toolchain-for-Arm/repos/llvm-project/llvm/cmake/modules/HandleLLVMOptions.cmake:150 (MESSAGE):
  Unable to determine platform
Call Stack (most recent call first):
  CMakeLists.txt:157 (include)

The referenced file contain:

if(WIN32)
  set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
  if(CYGWIN)
    set(LLVM_ON_WIN32 0)
    set(LLVM_ON_UNIX 1)
  else(CYGWIN)
    set(LLVM_ON_WIN32 1)
    set(LLVM_ON_UNIX 0)
  endif(CYGWIN)
else(WIN32)
  if(FUCHSIA OR UNIX)
    set(LLVM_ON_WIN32 0)
    set(LLVM_ON_UNIX 1)
    if(APPLE OR ${CMAKE_SYSTEM_NAME} MATCHES "AIX")
      set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
    else()
      set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
    endif()
  else(FUCHSIA OR UNIX)
    MESSAGE(SEND_ERROR "Unable to determine platform") // <----- HERE
  endif(FUCHSIA OR UNIX)
endif(WIN32)

Now I tried invoking CMake with `-DUNIX=True` but with no success. Adding at the top of the root CMakeLists.txt the lines:

message(STATUS "Using LLVM on: ${CMAKE_SYSTEM_NAME}")
set(UNIX TRUE)

prints blank for the first, and doesn't make UNIX show up when I invoke CMake with `-LH`. Moreover, compilation still doesn't work.

What am I doing wrong? Is this an issue of Arch, of CMake, of my system, of the CMakeLists.txt...?

Thanks!

Last edited by bertulli (2023-03-27 10:30:28)


We are still learning
    - wise people

Offline

#2 2023-03-26 12:34:12

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: [SOLVED] CMake can't recognize Arch as UNIX

This has similarities to https://bugs.archlinux.org/task/77691 in which an llvm provided cmake macro failed to detect some component .

Maybe the failure you got can be solved / workedaround also by using llvm-config ?


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2023-03-27 10:30:06

bertulli
Member
Registered: 2021-11-25
Posts: 48

Re: [SOLVED] CMake can't recognize Arch as UNIX

Apparently, this was a fault on LLVM's side. I was trying to compile a release flagged commit, but it seemed to be broken with CMake. Building the latest commit on main worked fine (which I think is amazing considering the commit frequency on main). I'll mark as solved, thanks!


We are still learning
    - wise people

Offline

Board footer

Powered by FluxBB