0

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?

Big Guy
  • 33
  • 6
  • The line with `The parameter is incorrect` is not the error message. It is just the line which is executed. So, what exact error message CMake gives you? – Tsyvarev Apr 03 '23 at 19:00
  • 1
    `cmake.exe -E env VERBOSE=1 -f Makefile cmTC_2e53c/fast &&` looks wrong. I would have expected to see `cmake.exe -E env VERBOSE=1 -- make -f Makefile cmTC_2e53c/fast &&` – starball Apr 03 '23 at 19:50
  • 1
    I assume your line `set(CMAKE_MAKE_PROGRAM /path/to/make.exe)` is not literally like that. Please show what you actually have there. I suspect you set it wrong, and actually set it to be an empty string somehow. – starball Apr 03 '23 at 19:52
  • And by the way, if that path is something specific to your machine (which I'll bet it is), I'd recommend to set it in a presets file instead of hardcoding it into your CMakeLists.txt. See also https://stackoverflow.com/q/75143040/11107541. – starball Apr 03 '23 at 19:53
  • 2
    Are you trying to build on Windows? If not I don't understand why your CMake path is `C:/Program Files/CMake/bin/cmake.exe` I would try to track that down: it can't be right. – MadScientist Apr 03 '23 at 19:58
  • Yes this is windows, that path is correct. Also the other paths are correct, Ive shortened them in the example to not show where my install is. – Big Guy Apr 04 '23 at 13:48
  • "_Make command was: -f Makefile &&_" This is **still / also** a symptom of the `CMAKE_MAKE_PROGRAM` problem I mentioned earlier. **please show us what you you actually put in `CMAKE_MAKE_PROGRAM`. Why didn't you address my comment?** – starball Apr 04 '23 at 15:50

0 Answers0