Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 18.04 compile error at x84 idle.c #574

Closed
HHPLow opened this issue Sep 13, 2021 · 5 comments
Closed

Ubuntu 18.04 compile error at x84 idle.c #574

HHPLow opened this issue Sep 13, 2021 · 5 comments

Comments

@HHPLow
Copy link
Contributor

HHPLow commented Sep 13, 2021

Hi @cl91 @lsf37
When I following the seL4 doc to build Stand-alone seL4 and seL4test
Will meet compile error like below

seL4_build# ninja kernel.elf
[33/34] Building C object CMakeFiles/kernel.elf.dir/kernel_all.c.obj
FAILED: CMakeFiles/kernel.elf.dir/kernel_all.c.obj
/usr/bin/ccache /usr/bin/gcc --sysroot=/ws/seL4_build  -I/ws/seL4/include -I/ws/seL4/include/64 -I/ws/seL4/include/arch/x86 -I/ws/seL4/include/arch/x86/arch/64 -I/ws/seL4/include/plat/pc99 -I/ws/seL4/include/plat/pc99/plat/64 -I/ws/seL4/libsel4/include -I/ws/seL4/libsel4/arch_include/x86 -I/ws/seL4/libsel4/sel4_arch_include/x86_64 -I/ws/seL4/libsel4/sel4_plat_include/pc99 -I/ws/seL4/libsel4/mode_include/64 -I/ws/seL4_build/gen_config -I/ws/seL4_build/autoconf -I/ws/seL4_build/gen_headers -I/ws/seL4_build/generated -m64  -march=nehalem -D__KERNEL_64__ -O3 -DNDEBUG -nostdinc -nostdlib -O2 -DHAVE_AUTOCONF -mcmodel=kernel -fno-pic -fno-pie -fno-stack-protector -fno-asynchronous-unwind-tables -std=c99 -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wmissing-declarations -Wundef -Wpointer-arith -Wno-nonnull -ffreestanding -fno-common -mno-mmx -mno-sse -mno-sse2 -mno-3dnow -MD -MT CMakeFiles/kernel.elf.dir/kernel_all.c.obj -MF CMakeFiles/kernel.elf.dir/kernel_all.c.obj.d -o CMakeFiles/kernel.elf.dir/kernel_all.c.obj -c /ws/seL4_build/kernel_all.c
/ws/seL4/src/arch/x86/idle.c:17:1: error: ‘naked’ attribute directive ignored [-Werror=attributes]
 {
 ^
/ws/seL4/src/arch/x86/idle.c: In function ‘idle_thread’:
/ws/seL4/src/arch/x86/idle.c:25:1: error: ‘noreturn’ function does return [-Werror]
 }
 ^
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.

When I remove the NORETURN, still error

seL4_build# ninja kernel.elf
[21/22] Building C object CMakeFiles/kernel.elf.dir/kernel_all.c.obj
FAILED: CMakeFiles/kernel.elf.dir/kernel_all.c.obj
/usr/bin/ccache /usr/bin/gcc --sysroot=/ws/seL4_build  -I/ws/seL4/include -I/ws/seL4/include/64 -I/ws/seL4/include/arch/x86 -I/ws/seL4/include/arch/x86/arch/64 -I/ws/seL4/include/plat/pc99 -I/ws/seL4/include/plat/pc99/plat/64 -I/ws/seL4/libsel4/include -I/ws/seL4/libsel4/arch_include/x86 -I/ws/seL4/libsel4/sel4_arch_include/x86_64 -I/ws/seL4/libsel4/sel4_plat_include/pc99 -I/ws/seL4/libsel4/mode_include/64 -I/ws/seL4_build/gen_config -I/ws/seL4_build/autoconf -I/ws/seL4_build/gen_headers -I/ws/seL4_build/generated -m64  -march=nehalem -D__KERNEL_64__ -O3 -DNDEBUG -nostdinc -nostdlib -O2 -DHAVE_AUTOCONF -mcmodel=kernel -fno-pic -fno-pie -fno-stack-protector -fno-asynchronous-unwind-tables -std=c99 -Wall -Werror -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wmissing-declarations -Wundef -Wpointer-arith -Wno-nonnull -ffreestanding -fno-common -mno-mmx -mno-sse -mno-sse2 -mno-3dnow -MD -MT CMakeFiles/kernel.elf.dir/kernel_all.c.obj -MF CMakeFiles/kernel.elf.dir/kernel_all.c.obj.d -o CMakeFiles/kernel.elf.dir/kernel_all.c.obj -c /ws/seL4_build/kernel_all.c
/ws/seL4/src/arch/x86/idle.c:17:1: error: ‘naked’ attribute directive ignored [-Werror=attributes]
 {
 ^
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.

until I change this file to

diff --git a/src/arch/x86/idle.c b/src/arch/x86/idle.c
index 82bd30b6..c0a8cc88 100644
--- a/src/arch/x86/idle.c
+++ b/src/arch/x86/idle.c
@@ -13,7 +13,7 @@
  * always eliminates the function prologue by declaring the
  * idle_thread with the naked attribute.
  */
-__attribute__((naked)) NORETURN void idle_thread(void)
+void idle_thread(void)
 {
     /* We cannot use for-loop or while-loop here because they may
      * involve stack manipulations (the compiler will not allow

Is there something wrong with my toolchain?

Thanks

@HHPLow
Copy link
Contributor Author

HHPLow commented Sep 13, 2021

gcc version @lsf37

# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)

@lsf37
Copy link
Member

lsf37 commented Sep 13, 2021

Yes, 7.5 is likely too old, you'll need at least GCC 8. Version 10 should also work.

@HHPLow
Copy link
Contributor Author

HHPLow commented Sep 13, 2021

Ok thanks~

may have another problem, seL4 doc is too old

at https://docs.sel4.systems/projects/buildsystem/host-dependencies.html
Base Build Dependencies show need Ubuntu 18.04 LTS

And Ubuntu 18.04 GCC is 7.5

Or can we add GCC version check to CMakeLists.txt to avoid such things ?
Thanks.

@lsf37
Copy link
Member

lsf37 commented Sep 13, 2021

at https://docs.sel4.systems/projects/buildsystem/host-dependencies.html
Base Build Dependencies show need Ubuntu 18.04 LTS

You're right, that is out of date and should be updated. We're in the process of updating the docker images to the current Debian stable release that came out recently, and I had the host dependency update scheduled for after that (updating to Ubuntu 20 and current Debian stable).

Or can we add GCC version check to CMakeLists.txt to avoid such things ?

That is a good idea. I'll open an issue for it.

@HHPLow
Copy link
Contributor Author

HHPLow commented Sep 13, 2021

Ok thanks for your work~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants