CMake fails to apply compiler flags during compiler testing

Bug #1787723 reported by Richard
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cmake (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

When cross-compiling for a STM32 I've found that no compiler flags are passed during compiler testing on several releases of Ubuntu but I have no issues on Fedora. In both cases build flags are
shown in the log but on Ubuntu they are not used... Since it errors out on Ubuntu I have both CMakeOutput.log and CmakeError.log:

CmakeOutput.log:

The target system is: Generic - 1 - arm
The host system is: Linux - 4.15.0-32-generic - x86_64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /usr/bin/arm-none-eabi-gcc
Build flags: ;-Wall;-std=gnu11;-mlittle-endian;-mthumb;-mthumb-interwork;-nostartfiles;-mcpu=cortex-m4;-fsingle-precision-constant;-Wdouble-promotion;-mfpu=fpv4-sp-d16;-mfloat-abi=hard;-D__FPU_PRESENT=1;-D__FPU_USED=1;--specs=nosys.specs
Id flags:

The output was:
0
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000008000

Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"

The C compiler identification is GNU, found in "/home/richard/build/stm32/CMakeFiles/3.10.2/CompilerIdC/a.out"

CmakeError.log:

Determining if the C compiler works failed with the following output:
Change Dir: /home/richard/build/stm32/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_e5a38/fast"
/usr/bin/make -f CMakeFiles/cmTC_e5a38.dir/build.make CMakeFiles/cmTC_e5a38.dir/build
make[1]: Entering directory '/home/richard/build/stm32/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_e5a38.dir/testCCompiler.c.obj
/usr/bin/arm-none-eabi-gcc -o CMakeFiles/cmTC_e5a38.dir/testCCompiler.c.obj -c /home/richard/build/stm32/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_e5a38
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_e5a38.dir/link.txt --verbose=1
/usr/bin/arm-none-eabi-gcc CMakeFiles/cmTC_e5a38.dir/testCCompiler.c.obj -o cmTC_e5a38
/usr/lib/gcc/arm-none-eabi/6.3.1/../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): In function `exit':
/build/newlib-8gJlYR/newlib-2.4.0.20160527/build/arm-none-eabi/newlib/libc/stdlib/../../../../../newlib/libc/stdlib/exit.c:70: undefined reference to `_exit'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_e5a38.dir/build.make:97: recipe for target 'cmTC_e5a38' failed
make[1]: *** [cmTC_e5a38] Error 1
make[1]: Leaving directory '/home/richard/build/stm32/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_e5a38/fast' failed
make: *** [cmTC_e5a38/fast] Error 2

On Fedora the build flags are passed to the compiler during compiler testing:

The target system is: Generic - - arm
The host system is: Linux - 4.17.12-200.fc28.x86_64 - x86_64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /usr/lib64/ccache/arm-none-eabi-gcc
Build flags: ;-Wall;-std=gnu11;-mlittle-endian;-mthumb;-mthumb-interwork;-nostartfiles;-mcpu=cortex-m4;-fsingle-precision-constant;-Wdouble-promotion;-mfpu=fpv4-sp-d16;-mfloat-abi=hard;-D__FPU_PRESENT=1;-D__FPU_USED=1;--specs=nosys.specs
Id flags:

The output was:
0
/usr/lib/gcc/arm-none-eabi/7.1.0/../../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000008000

Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"

The C compiler identification is GNU, found in "/home/build/build/stm32/CMakeFiles/3.11.2/CompilerIdC/a.out"

Determining if the C compiler works passed with the following output:
Change Dir: /home/build/build/stm32/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/gmake" "cmTC_e050e/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_e050e.dir/build.make CMakeFiles/cmTC_e050e.dir/build
gmake[1]: Entering directory '/home/build/build/stm32/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_e050e.dir/testCCompiler.c.obj
/usr/lib64/ccache/arm-none-eabi-gcc -Wall -std=gnu11 -mlittle-endian -mthumb -mthumb-interwork -nostartfiles -mcpu=cortex-m4 -fsingle-precision-constant -Wdouble-promotion -mfpu=fpv4-sp-d16 -mfloat-abi=hard -D__FPU_PRESENT=1 -D__FPU_USED=1 --specs=nosys.specs -o CMakeFiles/cmTC_e050e.dir/testCCompiler.c.obj -c /home/build/build/stm32/CMakeFiles/CMakeTmp/testCCompiler.c
Linking C executable cmTC_e050e
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_e050e.dir/link.txt --verbose=1
/usr/lib64/ccache/arm-none-eabi-gcc -Wall -std=gnu11 -mlittle-endian -mthumb -mthumb-interwork -nostartfiles -mcpu=cortex-m4 -fsingle-precision-constant -Wdouble-promotion -mfpu=fpv4-sp-d16 -mfloat-abi=hard -D__FPU_PRESENT=1 -D__FPU_USED=1 --specs=nosys.specs CMakeFiles/cmTC_e050e.dir/testCCompiler.c.obj -o cmTC_e050e
/usr/lib/gcc/arm-none-eabi/7.1.0/../../../../arm-none-eabi/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000008000
gmake[1]: Leaving directory '/home/build/build/stm32/CMakeFiles/CMakeTmp'

I have reproduced this on Ubuntu 18 but have reports from other developers on version 14 and 17.

Cmake version on Ubuntu Bionic: 3.10.2
on Fedora 28: 3.11.2

Revision history for this message
Gianfranco Costamagna (costamagnagianfranco) wrote :

please tell me all the steps (including dependencies and a test-case) to reproduce the issue.

Also the Ubuntu version and architecture.

Changed in cmake (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for cmake (Ubuntu) because there has been no activity for 60 days.]

Changed in cmake (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.