Coder Social home page Coder Social logo

Comments (9)

Rippanda12 avatar Rippanda12 commented on August 23, 2024

cmake tells users how to set the compiler if it doesnt find it

CMake Error at CMakeLists.txt:92 (project):
  The CMAKE_C_COMPILER:

    arm-linux-gnueabihf-gcc

  is not a full path and was not found in the PATH.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:92 (project):
  No CMAKE_ASM_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "ASM" or the CMake cache entry CMAKE_ASM_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

from box86.

ptitSeb avatar ptitSeb commented on August 23, 2024

THis bit is crucial for arm64 build, for it to be plug'n play.

from box86.

Rippanda12 avatar Rippanda12 commented on August 23, 2024

Same here but I can't compile without patching your thing

from box86.

Rippanda12 avatar Rippanda12 commented on August 23, 2024

Not every GCC compiler has the same triple name.
The one I'm compiling uses armv7h-linux-gnueabihf, now I have to patch so that I can build.
Is it too much to ask from people to adhere to standards instead of hardcoding stuff in?
This is the same with what I experienced with X11 libs, most of them have hard coded paths (look here https://github.com/BredOS/multilib-pkgbuilds, under patches/).

This is how cross compilation should be done
https://github.com/BredOS/multilib-pkgbuilds/blob/main/patches%2Flib32-llvm.patch#L32

Atleast do checks first. Cmake supports those.
User defined Cc CXX should be respected at all costs.

from box86.

ptitSeb avatar ptitSeb commented on August 23, 2024

but those patch are Arch OS specific. The point is to have box86 buildable everywhere. Currently, most machine still use debian based OS (Debian, Ubuntu, Armbian), and this works perfectly, without the need to use a shell script. Note that this is not really cross-compiling, it' build on the devices directly.

If you find a solution to make this parametrable without breaking debian compatibility, I'm all hears.

Last time I tried, cmake was not not happy and needed the settings of the C compiler very early in the CMake Script, but maybe there is a simpler way?

from box86.

Rippanda12 avatar Rippanda12 commented on August 23, 2024
set(COMPILER_TRIPLE arm-linux-gnueabihf-gcc)
find_program(COMPILER_FOUND ${COMPILER_TRIPLE})

if(COMPILER_FOUND)
    set(CMAKE_C_COMPILER ${COMPILER_FOUND})
else()
    message(STATUS "Cross compiler ${COMPILER_TRIPLE} not found, using CC or -DCMAKE_C_COMPILER")
endif()

Edit: this is the actual fix

from box86.

ptitSeb avatar ptitSeb commented on August 23, 2024

Ok, looks good to me.

Out of curiosity, is set(COMPILER_TRIPLE arm-linux-gnueabihf-gcc) overloadable? Or does cmake has some specific test that allows it to goes from "arm-linux-gnueabihf-gcc" the actual armhf triplet actually setup in the system?

from box86.

Rippanda12 avatar Rippanda12 commented on August 23, 2024

its still hard coded in a way, checks for that toolchain, if it exists sets it and uses it else uses either /usr/bin/gcc OR in the case of most crosscompilations, CC var or if user specified -DCMAKE_C_COMPILER

from box86.

ptitSeb avatar ptitSeb commented on August 23, 2024

Ah ok, this allows to use fallback instead of just failing. Nice.

from box86.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.