jbush001 / NyuziProcessor

GPGPU microprocessor architecture
Apache License 2.0
1.96k stars 348 forks source link

solution of ASM compiler identification is unknown #209

Closed loonggi closed 8 months ago

loonggi commented 8 months ago

issue description

when I run the step of Build, the ASM compiler identification is unknown issuse is raised, and the details are shown in bellow:

$ cmake .
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at /usr/share/cmake-3.16/Modules/CMakeDetermineASMCompiler.cmake:17 (message):
  Could not find compiler set in environment variable ASM:

  custom-compiler --arg1 --arg2.
Call Stack (most recent call first):
  cmake/nyuzi.cmake:25 (enable_language)
  cmake/nyuzi.cmake:125 (add_nyuzi_binary)
  software/libs/libc/CMakeLists.txt:20 (add_nyuzi_library)

-- Configuring incomplete, errors occurred!

issue analized and solution

This error is caused by CMake, and it indicates that CMake couldn't find the Assembly Language Compiler (ASM). The assembly language compiler is used for compiling assembly code and is typically a separate tool. To resolve this issue, you need to tell CMake how to find the ASM compiler. Here are the steps to analyze and address this problem:

  1. Check if the ASM Compiler is Installed: First, make sure that you have an assembly language compiler installed on your system. Different systems and platforms use different compilers, such as the GNU Assembler (gas), for this purpose. Verify that an appropriate assembly language compiler is installed on your system.

  2. Set an Environment Variable: You can set an environment variable for ASM to point to the path of your assembly language compiler. You can do this by executing the following command:

    export ASM=/path/to/your/assembler

    Replace /path/to/your/assembler with the actual path to your assembly language compiler.

  3. Set the ASM Compiler Path in CMake: You can also inform CMake about the path to the ASM compiler by setting CMAKE_ASM_COMPILER in your CMakeLists.txt file. Add the following line:

    set(CMAKE_ASM_COMPILER /path/to/your/assembler)

    Replace /path/to/your/assembler with the actual path to your assembly language compiler.

  4. Re-run CMake: Once you've set the ASM compiler's path, re-run CMake to regenerate the build files for your project.

Finally, I fixed this error through step 3. I add the setting set(CMAKE_ASM_COMPILER /usr/bin/as) in line:20 of the cmake/nyuzi.cmake.

If you follow the above steps and still encounter issues, you may need to check your system and build environment to ensure that the assembly language compiler is correctly installed and configured. Additionally, make sure that your CMake version matches the requirements of your project, as specific CMake versions may have special requirements for ASM compilers.