wayland-ivi-extension build error on ubuntu16.04 - ubuntu-16.04

I followed the steps of GENIVI guide.
Building wayland-ivi-extension:
$ git clone https://github.com/GENIVI/wayland-ivi-extension.git
$ mkdir build-wayland-ivi-extension
$ cd build-wayland-ivi-extension
$ cmake ./ -DBUILD_ILM_API_TESTS=1 ../wayland-ivi-extension
$ make
$ make install
I got the error when I executed:
cmake ./ -DBUILD_ILM_API_TESTS=1 ../wayland-ivi-extension
Error log:
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'wayland-client>=1.13.0'
CMake Error at /usr/share/cmake-3.5/Modules/FindPkgConfig.cmake:367 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/FindPkgConfig.cmake:532 (_pkg_check_modules_internal)
protocol/CMakeLists.txt:25 (pkg_check_modules)
-- Configuring incomplete, errors occurred!
See also "/home/nlin/Wayland/build-wayland-ivi-extension/CMakeFiles/CMakeOutput.log".

some installed packages are required to compile Wayland-ivi-extension
Pre-requisite:
- Weston
- CMake required (version 2.6 or higher)
- Open GLES and EGL for example applications
- Gtest for the test suite
sudo apt-get install pkg-config
sudo apt-get install libwayland-dev
and then try to run cmake command. If there is any error feel free to contact.

Related

Visual studio code cmake causes error ld.exe: unrecognized option '--major-image-version'

