Project

General

Profile

Actions

Bug #4687

closed

simtrace2 dpkg fails to build on Ubuntu 20.04

Added by laforge over 3 years ago. Updated about 3 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
07/30/2020
Due date:
% Done:

100%

Spec Reference:

Description

https://build.opensuse.org/package/live_build_log/network:osmocom:nightly/simtrace2/xUbuntu_20.04/x86_64

[  207s]              ram:       11664 B        48 KB     23.73/usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: bin/qmod-dfu-flash.elf section `.text' will not fit in region `rom'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: region `rom' overflowed by 180 bytes
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_USBD_HAL.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_USBD_HAL.o: in function `USBD_IrqHandler':
[  207s] ./firmware/./atmel_softpack_libraries/libchip_sam3s/source/USBD_HAL.c:1229: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0x4): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0x8): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0xc): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0x10): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o:(.rodata.cst4+0x14): warning: more undefined references to `__stack_chk_guard' follow
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o: in function `ComputeLockRange':
[  207s] ./firmware/./atmel_softpack_libraries/libchip_sam3s/source/flashd.c:138: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o: in function `FLASHD_Write':
[  207s] ./firmware/./atmel_softpack_libraries/libchip_sam3s/source/flashd.c:275: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_flashd.o: in function `FLASHD_Unlock':
[  207s] ./firmware/./atmel_softpack_libraries/libchip_sam3s/source/flashd.c:366: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_USBDDriver.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_USBDDriver.o: in function `USBDDriver_RequestHandler':
[  207s] ./firmware/./atmel_softpack_libraries/usb/device/core/USBDDriver.c:672: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0x4): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0x8): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0xc): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0x10): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o:(.rodata.cst4+0x14): warning: more undefined references to `__stack_chk_guard' follow
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o: in function `snprintf':
[  207s] ./firmware/libcommon/source/stdio.c:408: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o: in function `vfprintf':
[  207s] ./firmware/libcommon/source/stdio.c:448: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o: in function `vfprintf_sync':
[  207s] ./firmware/libcommon/source/stdio.c:478: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o: in function `printf':
[  207s] ./firmware/libcommon/source/stdio.c:539: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_stdio.o: in function `printf_sync':
[  207s] ./firmware/libcommon/source/stdio.c:558: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_uart_console.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_uart_console.o:(.rodata.cst4+0x4): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_uart_console.o: in function `UART_Configure':
[  207s] ./firmware/libboard/common/source/uart_console.c:110: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_board_qmod.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_board_qmod.o:(.rodata.cst4+0x4): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_board_qmod.o: in function `board_override_enter_dfu':
[  207s] ./firmware/libboard/qmod/source/board_qmod.c:408: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_main.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_main.o: in function `USBDFU_handle_dnload':
[  207s] ./firmware/apps/dfu/main.c:150: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_dfu_desc.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_dfu_desc.o: in function `set_usb_serial_str':
[  207s] ./firmware/./atmel_softpack_libraries/usb/device/dfu/dfu_desc.c:211: warning: undefined reference to `__stack_chk_fail'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_dfu_driver.o:(.rodata.cst4+0x0): warning: undefined reference to `__stack_chk_guard'
[  207s] /usr/lib/gcc/arm-none-eabi/9.2.1/../../../arm-none-eabi/bin/ld: obj/qmod/flash_dfu_driver.o: in function `handle_getstate':
[  207s] ./firmware/./atmel_softpack_libraries/usb/device/dfu/dfu_driver.c:91: warning: undefined reference to `__stack_chk_fail'
[  207s] collect2: error: ld returned 1 exit status

Intrestingly, the problem does not appear when manually building inside a ubuntu 20.04 lxc container. So it must somehow be related to which compiler flags are used during dpkg builds


Related issues

Related to SIMtrace 2 - Bug #5081: simtrace2 doesn't build for ubuntu 20.04 and 20.10 and debian9Resolvedosmith03/18/2021

Actions
Actions #1

Updated by laforge over 3 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10
Actions #2

Updated by laforge over 3 years ago

export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-stackprotector

in debian/rules works around the problem - but then this means even the host binaries are built without stack smashing protection :/

We would want to enable this selectively for the firmware sub-directory

Actions #3

Updated by laforge over 3 years ago

laforge wrote:

We would want to enable this selectively for the firmware sub-directory

I did try any combinations of export / variable assignments, but I couldn't get dpkg to build the 'firmware' target with different DEB_BUILD_MAINT_OPTIONS than the host utilitites :/

Actions #4

Updated by laforge over 3 years ago

  • Status changed from In Progress to Stalled

I posted the question to the debian-dpkg mailing list

Actions #5

Updated by fixeria over 3 years ago

Hi Harald,

why not to simply add the missing symbols?

The '__stack_chk_guard' is basically a magic value (e.g. 0xdeadbeef), and '__stack_chk_fail' is a user-defined function that will be called if the stack is corrupted. It could basically call osmo_panic().

This code should make the linker happy:

uintptr_t __stack_chk_guard = 0xdeadbeef; // adapt to the word width of your architecture

void __stack_chk_fail(void)
{
  osmo_panic("Stack smashing detected!\n");
}

Best regards,
Vadim.

Actions #6

Updated by laforge over 3 years ago

  • Status changed from Stalled to In Progress
  • % Done changed from 10 to 30

fixeria wrote:

Hi Harald,

why not to simply add the missing symbols?

Thanks a lot for pointing tihs out. I thought we'd have to provide more 'intelligence' than those two simply symbols.

Actions #7

Updated by laforge over 3 years ago

  • % Done changed from 30 to 80
Actions #8

Updated by laforge about 3 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 80 to 100

there's another build failure now on Ubuntu 20.04: The compiler simply creates too large binary code to fit into memory. But this is not what this ticket was about.

Actions #9

Updated by osmith about 3 years ago

  • Related to Bug #5081: simtrace2 doesn't build for ubuntu 20.04 and 20.10 and debian9 added
Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)