Reputation: 33
I am attemping to use CMake to configure/build for a very old version of LynxOS (2.2.2) and have gotten to the point where it is generating a makefile however I am getting the following error when running cmake:
cmake --debug-trycompile -G "Unix Makefiles" -D CMAKE_C_COMPILER=path/to/los/gcc.exe -D CMAKE_TOOLCHAIN_FILE=path/to/toolchain/los_tc.cmake .
gives me:
Run Build Command(s):C:/Program Files/CMake/bin/cmake.exe -E env VERBOSE=1 -f Makefile cmTC_2e53c/fast && The parameter is incorrect
However, if I navigate to ./CMakeFiles/CMakeScratch/TryCompile-cwzvwo and run make -f Makefile all then the makefile will build fine with no errors.
My toolchain file is very simple, note that this is on windows, I've shortened the paths in this example to hide them but they are correct in the real version.
set(CMAKE_SYSTEM_NAME los222)
set(CMAKE_SYSTEM_PROCESSOR ppc)
set(CMAKE_CROSSCOMPILING 1)
set(CMAKE_C_COMPILER /path/to/gcc.exe)
set(CMAKE_FIND_ROOT_PATH /path/to/cdk/win32-xcoff-ppc;/path/to/cdk/win32-xcoff-ppc/usr/bin)
set(CMAKE_MAKE_PROGRAM /path/to/make.exe)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
I am not sure why the cmake.exe is trying to run the Makefile and giving me the error, when I can run it fine on command line myself.
Update: I have gotten it to finish generating by just adding:
set(CMAKE_C_COMPILER_FORCED 1) set(CMAKE_CXX_COMPILER_FORCED 1)
since it is generating the makefile correctly, dunno if this is a great way to do things but at least it gets past that step.
So now, when I do a cmake --build . I get a similar error:
The parameter is incorrect
CMake Error: Generator: execution of make failed. Make command was: -f Makefile &&
Running the makefile manually I get:
gcc: cannot specify -o with -c or -S and multiple compilations
I've tracked this down into my build.make file, the error is in here:
CMakeFiles/fdm.dir/main.c.obj: CMakeFiles/fdm.dir/compiler_depend.ts
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=C:/project_files/_CMAKE/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object CMakeFiles/fdm.dir/main.c.obj"
C:/RW_APPS/LW/2.2.2/ppc_dev/cdk/win32-xcoff-ppc/usr/bin/gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT CMakeFiles/fdm.dir/main.c.obj -MF CMakeFiles/fdm.dir/main.c.obj.d -o CMakeFiles/fdm.dir/main.c.obj -c C:/project_files/_CMAKE/main.c
Which I can get working by removing the CMakeFiles/fdm.dir/main.c.obj -MF CMakeFiles/fdm.dir/main.c.obj.d section. Is there a way to specify what is put here in cmake?
Upvotes: 0
Views: 641