Using windows 10, I am trying to build example code for a W5100S-EVB-Pico.
I started in https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf section 9.2 which sets you up to build on windows. I was able to build the examples files there using visual studio code.
Now I want to use the Wiznet. Starting in https://github.com/Wiznet/RP2040-HAT-C I follow directions in the file getting_started.md I then go to vs code, and follow the pattern from 9.2. I open the folder ...\RP2040-HAT-C\examples\http\server select the appropriate compiler, and click build. I get an error which leads me to add the line
cmake_minimum_required(VERSION 3.25)
to CMakeLists.txt Build now results in the following:
[variant] Loaded new set of variants
[kit] Successfully loaded 5 kits from C:\Users\rw\AppData\Local\CMakeTools\cmake-tools-kits.json
[proc] Executing command: "D:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\12.2 rel1\bin\arm-none-eabi-gcc.exe" -v
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" -Sd:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server -Bd:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server/build -G "NMake Makefiles"
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" -Sd:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server -Bd:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server/build -G "NMake Makefiles" exited with code: 1 and signal: null
[main] Configuring folder: server
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug "-DCMAKE_C_COMPILER:FILEPATH=D:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\12.2 rel1\bin\arm-none-eabi-gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=D:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\12.2 rel1\bin\arm-none-eabi-g++.exe" -Sd:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server -Bd:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server/build -G "NMake Makefiles"
[cmake] Not searching for unused variables given on the command line.
[cmake] CMake Warning (dev) in CMakeLists.txt:
[cmake] No project() command is present. The top-level CMakeLists.txt file must
[cmake] contain a literal, direct call to the project() command. Add a line of
[cmake] code such as
[cmake]
[cmake] project(ProjectName)
[cmake]
[cmake] near the top of the file, but after cmake_minimum_required().
[cmake]
[cmake] CMake is pretending there is a "project(Project)" command on the first
[cmake] line.
[cmake] This warning is for project developers. Use -Wno-dev to suppress it.
[cmake]
[cmake] -- The C compiler identification is GNU 12.2.1
[cmake] -- The CXX compiler identification is GNU 12.2.1
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - failed
[cmake] -- Check for working C compiler: D:/Program Files (x86)/Arm GNU Toolchain arm-none-eabi/12.2 rel1/bin/arm-none-eabi-gcc.exe
[cmake] -- Check for working C compiler: D:/Program Files (x86)/Arm GNU Toolchain arm-none-eabi/12.2 rel1/bin/arm-none-eabi-gcc.exe - broken
[cmake] CMake Error at C:/Program Files/CMake/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message):
[cmake] The C compiler
[cmake]
[cmake] "D:/Program Files (x86)/Arm GNU Toolchain arm-none-eabi/12.2 rel1/bin/arm-none-eabi-gcc.exe"
[cmake]
[cmake] is not able to compile a simple test program.
[cmake]
[cmake] It fails with the following output:
[cmake]
[cmake] Change Dir: D:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server/build/CMakeFiles/CMakeScratch/TryCompile-2zbfaa
[cmake]
[cmake] Run Build Command(s):nmake -f Makefile /nologo cmTC_d4dce\fast && "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\nmake.exe" -f CMakeFiles\cmTC_d4dce.dir\build.make /nologo -L CMakeFiles\cmTC_d4dce.dir\build
[cmake] Building C object CMakeFiles/cmTC_d4dce.dir/testCCompiler.c.obj
[cmake] "D:\Program Files (x86)\ARMGNU~1\12DBAB~1.2RE\bin\AR19DD~1.EXE" -o CMakeFiles\cmTC_d4dce.dir\testCCompiler.c.obj -c D:\cygwin\home\rw\holden\RP2040-HAT-C\examples\http\server\build\CMakeFiles\CMakeScratch\TryCompile-2zbfaa\testCCompiler.c
[cmake] Linking C executable cmTC_d4dce.exe
[cmake] "C:\Program Files\CMake\bin\cmake.exe" -E rm -f CMakeFiles\cmTC_d4dce.dir/objects.a
[cmake] "D:\Program Files (x86)\ARMGNU~1\12DBAB~1.2RE\bin\ARM-NO~2.EXE" qc CMakeFiles\cmTC_d4dce.dir/objects.a #CMakeFiles\cmTC_d4dce.dir\objects1
[cmake] "D:\Program Files (x86)\ARMGNU~1\12DBAB~1.2RE\bin\AR19DD~1.EXE" -Wl,--whole-archive CMakeFiles\cmTC_d4dce.dir/objects.a -Wl,--no-whole-archive -o cmTC_d4dce.exe -Wl,--out-implib,libcmTC_d4dce.dll.a -Wl,--major-image-version,0,--minor-image-version,0 #CMakeFiles\cmTC_d4dce.dir\linkLibs.rsp
[cmake] d:/program files (x86)/armgnu~1/12dbab~1.2re/bin/../lib/gcc/arm-none-eabi/12.2.1/../../../../arm-none-eabi/bin/ld.exe: unrecognized option '--major-image-version'
[cmake] d:/program files (x86)/armgnu~1/12dbab~1.2re/bin/../lib/gcc/arm-none-eabi/12.2.1/../../../../arm-none-eabi/bin/ld.exe: use the --help option for usage information
[cmake] collect2.exe: error: ld returned 1 exit status
[cmake] NMAKE : fatal error U1077: '"D:\Program Files (x86)\ARMGNU~1\12DBAB~1.2RE\bin\AR19DD~1.EXE"' : return code '0x1'
[cmake] Stop.
[cmake] NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.34.31933\bin\HostX86\x86\nmake.exe"' : return code '0x2'
[cmake] Stop.
[cmake]
[cmake]
[cmake]
[cmake]
[cmake]
[cmake] CMake will not be able to correctly generate this project.
[cmake] Call Stack (most recent call first):
[cmake] CMakeLists.txt
[cmake]
[cmake]
[cmake] -- Configuring incomplete, errors occurred!
[cmake] See also "D:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server/build/CMakeFiles/CMakeOutput.log".
[cmake] See also "D:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server/build/CMakeFiles/CMakeError.log".
[proc] The command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug "-DCMAKE_C_COMPILER:FILEPATH=D:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\12.2 rel1\bin\arm-none-eabi-gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=D:\Program Files (x86)\Arm GNU Toolchain arm-none-eabi\12.2 rel1\bin\arm-none-eabi-g++.exe" -Sd:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server -Bd:/cygwin/home/rw/holden/RP2040-HAT-C/examples/http/server/build -G "NMake Makefiles" exited with code: 1 and signal: null
Some googling also led me to add the line
set(CMAKE_SYSTEM_NAME Generic)
to CMakeLists.txt, which now looks like
set(TARGET_NAME w5x00_http_server)
cmake_minimum_required(VERSION 3.25)
set(CMAKE_SYSTEM_NAME Generic)
add_executable(${TARGET_NAME}
${TARGET_NAME}.c
)
target_link_libraries(${TARGET_NAME} PRIVATE
pico_stdlib
hardware_spi
hardware_dma
ETHERNET_FILES
IOLIBRARY_FILES
HTTPSERVER_FILES
)
pico_enable_stdio_usb(${TARGET_NAME} 1)
pico_enable_stdio_uart(${TARGET_NAME} 0)
pico_add_extra_outputs(${TARGET_NAME})
I tried to fix the broken compiler error, which made things worse, and returning CMakeLists.txt to its former state did not get back to what is shown above. Is there some kind of 'clean' function I can do?
EDIT2: Tsyvarev made a very good point in the discussion under this answer. Because your CMakeLists.txt is missing a project(...) line it most likely gets implicitly called by CMake on the first line. Specific variables such as CMAKE_CXX_COMPILER or for example CMAKE_SYSTEM_NAME require to be set before the project() line. It is worth trying to update the CMakeLists.txt accordingly. However the first EDIT still holds place (which was also Tsyvarevs finding). You are most likely trying to build from an insufficient CMakeLists.txt
EDIT: I didn't notice what Tsyvarev mentioned in the comments, after looking at the appropriate CMakeLists.txt I have to agree with him. You are definitely also missing some targets and you've probably didn't give us the whole (new) error message. The missing targets here are (for example):
ETHERNET_FILES
IOLIBRARY_FILES
HTTPSERVER_FILES
You will most likely encounter errors regarding this as well. However the original error is truly tied to the set(CMAKE_SYSTEM_NAME Generic).
Original post:
A missing cmake_minimum_required() should just throw a warning not an error IIRC.
The only clean function that exists in CMake is rm [path-to-build-directory]. When you issue the cmake -S. -Bbuild command (or similar) you create a build folder where CMake generates the file needed to compile the project.
As to your issue. The set(CMAKE_SYSTEM_NAME Generic) should be added to the toolchain file or at the very least be the first variable set in your CMakeLists.txt. I believe (and this is a wild guess) that it should be before the cmake_minimum_required() this is the same for variables like CMAKE_CXX_COMPILER etc.
What I would recommend is:
Move the set(CMAKE_SYSTEM_NAME Generic) to the top of the CMakeLists.txt file
Remove the build folder.
Run cmake and build it again.
If the above won't help then I need you to clarify for me this:
By "I went back to VSCode" you mean you opened it up via the Developer prompt like the book you linked suggested.
What commands do you pass to run cmake/build it, i.e. what happens if you run from the Developer powershell/command prompt: cmake -S. -BbuildForStackOverflow -DCMAKE_SYSTEM_NAME=Generic and then build it from these generated files?
My mistake was opening the 'server' folder and assuming that everything was there. I never could figure out where the 'toolchain file' was. The solution is to open the folder RP2040-HAT-C in VS code first and select the appropriate compiler. VS code then does the initial cmake with the .txt file in that directory. Now, on the status line in VS code, I can click 'all' next to build, select my desired target (server) and build. Success!
Thanks to everyone who helped me with this.

gcc not found when building buildroot

I'm trying to build an OS Image for Raspberry pi on MacOS.
make failed because gcc is missing so I installed it with homebrew.
Still I cannot build the image due to the same error:
% make raspberrypi0w_defconfig
...
% make menuconfig
...
% brew install gcc
...
% brew list --versions gcc
gcc 11.3.0_2
% gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include- dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
% make
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
You must install 'gcc' on your build machine
make: *** [dependencies] Error 1
Tried a make clean but I'm still getting the same error...
I ended up switching to gcc (it was a path issue).
clang is apple's C compiler, and when you type gcc, this is the compiler that is used by default. When you install gnu c, (using homebrew in my case), you still need to put it ahead of clang in the path.
However, using BuildRoot on MacOS ended up being a rabbit hole.
There are instructions here: https://github.com/generia/buildroot-osx
, but for me it was far simpler to setup an ubuntu VM and build on it. Which I did.

What is a compiler toolchain?

From the latest CS:GO update, a valve dev commented this on the reddit post:
We are upgrading the compiler toolchain we use to build CS:GO. This
pre-release branch has CS:GO built with the new toolchain. We are
releasing it as a pre-release branch to allow for testing ahead of it
being used in the next update.
There are no functional changes expected, though the new compiler
toolchain may yield a small performance boost.
Can anyone explain what a compiler toolchain is?
A tool chain is a set of tools (chain of tools) that are used to create a programmed product (runnable/executable program etc.).
Usually toolchains are used in the embedded world for cross-compiling, which means creating a program on a host which will eventually run on a different kind of target - therefore there is a need to create it with a specific compiler, linker, debugger etc.
In order to create from scratch a compiler for the target, you need to cross-compile it with a specific toolchain - that is the compiler toolchain.
So, by using the compiler toolchain you will be able to create a compiler for your target system.
A compiler toolchain is a set of tools, supporting libraries and header files that help build a program from source to an executable that can run on a machine. To see what different tools are invoked during a compilation process pass '-v' flag. e.g., gcc -v hello.c will print the following (Note comments # are mine):
$ /usr/local/Cellar/gcc/11.2.0/bin/gcc-11 -v hello.c
# Configuration options which were used to build gcc itself.
Using built-in specs.
COLLECT_GCC=/usr/local/Cellar/gcc/11.2.0/bin/gcc-11
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc/11.2.0/libexec/gcc/x86_64-apple-darwin20/11.2.0/lto-wrapper
Target: x86_64-apple-darwin20
Configured with: ../configure --prefix=/usr/local/Cellar/gcc/11.2.0 --libdir=/usr/local/Cellar/gcc/11.2.0/lib/gcc/11 --disable-nls --enable-checking=release --enable-languages=c,c++,objc,obj-c++,fortran,d --program-suffix=-11 --with-gmp=/usr/local/opt/gmp --with-mpfr=/usr/local/opt/mpfr --with-mpc=/usr/local/opt/libmpc --with-isl=/usr/local/opt/isl --with-zstd=/usr/local/opt/zstd --with-pkgversion='Homebrew GCC 11.2.0' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --enable-libphobos --build=x86_64-apple-darwin20 --with-system-zlib --disable-multilib --without-build-config --with-native-system-header-dir=/usr/include --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.0 (Homebrew GCC 11.2.0)
COLLECT_GCC_OPTIONS='-v' '-mmacosx-version-min=11.5.0' '-asm_macosx_version_min=11.5' '-mtune=core2' '-dumpdir' 'a-'
# Compiler invocation of cc1
/usr/local/Cellar/gcc/11.2.0/libexec/gcc/x86_64-apple-darwin20/11.2.0/cc1 -quiet -v -D__DYNAMIC__ hello.c -fPIC -quiet -dumpdir a- -dumpbase hello.c -dumpbase-ext .c -mmacosx-version-min=11.5.0 -mtune=core2 -version -o /var/folders/1n/lll3n8mj6wj975zjw804hg300000gq/T//ccfvEkdl.s
GNU C17 (Homebrew GCC 11.2.0) version 11.2.0 (x86_64-apple-darwin20)
compiled by GNU C version 11.2.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/usr/local/Cellar/gcc/11.2.0/lib/gcc/11/gcc/x86_64-apple-darwin20/11.2.0/../../../../../../x86_64-apple-darwin20/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/Cellar/gcc/11.2.0/lib/gcc/11/gcc/x86_64-apple-darwin20/11.2.0/include
/usr/local/Cellar/gcc/11.2.0/lib/gcc/11/gcc/x86_64-apple-darwin20/11.2.0/include-fixed
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks
End of search list.
GNU C17 (Homebrew GCC 11.2.0) version 11.2.0 (x86_64-apple-darwin20)
compiled by GNU C version 11.2.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: d0f2649375ab2f2193374e77e0a72e7c
COLLECT_GCC_OPTIONS='-v' '-mmacosx-version-min=11.5.0' '-mtune=core2' '-dumpdir' 'a-'
# Assembler invocation
as -arch x86_64 -v -force_cpusubtype_ALL -mmacosx-version-min=11.5 -o /var/folders/1n/lll3n8mj6wj975zjw804hg300000gq/T//cc2nzxXo.o /var/folders/1n/lll3n8mj6wj975zjw804hg300000gq/T//ccfvEkdl.s
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1as -triple x86_64-apple-macosx11.5.0 -filetype obj -main-file-name ccfvEkdl.s -target-cpu penryn -fdebug-compilation-dir /Users/Coolest -dwarf-debug-producer "Apple clang version 12.0.5 (clang-1205.0.22.9)" -dwarf-version=4 -mrelocation-model pic -mllvm -disable-aligned-alloc-awareness=1 -o /var/folders/1n/lll3n8mj6wj975zjw804hg300000gq/T//cc2nzxXo.o /var/folders/1n/lll3n8mj6wj975zjw804hg300000gq/T//ccfvEkdl.s
COMPILER_PATH=/usr/local/Cellar/gcc/11.2.0/libexec/gcc/x86_64-apple-darwin20/11.2.0/:/usr/local/Cellar/gcc/11.2.0/libexec/gcc/x86_64-apple-darwin20/11.2.0/:/usr/local/Cellar/gcc/11.2.0/libexec/gcc/x86_64-apple-darwin20/:/usr/local/Cellar/gcc/11.2.0/lib/gcc/11/gcc/x86_64-apple-darwin20/11.2.0/:/usr/local/Cellar/gcc/11.2.0/lib/gcc/11/gcc/x86_64-apple-darwin20/
LIBRARY_PATH=/usr/local/Cellar/gcc/11.2.0/lib/gcc/11/gcc/x86_64-apple-darwin20/11.2.0/:/usr/local/Cellar/gcc/11.2.0/lib/gcc/11/gcc/x86_64-apple-darwin20/11.2.0/../../../
COLLECT_GCC_OPTIONS='-v' '-mmacosx-version-min=11.5.0' '-mtune=core2' '-dumpdir' 'a.'
/usr/local/Cellar/gcc/11.2.0/libexec/gcc/x86_64-apple-darwin20/11.2.0/collect2 -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/ -dynamic -arch x86_64 -macosx_version_min 11.5.0 -weak_reference_mismatches non-weak -o a.out -L/usr/local/Cellar/gcc/11.2.0/lib/gcc/11/gcc/x86_64-apple-darwin20/11.2.0 -L/usr/local/Cellar/gcc/11.2.0/lib/gcc/11/gcc/x86_64-apple-darwin20/11.2.0/../../.. /var/folders/1n/lll3n8mj6wj975zjw804hg300000gq/T//cc2nzxXo.o -lSystem -lgcc_ext.10.5 -lgcc -lSystem -no_compact_unwind -v
collect2 version 11.2.0
# linker invocation
/usr/bin/ld -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/ -dynamic -arch x86_64 -macosx_version_min 11.5.0 -weak_reference_mismatches non-weak -o a.out -L/usr/local/Cellar/gcc/11.2.0/lib/gcc/11/gcc/x86_64-apple-darwin20/11.2.0 -L/usr/local/Cellar/gcc/11.2.0/lib/gcc/11/gcc/x86_64-apple-darwin20/11.2.0/../../.. /var/folders/1n/lll3n8mj6wj975zjw804hg300000gq/T//cc2nzxXo.o -lSystem -lgcc_ext.10.5 -lgcc -lSystem -no_compact_unwind -v
#(#)PROGRAM:ld PROJECT:ld64-650.9
BUILD 00:19:30 Mar 17 2021
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
/usr/local/Cellar/gcc/11.2.0/lib/gcc/11/gcc/x86_64-apple-darwin20/11.2.0
/usr/local/Cellar/gcc/11.2.0/lib/gcc/11
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
Framework search paths:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/
Note that a compiler toolchain is necessary to build executables but it is not sufficient. What is missing from the toolchain to have ‘everything’ that is needed to build executable programs is the ‘sysroot’.
Normally when we compile a program for the same machine the compiler uses the standard headers available in ‘/usr/include‘ and libraries from ‘/usr/lib‘. These paths are hardcoded in the compiler itself so we never have to think about it. However, when building a custom compiler or when cross-compiling programs we have to tell the compiler where the sysroot is by passing a flag e.g.
gcc --sysroot="/path/to/arm64/sysroot/usr" hello.c
Most often pre-packaged cross compilers come with a script/binary that has a ‘sysroot’ path embedded into it. e.g., aarch64-linux-gnu-gcc (https://packages.ubuntu.com/xenial/devel/gcc-aarch64-linux-gnu).

CMake fails to generate Makefiles with Sun Studio 12.5

I'm working on Solaris 11.3 with Sun Studio 12.5. When I attempt to configure with Cmake out-of-tree, Cmake finishes with configuration errors and does not produce the makefiles. In-tree may be broken, too. But our procedures say to build out-of-tree, so that;' what I do.
I have nearly no Cmake experience. Others contributed the the CMake files, and I struggle with tasks related to them. I'm not sure if I am doing something wrong, if our Cmake files are broken, or if Cmake is not well tested under Solaris.
What is going on with CMake, and how do I fix it?
Here are the links to the Cmake files. I can copy/paste them, but it just takes up a bunch of space. The files are hosted on GitHub so they should always be available.
CMakefileList.txt
cryptopp-config.cmake
Here is Solaris' Cmake version, prior to me installing 3.6.2:
$ cmake --version
cmake version 2.8.6
Below is from Solaris Cmake version 2.8.6.
cryptopp-build$ export CXX=/opt/developerstudio12.5/bin/CC
cryptopp-build$ export CXXFLAGS="-DNDEBUG -g2 -O2 -D__SSE2__ -D__SSE3__ -D__SSSE3__ -D__SSE4_1__ -D__SSE4_2__ -D__AES__ -D__PCLMUL__ -D__RDRND__ -D__RDSEED__ -D__AVX__ -D__AVX2__ -D__BMI__ -D__BMI2__ -D__ADX__ -xarch=avx2_i"
cryptopp-build$ cmake ../cryptopp
-- The CXX compiler identification is unknown
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:45 (MESSAGE):
The C++ compiler "/bin/c++" is not able to compile a simple test program.
It fails with the following output:
Change Dir: /export/home/test/cryptopp-build/CMakeFiles/CMakeTmp
Run Build Command:/bin/gmake "cmTryCompileExec/fast"
/bin/gmake -f CMakeFiles/cmTryCompileExec.dir/build.make
CMakeFiles/cmTryCompileExec.dir/build
gmake[1]: Entering directory
`/export/home/test/cryptopp-build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report
/export/home/test/cryptopp-build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object CMakeFiles/cmTryCompileExec.dir/testCXXCompiler.cxx.o
/bin/c++ -DNDEBUG -g2 -O2 -D__SSE2__ -D__SSE3__ -D__SSSE3__ -D__SSE4_1__
-D__SSE4_2__ -D__AES__ -D__PCLMUL__ -D__RDRND__ -D__RDSEED__ -D__AVX__
-D__AVX2__ -D__BMI__ -D__BMI2__ -D__ADX__ -xarch=avx2_i -o
CMakeFiles/cmTryCompileExec.dir/testCXXCompiler.cxx.o -c
/export/home/test/cryptopp-build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
c++: error: language arch=avx2_i not recognized
c++: error: language arch=avx2_i not recognized
gmake[1]: Leaving directory
`/export/home/test/cryptopp-build/CMakeFiles/CMakeTmp'
gmake[1]: *** [CMakeFiles/cmTryCompileExec.dir/testCXXCompiler.cxx.o] Error
1
gmake: *** [cmTryCompileExec/fast] Error 2
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:9 (project)
-- Configuring incomplete, errors occurred!
And:
$ /opt/developerstudio12.5/bin/CC -V
CC: Studio 12.5 Sun C++ 5.14 SunOS_i386 2016/05/31
I built Cmake 3.6.2 from sources and installed in /usr/local to attack the CXX compiler identification is unknown issue, but it appears to be having some troubles. As I said earlier, I'm not a Cmake expert (and I'm not sure how one can mess up a make && sudo make install).
cryptopp-build$ cmake ../cryptopp
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/bin
CMake Error: Error executing cmake::LoadCache(). Aborting.
Clearing the cache as suggested by #AndrewHenle results in:
# The project GNUmakefile clears all Cmake artifacts because Cmake cannot seem to do it on its own
$ cd cryptopp
$ git status -s
$
$ cd ..
$ rm -rf cryptopp-build
$ mkdir cryptopp-build
$ cd cryptopp-build
# Using 3.6.2 now
$ cmake ../cryptopp
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/bin
CMake Error: Error executing cmake::LoadCache(). Aborting.
So there appeared to be two problems. First was the down level Sun supplied Cmake. There's nothing genius about diagnosing it as "too old".
The second issue was more interesting. It appears the CMake Error: Could not find CMAKE_ROOT !!! was cause by sudo make install Once I switched to sudo gmake install the issue went away.
Here are the bug reports on the issue:
Cmake Issue 16302: Cmake fails to identify Sun Studio 12.5 compiler
Cmake Issue 16303: Cmake fails to produce a working installation on Solaris 11.3

clang error compiling mongodb from source

I took a git checkout of mongodb source files and am trying to compile it.
I have gcc installed as part of xcode-7.3.1 command-line tools
Now when I am trying to build the mongodb binaries using:
scons all
I am getting the below error:
scons: Reading SConscript files ...
scons version: 2.5.0
python version: 2 7 10 'final' 0
Checking whether the C compiler works... yes
Checking whether the C++ compiler works... yes
Checking that the C++ compiler can link a C++ program... yes
Checking if C++ compiler "g++" is GCC... no
Checking if C++ compiler "g++" is clang... yes
Checking if C compiler "gcc" is clang... no
C compiler does not match identified C++ compiler
See /Users/debashish.g/mongo-code/mongo/build/scons/config.log for details
In the config log it shows:
scons: Configure: Checking if C compiler "gcc" is clang...
build/scons/sconf_temp/conftest_5.c <-
|
|#if defined(__clang__)
|/* we are using toolchain defined(__clang__) */
|#else
|#error
|#endif
|
gcc -o build/scons/sconf_temp/conftest_5.o -c build/scons/sconf_temp/conftest_5.c
build/scons/sconf_temp/conftest_5.c:5:2: error: #error
#error
^~~~~
scons: Configure: no
My gcc --version shows :
Configured with: -- prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include- dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Which is clang. Where am I doing wrong? Please help. I am stuck on this for a long time now.
What I missed was clang and llvm tools . I took a checkout of the source files and did a build of the clang tools according to the steps mentioned here.