How to use Arduino-Makefile with Sparkfun Pro Micro? - linux

So, I am using Arduino-Makefile (https://github.com/sudar/Arduino-Makefile) and trying to program a 5V 16MHz Sparkfun Pro Micro (https://www.sparkfun.com/products/12640).
I am using the versions of the Arduino libraries and Arduino-Makefile in the repository of the Linux distro I am using (Linux Mint 17.2). These versions are 1.0.5 and 1.3.1 respectively.
My file structure looks like this:
<project-root>/
sparkfun/
... Sparkfun Arduino Addon Files (https://github.com/sparkfun/SF32u4_boards/)
src/
Makefile
test.ino
My test.ino is taken directly from here: https://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide#example-1-blinkies and looks like this:
/* Pro Micro Test Code
by: Nathan Seidle
modified by: Jim Lindblom
SparkFun Electronics
date: September 16, 2013
license: Public Domain - please use this code however you'd like.
It's provided as a learning tool.
This code is provided to show how to control the SparkFun
ProMicro's TX and RX LEDs within a sketch. It also serves
to explain the difference between Serial.print() and
Serial1.print().
*/
int RXLED = 17; // The RX LED has a defined Arduino pin
// The TX LED was not so lucky, we'll need to use pre-defined
// macros (TXLED1, TXLED0) to control that.
// (We could use the same macros for the RX LED too -- RXLED1,
// and RXLED0.)
void setup()
{
pinMode(RXLED, OUTPUT); // Set RX LED as an output
// TX LED is set as an output behind the scenes
Serial.begin(9600); //This pipes to the serial monitor
Serial1.begin(9600); //This is the UART, pipes to sensors attached to board
}
void loop()
{
Serial.println("Hello world"); // Print "Hello World" to the Serial Monitor
Serial1.println("Hello!"); // Print "Hello!" over hardware UART
digitalWrite(RXLED, LOW); // set the LED on
TXLED0; //TX LED is not tied to a normally controlled pin
delay(1000); // wait for a second
digitalWrite(RXLED, HIGH); // set the LED off
TXLED1;
delay(1000); // wait for a second
}
My Makefile, which is very short yet embarrassingly messy, looks like this:
MONITOR_PORT = /dev/ttyACM0
CPPFLAGS += -std=c++11 -I$(realpath ../sparkfun/avr/variants/promicro) -w -DUSB_VID=6991 -DUSB_PID=37381
# --- sparkfun pro micro
BOARD_TAG = promicro16
ALTERNATE_CORE = $(realpath ../sparkfun/avr)
ARDUINO_VAR_PATH = $(realpath ../sparkfun/avr/bootloaders)
BOARDS_TXT = $(realpath ../sparkfun/avr/boards.txt)
BOOTLOADER_PARENT = $(realpath ../sparkfun/avr/bootloaders)
BOOTLOADER_PATH = caterina
BOOTLOADER_FILE = Caterina-promicro16.hex
ISP_PROG = usbasp
USER_LIB_PATH := $(realpath ../lib)
include /usr/share/arduino/Arduino.mk
Everything builds fine, but the programmer complains when I try a make upload. The Pro Micro is /dev/ttyACM0, which I have confirmed by doing an ls /dev/tty* with the device both plugged in and not plugged in and comparing the outputs.
Here is the result of a straight up make:
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = LINUX
- [COMPUTED] ARDMK_DIR = /usr/share/arduino (relative to Common.mk)
- [AUTODETECTED] ARDUINO_DIR = /usr/share/arduino
- [AUTODETECTED] ARDUINO_VERSION = 105
- [DEFAULT] ARDUINO_SKETCHBOOK = /home/kota/sketchbook
- [BUNDLED] AVR_TOOLS_DIR = /usr/share/arduino/hardware/tools/avr (in Arduino distribution)
- [COMPUTED] ARDUINO_LIB_PATH = /usr/share/arduino/libraries (from ARDUINO_DIR)
- [DEFAULT] ARDUINO_CORE_PATH = /usr/share/arduino/hardware/arduino/cores/arduino
- [USER] ALTERNATE_CORE = /home/kota/Projects/tinyIMU/arduino/sparkfun/avr
- [COMPUTED] ALTERNATE_CORE_PATH = /home/kota/sketchbook/hardware//home/kota/Projects/tinyIMU/arduino/sparkfun/avr (from ARDUINO_SKETCHBOOK and ALTERNATE_CORE)
- [DEFAULT] USER_LIB_PATH = /home/kota/sketchbook/libraries (in user sketchbook)
- [USER] BOARD_TAG = promicro16
- [COMPUTED] OBJDIR = build-promicro16 (from BOARD_TAG)
- [ASSUMED] MONITOR_BAUDRATE = 9600
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [DEFAULT] MCU_FLAG_NAME = mmcu
- [DEFAULT] CFLAGS_STD = -std=gnu99
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
- [USER] BOOTLOADER_PARENT = /home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders
-------------------------
mkdir -p build-promicro16
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -x c++ -include Arduino.h -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions tinyimu.ino -o build-promicro16/tinyimu.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os /usr/share/arduino/hardware/arduino/cores/arduino/WInterrupts.c -o build-promicro16/WInterrupts.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os /usr/share/arduino/hardware/arduino/cores/arduino/wiring_analog.c -o build-promicro16/wiring_analog.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os /usr/share/arduino/hardware/arduino/cores/arduino/wiring.c -o build-promicro16/wiring.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os /usr/share/arduino/hardware/arduino/cores/arduino/wiring_digital.c -o build-promicro16/wiring_digital.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os /usr/share/arduino/hardware/arduino/cores/arduino/wiring_pulse.c -o build-promicro16/wiring_pulse.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os /usr/share/arduino/hardware/arduino/cores/arduino/wiring_shift.c -o build-promicro16/wiring_shift.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/CDC.cpp -o build-promicro16/CDC.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/HardwareSerial.cpp -o build-promicro16/HardwareSerial.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/HID.cpp -o build-promicro16/HID.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/IPAddress.cpp -o build-promicro16/IPAddress.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/main.cpp -o build-promicro16/main.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/new.cpp -o build-promicro16/new.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/Print.cpp -o build-promicro16/Print.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/Stream.cpp -o build-promicro16/Stream.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/Tone.cpp -o build-promicro16/Tone.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/USBCore.cpp -o build-promicro16/USBCore.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/WMath.cpp -o build-promicro16/WMath.o
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -MMD -c -std=c++11 -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/variants/promicro -w -DUSB_VID=6991 -DUSB_PID=37381 -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=105 -I. -I/usr/share/arduino/hardware/arduino/cores/arduino -I/home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders/promicro -Wall -ffunction-sections -fdata-sections -Os -fno-exceptions /usr/share/arduino/hardware/arduino/cores/arduino/WString.cpp -o build-promicro16/WString.o
/usr/share/arduino/hardware/tools/avr/bin/avr-ar rcs build-promicro16/libcore.a build-promicro16/WInterrupts.o build-promicro16/wiring_analog.o build-promicro16/wiring.o build-promicro16/wiring_digital.o build-promicro16/wiring_pulse.o build-promicro16/wiring_shift.o build-promicro16/CDC.o build-promicro16/HardwareSerial.o build-promicro16/HID.o build-promicro16/IPAddress.o build-promicro16/main.o build-promicro16/new.o build-promicro16/Print.o build-promicro16/Stream.o build-promicro16/Tone.o build-promicro16/USBCore.o build-promicro16/WMath.o build-promicro16/WString.o
/usr/share/arduino/hardware/tools/avr/bin/avr-gcc -mmcu=atmega32u4 -Wl,--gc-sections -Os -o build-promicro16/src.elf build-promicro16/tinyimu.o build-promicro16/libcore.a -lc -lm
/usr/share/arduino/hardware/tools/avr/bin/avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O ihex build-promicro16/src.elf build-promicro16/src.eep
/usr/share/arduino/hardware/tools/avr/bin/avr-objcopy: --change-section-lma .eeprom=0x0000000000000000 never used
/usr/share/arduino/hardware/tools/avr/bin/avr-objcopy -O ihex -R .eeprom build-promicro16/src.elf build-promicro16/src.hex
/usr/share/arduino/hardware/tools/avr/bin/avr-size --mcu=atmega32u4 -C --format=avr build-promicro16/src.elf
AVR Memory Usage
----------------
Device: atmega32u4
Program: 4808 bytes (14.7% Full)
(.text + .data + .bootloader)
Data: 163 bytes (6.4% Full)
(.data + .bss + .noinit)
and the output of make upload:
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = LINUX
- [COMPUTED] ARDMK_DIR = /usr/share/arduino (relative to Common.mk)
- [AUTODETECTED] ARDUINO_DIR = /usr/share/arduino
- [AUTODETECTED] ARDUINO_VERSION = 105
- [DEFAULT] ARDUINO_SKETCHBOOK = /home/kota/sketchbook
- [BUNDLED] AVR_TOOLS_DIR = /usr/share/arduino/hardware/tools/avr (in Arduino distribution)
- [COMPUTED] ARDUINO_LIB_PATH = /usr/share/arduino/libraries (from ARDUINO_DIR)
- [DEFAULT] ARDUINO_CORE_PATH = /usr/share/arduino/hardware/arduino/cores/arduino
- [USER] ALTERNATE_CORE = /home/kota/Projects/tinyIMU/arduino/sparkfun/avr
- [COMPUTED] ALTERNATE_CORE_PATH = /home/kota/sketchbook/hardware//home/kota/Projects/tinyIMU/arduino/sparkfun/avr (from ARDUINO_SKETCHBOOK and ALTERNATE_CORE)
- [DEFAULT] USER_LIB_PATH = /home/kota/sketchbook/libraries (in user sketchbook)
- [USER] BOARD_TAG = promicro16
- [COMPUTED] OBJDIR = build-promicro16 (from BOARD_TAG)
- [ASSUMED] MONITOR_BAUDRATE = 9600
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [DEFAULT] MCU_FLAG_NAME = mmcu
- [DEFAULT] CFLAGS_STD = -std=gnu99
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
- [USER] BOOTLOADER_PARENT = /home/kota/Projects/tinyIMU/arduino/sparkfun/avr/bootloaders
-------------------------
make reset
make[1]: Entering directory `/home/kota/Projects/tinyIMU/arduino/src'
/usr/bin/ard-reset-arduino /dev/ttyACM0
make[1]: Leaving directory `/home/kota/Projects/tinyIMU/arduino/src'
make do_upload
make[1]: Entering directory `/home/kota/Projects/tinyIMU/arduino/src'
/usr/share/arduino/hardware/tools/avr/../avrdude -q -V -D -p atmega32u4 -C /usr/share/arduino/hardware/tools/avr/../avrdude.conf -c avr109 -b 57600 -P /dev/ttyACM0 \
-U flash:w:build-promicro16/src.hex:i
Connecting to programmer: .avrdude: butterfly_recv(): programmer is not responding
make[1]: *** [do_upload] Error 1
make[1]: Leaving directory `/home/kota/Projects/tinyIMU/arduino/src'
make: *** [upload] Error 2
Now, because of the error, I figure it's something wrong with my configuration of the bootloader, but I am unsure. Maybe the programmer setting is wrong? I would appreciate any help! :)

Here's what worked for me.
First, go to the hardware folder in your Arduino sketchbook or create it if it does not exist. Then extract the sparkfun addon files into the hardware folder. Your directory structure should look something like this:$SKETCHBOOK_DIR/hardware/sparkfun/avr/.
Then in your project directory use this makefile:
BOARD_TAG = promicro16
ALTERNATE_CORE = sparkfun
ARDUINO_DIR = /usr/share/arduino
include $(ARDUINO_DIR)/Arduino.mk
upload2:
avrdude -p atmega32u4 -P /dev/ttyACM0 -c avr109 -U flash:w:build-$(BOARD_TAG)/$(TARGET).hex
Then you should be able to run make and make upload. However, if your code does something that disables or overrides the default USB behaviour on the pro-micro, then Arduino-mk will not be able to reset the pro-micro into bootloader mode over USB. Instead short the GND and RESET pins twice to get into bootloader mode. Then make upload2 flash the pro-micro (Note: the pro-micro only stays in bootloader mode for 8 seconds).

Related

Syntax error compiling tensorflow lite in Jetson Nano

I have been following the guide at https://www.tensorflow.org/lite/guide/build_arm in an attempt to compile TfLite for a Nvidia Jetson Nano. Following the instructions for the c++ install, I've installed Bazel and proceeded to build, only to get the following error:
ERROR: /home/user/tensorflow/tensorflow_src/tensorflow/lite/kernels/internal/BUILD:857:11: Compiling tensorflow/lite/kernels/internal/mfcc.cc failed: (Exit 2): aarch64-linux-gnu-gcc failed: error executing command
(cd /home/user/.cache/bazel/_bazel_user/d40cf1f049552d54fe67262adae8a272/execroot/org_tensorflow && \
exec env - \
PATH=/home/user/.cache/bazelisk/downloads/bazelbuild/bazel-5.3.0-linux-arm64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin \
PWD=/proc/self/cwd \
TF2_BEHAVIOR=1 \
/home/user/.cache/bazel/_bazel_user/d40cf1f049552d54fe67262adae8a272/external/aarch64_linux_toolchain/bin/aarch64-linux-gnu-gcc -fstack-protector -g0 -O2 -DNDEBUG -ffunction-sections -fdata-sections -isystem /home/user/.cache/bazel/_bazel_user/d40cf1f049552d54fe67262adae8a272/external/aarch64_linux_toolchain/lib/gcc/aarch64-linux-gnu/8.3.0/include -isystem /home/user/.cache/bazel/_bazel_user/d40cf1f049552d54fe67262adae8a272/external/aarch64_linux_toolchain/lib/gcc/aarch64-linux-gnu/8.3.0/include-fixed -isystem /home/user/.cache/bazel/_bazel_user/d40cf1f049552d54fe67262adae8a272/external/aarch64_linux_toolchain/aarch64-linux-gnu/include/c++/8.3.0/ -isystem /home/user/.cache/bazel/_bazel_user/d40cf1f049552d54fe67262adae8a272/external/aarch64_linux_toolchain/aarch64-linux-gnu/libc/usr/include/ -isystem /usr/include/python3.5 -isystem /usr/include/ -MD -MF bazel-out/aarch64-opt/bin/tensorflow/lite/kernels/internal/_objs/audio_utils/mfcc.pic.d '-frandom-seed=bazel-out/aarch64-opt/bin/tensorflow/lite/kernels/internal/_objs/audio_utils/mfcc.pic.o' -fPIC -iquote . -iquote bazel-out/aarch64-opt/bin -iquote external/fft2d -iquote bazel-out/aarch64-opt/bin/external/fft2d -Wno-all -Wno-extra -Wno-deprecated -Wno-deprecated-declarations -Wno-ignored-attributes -Wno-unknown-warning -Wno-array-parameter -Wno-stringop-overflow -Wno-array-bounds -Wunused-result '-Werror=unused-result' -DAUTOLOAD_DYNAMIC_KERNELS '-std=c++17' -DFARMHASH_NO_CXX_STRING -Wno-sign-compare -O3 -fno-exceptions -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -no-canonical-prefixes -fno-canonical-system-headers -c tensorflow/lite/kernels/internal/mfcc.cc -o bazel-out/aarch64-opt/bin/tensorflow/lite/kernels/internal/_objs/audio_utils/mfcc.pic.o)
# Configuration: ab27fd0d011bfd59c6f8c4ad9e07f710413fd94d9d706bfa323f3377eb0d533e
# Execution platform: #local_execution_config_platform//:platform
/home/user/.cache/bazel/_bazel_user/d40cf1f049552d54fe67262adae8a272/external/aarch64_linux_toolchain/bin/aarch64-linux-gnu-gcc: 1: /home/user/.cache/bazel/_bazel_user/d40cf1f049552d54fe67262adae8a272/external/aarch64_linux_toolchain/bin/aarch64-linux-gnu-gcc: Syntax error: "(" unexpected
Checking the file where it exploded, this seems to be the line in question
# Audio support classes imported directly from TensorFlow.
cc_library(
name = "audio_utils",
srcs = [
"mfcc.cc",
"mfcc_dct.cc",
"mfcc_mel_filterbank.cc",
"spectrogram.cc",
],
hdrs = [
"mfcc.h",
"mfcc_dct.h",
"mfcc_mel_filterbank.h",
"spectrogram.h",
],
compatible_with = get_compatible_with_portable(),
copts = tflite_copts(),
deps = [
"//third_party/fft2d:fft2d_headers",
"#fft2d",
],
)
But I have no idea why it would have an issue here in particular.
This is an otherwise clean OS install. Any idea what might be causing this?

Systemd fails to compile on arm environment

Im trying to compile systemd in a qemu chroot environment.
The environment is built with cross compiler and using gcc 11.2.
I have tried with systemd 249, 247 and 246.
They all gives the same error.
meson is succeeded and the options is:
meson --prefix=/usr --sysconfdir=/etc --localstatedir=/var --buildtype=release -Dblkid=true -Ddefault-dnssec=no -Dfirstboot=false -Dinstall-tests=false -Dldconfig=false -Dman=false -Dsysusers=false -Drpmmacrosdir=no -Db_lto=false -Dhomed=false -Duserdb=false -Dmode=release -Dpamconfdir=/etc/pam.d -Defi=false -Dgnu-efi=false -Dtpm=false
When running ninja it complains about assert.
Here are some of the failed:
[13/1524] Compiling C object src/udev/ata_id.p/ata_id_ata_id.c.o
FAILED: src/udev/ata_id.p/ata_id_ata_id.c.o
cc -Isrc/udev/ata_id.p -Isrc/udev -I../src/udev -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I. -I.. -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu99 -O3 -Wno-format-signedness -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-result -Wdate-time -Wendif-labels -Werror=format=2 -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=overflow -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wwrite-strings -Wno-maybe-uninitialized -Werror=missing-declarations -Werror=missing-prototypes -fdiagnostics-show-option -ffast-math -fno-common -fno-strict-aliasing -fstack-protector -fstack-protector-strong -fvisibility=hidden --param=ssp-buffer-size=4 -ffunction-sections -fdata-sections -Werror=shadow -include config.h -MD -MQ src/udev/ata_id.p/ata_id_ata_id.c.o -MF src/udev/ata_id.p/ata_id_ata_id.c.o.d -o src/udev/ata_id.p/ata_id_ata_id.c.o -c ../src/udev/ata_id/ata_id.c
In file included from ../src/basic/macro.h:4,
from ../src/basic/fd-util.h:9,
from ../src/udev/ata_id/ata_id.c:27:
../src/fundamental/macro-fundamental.h:38:9: error: static assertion failed: "STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1"
38 | static_assert(expr, #expr)
| ^~~~~~~~~~~~~
../src/basic/log.h:65:1: note: in expansion of macro 'assert_cc'
65 | assert_cc(STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1)
| ^~~~~~~~~
[14/1524] Compiling C object src/core/libcore.a.p/dbus-device.c.o
FAILED: src/core/libcore.a.p/dbus-device.c.o
cc -Isrc/core/libcore.a.p -Isrc/core -I../src/core -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I. -I.. -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -I/usr/include/libmount -I/usr/include/blkid -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu99 -O3 -Wno-format-signedness -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-result -Wdate-time -Wendif-labels -Werror=format=2 -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=overflow -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wwrite-strings -Wno-maybe-uninitialized -Werror=missing-declarations -Werror=missing-prototypes -fdiagnostics-show-option -ffast-math -fno-common -fno-strict-aliasing -fstack-protector -fstack-protector-strong -fvisibility=hidden --param=ssp-buffer-size=4 -ffunction-sections -fdata-sections -Werror=shadow -include config.h -fPIC -pthread -MD -MQ src/core/libcore.a.p/dbus-device.c.o -MF src/core/libcore.a.p/dbus-device.c.o.d -o src/core/libcore.a.p/dbus-device.c.o -c ../src/core/dbus-device.c
In file included from ../src/basic/macro.h:4,
from ../src/basic/alloc-util.h:9,
from ../src/basic/hash-funcs.h:4,
from ../src/basic/hashmap.h:8,
from ../src/shared/fdset.h:6,
from ../src/shared/bpf-program.h:9,
from ../src/core/unit.h:10,
from ../src/core/device.h:4,
from ../src/core/dbus-device.c:4:
../src/fundamental/macro-fundamental.h:38:9: error: static assertion failed: "STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1"
38 | static_assert(expr, #expr)
| ^~~~~~~~~~~~~
../src/basic/log.h:65:1: note: in expansion of macro 'assert_cc'
65 | assert_cc(STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1);
| ^~~~~~~~~\
[9/1511] Compiling C object src/libsystemd/libsystemd_static.a.p/sd-bus_bus-creds.c.o
FAILED: src/libsystemd/libsystemd_static.a.p/sd-bus_bus-creds.c.o
cc -Isrc/libsystemd/libsystemd_static.a.p -Isrc/libsystemd -I../src/libsystemd -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I. -I.. -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event
-I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu99
-O3 -Wno-format-signedness -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-result -Wdate-time -Wendif-labels -Werror=format=2 -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=overflow -Werror=return-type -Werror=shift-c
ount-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict
-prototypes -Wsuggest-attribute=noreturn -Wwrite-strings -Wno-maybe-uninitialized -Werror=missing-declarations -Werror=missing-prototypes -fdiagnostics-show-option -ffast-math -fno-common -fno-strict-aliasing -fstack-protector -fstack-protector-strong -fvisibility=hidde
n --param=ssp-buffer-size=4 -ffunction-sections -fdata-sections -Werror=shadow -include config.h -fPIC -pthread -fvisibility=default -MD -MQ src/libsystemd/libsystemd_static.a.p/sd-bus_bus-creds.c.o -MF src/libsystemd/libsystemd_static.a.p/sd-bus_bus-creds.c.o.d -o src/
libsystemd/libsystemd_static.a.p/sd-bus_bus-creds.c.o -c ../src/libsystemd/sd-bus/bus-creds.c
In file included from ../src/basic/macro.h:11,
from ../src/basic/alloc-util.h:9,
from ../src/libsystemd/sd-bus/bus-creds.c:6:
../src/fundamental/macro-fundamental.h:42:22: error: size of array 'x' is negative
42 | char x[(expr) ? 0 : -1]; \
| ^
../src/basic/log.h:65:1: note: in expansion of macro 'assert_cc'
65 | assert_cc(STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1);
| ^~~~~~~~~
Im not very experienced in cross compiling and got some info from https://www.linuxfromscratch.org/lfs/view/stable-systemd/ and https://github.com/LeeKyuHyuk/PiCLFS/\
/Mikael
#define RELATIVE_SOURCE_PATH is being set to absolute path.
Changing it to #define RELATIVE_SOURCE_PATH "../" solves the issue

Error when bitbake on meta-browser layer, gn-native package for Yocto zeus

I am trying to generate a Yocto Linux from a Ubuntu 18.04 but run into an error when compiling gn-native from Chromium inside meta-browser layer. As I just add this layer without modifying it, I am a bit lost and error doesn not talk to me much.
> ERROR: gn-native-80.0.3987.132-r0 do_compile: Execution of '/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/temp/run.do_compile.13120'
> failed with exit code 1:
> ninja: Entering directory `/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/chromium-80.0.3987.132/out/Release/gn_build'
> [1/182] CXX base/callback_internal.o
> FAILED: base/callback_internal.o
> clang++ -MMD -MF base/callback_internal.o.d -I../../../tools/gn -I. -isystem/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/recipe-sysroot-native/usr/include -O2 -pipe -DNDEBUG -O3 -fdata-sections -ffunction-sections -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -pthread -pipe -fno-exceptions -fno-rtti -fdiagnostics-color -isystem/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/recipe-sysroot-native/usr/include -O2 -pipe -std=c++17 -c ../../../tools/gn/base/callback_internal.cc -o base/callback_internal.o
> In file included from ../../../tools/gn/base/callback_internal.cc:5:
> In file included from ../../../tools/gn/base/callback_internal.h:13:
> ../../../tools/gn/base/memory/ref_counted.h:10:10: fatal error: 'utility' file not found
> #include <utility>
> ^~~~~~~~~
> 1 error generated.
> [2/182] CXX base/command_line.o
> FAILED: base/command_line.o
> clang++ -MMD -MF base/command_line.o.d -I../../../tools/gn -I. -isystem/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/recipe-sysroot-native/usr/include -O2 -pipe -DNDEBUG -O3 -fdata-sections -ffunction-sections -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -pthread -pipe -fno-exceptions -fno-rtti -fdiagnostics-color -isystem/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/recipe-sysroot-native/usr/include -O2 -pipe -std=c++17 -c ../../../tools/gn/base/command_line.cc -o base/command_line.o
> In file included from ../../../tools/gn/base/command_line.cc:5:
> ../../../tools/gn/base/command_line.h:19:10: fatal error: 'map' file not found
> #include <map>
> ^~~~~
> 1 error generated.
> [3/182] CXX base/environment.o
> FAILED: base/environment.o
> clang++ -MMD -MF base/environment.o.d -I../../../tools/gn -I. -isystem/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/recipe-sysroot-native/usr/include -O2 -pipe -DNDEBUG -O3 -fdata-sections -ffunction-sections -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -pthread -pipe -fno-exceptions -fno-rtti -fdiagnostics-color -isystem/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/recipe-sysroot-native/usr/include -O2 -pipe -std=c++17 -c ../../../tools/gn/base/environment.cc -o base/environment.o
> In file included from ../../../tools/gn/base/environment.cc:5:
> ../../../tools/gn/base/environment.h:8:10: fatal error: 'map' file not found
> #include <map>
> ^~~~~
> 1 error generated.
> [4/182] CXX base/files/file_path_constants.o
> FAILED: base/files/file_path_constants.o
> clang++ -MMD -MF base/files/file_path_constants.o.d -I../../../tools/gn -I. -isystem/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/recipe-sysroot-native/usr/include -O2 -pipe -DNDEBUG -O3 -fdata-sections -ffunction-sections -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -pthread -pipe -fno-exceptions -fno-rtti -fdiagnostics-color -isystem/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/recipe-sysroot-native/usr/include -O2 -pipe -std=c++17 -c ../../../tools/gn/base/files/file_path_constants.cc -o
> base/files/file_path_constants.o
> In file included from ../../../tools/gn/base/files/file_path_constants.cc:7:
> ../../../tools/gn/base/files/file_path.h:107:10: fatal error: 'iosfwd' file not found
> #include <iosfwd>
> ^~~~~~~~
> 1 error generated.
> [5/182] CXX base/files/file.o
> FAILED: base/files/file.o
> clang++ -MMD -MF base/files/file.o.d -I../../../tools/gn -I. -isystem/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/recipe-sysroot-native/usr/include -O2 -pipe -DNDEBUG -O3 -fdata-sections -ffunction-sections -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -pthread -pipe -fno-exceptions -fno-rtti -fdiagnostics-color -isystem/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/recipe-sysroot-native/usr/include -O2 -pipe -std=c++17 -c ../../../tools/gn/base/files/file.cc -o base/files/file.o
> In file included from ../../../tools/gn/base/files/file.cc:5:
> ../../../tools/gn/base/files/file.h:10:10: fatal error: 'string' file not found
> #include <string>
> ^~~~~~~~
> 1 error generated.
> [6/182] CXX base/files/file_path.o
> FAILED: base/files/file_path.o
> clang++ -MMD -MF base/files/file_path.o.d -I../../../tools/gn -I. -isystem/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/recipe-sysroot-native/usr/include -O2 -pipe -DNDEBUG -O3 -fdata-sections -ffunction-sections -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -pthread -pipe -fno-exceptions -fno-rtti -fdiagnostics-color -isystem/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/recipe-sysroot-native/usr/include -O2 -pipe -std=c++17 -c ../../../tools/gn/base/files/file_path.cc -o base/files/file_path.o
> In file included from ../../../tools/gn/base/files/file_path.cc:5:
> ../../../tools/gn/base/files/file_path.h:107:10: fatal error: 'iosfwd' file not found
> #include <iosfwd>
> ^~~~~~~~
> 1 error generated.
> [7/182] CXX base/files/file_enumerator.o
> FAILED: base/files/file_enumerator.o
> clang++ -MMD -MF base/files/file_enumerator.o.d -I../../../tools/gn -I. -isystem/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/recipe-sysroot-native/usr/include -O2 -pipe -DNDEBUG -O3 -fdata-sections -ffunction-sections -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -pthread -pipe -fno-exceptions -fno-rtti -fdiagnostics-color -isystem/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/recipe-sysroot-native/usr/include -O2 -pipe -std=c++17 -c ../../../tools/gn/base/files/file_enumerator.cc -o
> base/files/file_enumerator.o
> In file included from ../../../tools/gn/base/files/file_enumerator.cc:5:
> ../../../tools/gn/base/files/file_enumerator.h:11:10: fatal error: 'vector' file not found
> #include <vector>
> ^~~~~~~~
> 1 error generated.
> ninja: build stopped: subcommand failed.
> Traceback (most recent call last):
> File "/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/chromium-80.0.3987.132/tools/gn/bootstrap/bootstrap.py", line 138, in <module>
> sys.exit(main(sys.argv[1:]))
> File "/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/chromium-80.0.3987.132/tools/gn/bootstrap/bootstrap.py", line 124, in main
> ['ninja', '-C', gn_build_dir, 'gn', '-w', 'dupbuild=err'])
> File "/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/recipe-sysroot-native/usr/lib/python2.7/subprocess.py",
> line 190, in check_call
> raise CalledProcessError(retcode, cmd)
> subprocess.CalledProcessError: Command '['ninja', '-C', '/home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/chromium-80.0.3987.132/out/Release/gn_build', 'gn', '-w', 'dupbuild=err']' returned non-zero exit status 1
> WARNING: exit code 1 from a shell command.
> ERROR: Logfile of failure stored in: /home/tux/yocto-freescale-zeus/build/tmp/work/x86_64-linux/gn-native/80.0.3987.132-r0/temp/log.do_compile.13120
Any help would be greatly appreciated. Thank you!
My fault...
I had to install g++-multilib that was not installed, so basic libraries were not present...
sudo apt install g++-multilib

How to enable signed-integer-overflow UBSan in linux kernel?

As I was configuring the kernel 5.4.0 with:
CONFIG_UBSAN=y
UBSAN_SANITIZE_ALL=y
and -fsanitize=signed-integer-overflow also appeared in gcc command during compilation.
However, in the final vmlinux, __ubsan_handle_add_overflow was in the image,
but never called.
In contrast, other non signed-integer-overflow UBSan handlers e.g.
__ubsan_handle_load_invalid_value, __ubsan_handle_shift_out_of_bounds
were called extensively.
I couldn't find any difference between these 2 types of UBSan throughout
the compilation process.
Is it maybe because the compiler optimization assuming that overflow
should never exist, thus didn't instrument these overflow-related UBSan?
I attached a typical gcc command here in case it might be needed:
cmd_fs/ioctl.o := /home/cm/exp/symslice/syzkaller/gcc/bin/gcc -Wp,-MD,fs/.ioctl.o.d -nostdinc -isystem /home/cm/exp/symslice/syzkaller/gcc/bin/../lib/gcc/x86_64-pc-linux-gnu/8.0.1/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -march=core2 -mno-red-zone -mcmodel=kernel -DCONFIG_X86_X32_ABI -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -Wno-sign-compare -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wimplicit-fallthrough -Wno-unused-const-variable -fomit-frame-pointer -fno-var-tracking-assignments -g -femit-struct-debug-baseonly -fno-var-tracking -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=./= -Wno-packed-not-aligned -fsanitize=kernel-address -fasan-shadow-offset=0xdffffc0000000000 --param asan-globals=1 --param asan-instrumentation-with-call-threshold=10000 --param asan-stack=1 --param asan-instrument-allocas=1 -fsanitize=shift -fsanitize=integer-divide-by-zero -fsanitize=unreachable -fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=object-size -fsanitize=bool -fsanitize=enum -Wno-maybe-uninitialized -fsanitize-coverage=trace-pc -fsanitize-coverage=trace-cmp -DKBUILD_BASENAME='"ioctl"' -DKBUILD_MODNAME='"ioctl"' -c -o fs/ioctl.o fs/ioctl.c
You’re compiling with -fno-strict-overflow, meaning overflow when adding signed numbers is not treated as UB.

Problems building Chromium with ninja on Linux

I'm currently trying to build Chromium on Ubuntu 14.10 with Ninja. I've been encountering a few issues so far I've been able to fix, but I've got problems with this one. I'm at the building state.
ninja: Entering directory `out/Release' [3/18153] CC
obj/third_party/flac/src/libFLAC/libflac.float.o FAILED:
../../third_party/llvm-build/Release+Asserts/bin/clang -MMD -MF
obj/third_party/flac/src/libFLAC/libflac.float.o.d
-DV8_DEPRECATION_WARNINGS -D_FILE_OFFSET_BITS=64 -DCHROMIUM_BUILD -DCR_CLANG_REVISION=223108 -DCOMPONENT_BUILD -DTOOLKIT_VIEWS=1 -DUI_COMPOSITOR_IMAGE_TRANSPORT -DUSE_AURA=1 -DUSE_ASH=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_DEFAULT_RENDER_THEME=1 -DUSE_LIBJPEG_TURBO=1 -DUSE_X11=1 -DUSE_CLIPBOARD_AURAX11=1 -DENABLE_ONE_CLICK_SIGNIN -DENABLE_PRE_SYNC_BACKUP -DENABLE_REMOTING=1 -DENABLE_WEBRTC=1 -DENABLE_PEPPER_CDMS -DENABLE_CONFIGURATION_POLICY -DENABLE_NOTIFICATIONS -DUSE_UDEV -DDONT_EMBED_BUILD_METADATA -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 -DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_BACKGROUND=1 -DENABLE_GOOGLE_NOW=1 -DCLD_VERSION=2 -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1 -DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_APP_LIST=1 -DENABLE_SETTINGS_APP=1 -DENABLE_SUPERVISED_USERS=1 -DENABLE_MDNS=1 -DENABLE_SERVICE_DISCOVERY=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DFLAC__NO_DLL -DFLAC__OVERFLOW_DETECT '-DVERSION="1.2.1"' -DUSE_LIBPCI=1 -DUSE_GLIB=1 -DUSE_NSS=1 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -Igen -I../../third_party/flac/include -I../../third_party/flac/src/libFLAC/include -fstack-protector --param=ssp-buffer-size=4 -Werror -pthread -fno-strict-aliasing -Wno-unused-parameter -Wno-missing-field-initializers -fvisibility=hidden -pipe -fPIC -Wno-reserved-user-defined-literal -Xclang -load -Xclang /home/florent/src/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so
-Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-weak-ptr-factory-order -Xclang -plugin-arg-find-bad-constructs -Xclang strict-virtual-specifiers -momit-leaf-frame-pointer
-mstack-alignment=16 -mstackrealign -fcolor-diagnostics -Wheader-hygiene -Wno-char-subscripts -Wno-unneeded-internal-declaration -Wno-covered-switch-default -Wstring-conversion -Wno-c++11-narrowing -Wno-deprecated-register -Wno-inconsistent-missing-override -Wno-conversion -Wno-format -Wno-unused-result -msse2 -mfpmath=sse -mmmx -m32 -O2 -fno-ident -fdata-sections -ffunction-sections -funwind-tables -c ../../third_party/flac/src/libFLAC/float.c -o
obj/third_party/flac/src/libFLAC/libflac.float.o
../../third_party/llvm-build/Release+Asserts/bin/clang: 1:
../../third_party/llvm-build/Release+Asserts/bin/clang: Syntax error:
")" unexpected [3/18153] CC
obj/third_party/flac/src/libFLAC/libflac.format.o FAILED:
../../third_party/llvm-build/Release+Asserts/bin/clang -MMD -MF
obj/third_party/flac/src/libFLAC/libflac.format.o.d
-DV8_DEPRECATION_WARNINGS -D_FILE_OFFSET_BITS=64 -DCHROMIUM_BUILD -DCR_CLANG_REVISION=223108 -DCOMPONENT_BUILD -DTOOLKIT_VIEWS=1 -DUI_COMPOSITOR_IMAGE_TRANSPORT -DUSE_AURA=1 -DUSE_ASH=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_DEFAULT_RENDER_THEME=1 -DUSE_LIBJPEG_TURBO=1 -DUSE_X11=1 -DUSE_CLIPBOARD_AURAX11=1 -DENABLE_ONE_CLICK_SIGNIN -DENABLE_PRE_SYNC_BACKUP -DENABLE_REMOTING=1 -DENABLE_WEBRTC=1 -DENABLE_PEPPER_CDMS -DENABLE_CONFIGURATION_POLICY -DENABLE_NOTIFICATIONS -DUSE_UDEV -DDONT_EMBED_BUILD_METADATA -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 -DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_BACKGROUND=1 -DENABLE_GOOGLE_NOW=1 -DCLD_VERSION=2 -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1 -DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_APP_LIST=1 -DENABLE_SETTINGS_APP=1 -DENABLE_SUPERVISED_USERS=1 -DENABLE_MDNS=1 -DENABLE_SERVICE_DISCOVERY=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DFLAC__NO_DLL -DFLAC__OVERFLOW_DETECT '-DVERSION="1.2.1"' -DUSE_LIBPCI=1 -DUSE_GLIB=1 -DUSE_NSS=1 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -Igen -I../../third_party/flac/include -I../../third_party/flac/src/libFLAC/include -fstack-protector --param=ssp-buffer-size=4 -Werror -pthread -fno-strict-aliasing -Wno-unused-parameter -Wno-missing-field-initializers -fvisibility=hidden -pipe -fPIC -Wno-reserved-user-defined-literal -Xclang -load -Xclang /home/florent/src/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so
-Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-weak-ptr-factory-order -Xclang -plugin-arg-find-bad-constructs -Xclang strict-virtual-specifiers -momit-leaf-frame-pointer
-mstack-alignment=16 -mstackrealign -fcolor-diagnostics -Wheader-hygiene -Wno-char-subscripts -Wno-unneeded-internal-declaration -Wno-covered-switch-default -Wstring-conversion -Wno-c++11-narrowing -Wno-deprecated-register -Wno-inconsistent-missing-override -Wno-conversion -Wno-format -Wno-unused-result -msse2 -mfpmath=sse -mmmx -m32 -O2 -fno-ident -fdata-sections -ffunction-sections -funwind-tables -c ../../third_party/flac/src/libFLAC/format.c -o
obj/third_party/flac/src/libFLAC/libflac.format.o
../../third_party/llvm-build/Release+Asserts/bin/clang: 1:
../../third_party/llvm-build/Release+Asserts/bin/clang: Syntax error:
")" unexpected [3/18153] CC
obj/third_party/flac/src/libFLAC/libflac.bitmath.o FAILED:
../../third_party/llvm-build/Release+Asserts/bin/clang -MMD -MF
obj/third_party/flac/src/libFLAC/libflac.bitmath.o.d
-DV8_DEPRECATION_WARNINGS -D_FILE_OFFSET_BITS=64 -DCHROMIUM_BUILD -DCR_CLANG_REVISION=223108 -DCOMPONENT_BUILD -DTOOLKIT_VIEWS=1 -DUI_COMPOSITOR_IMAGE_TRANSPORT -DUSE_AURA=1 -DUSE_ASH=1 -DUSE_PANGO=1 -DUSE_CAIRO=1 -DUSE_DEFAULT_RENDER_THEME=1 -DUSE_LIBJPEG_TURBO=1 -DUSE_X11=1 -DUSE_CLIPBOARD_AURAX11=1 -DENABLE_ONE_CLICK_SIGNIN -DENABLE_PRE_SYNC_BACKUP -DENABLE_REMOTING=1 -DENABLE_WEBRTC=1 -DENABLE_PEPPER_CDMS -DENABLE_CONFIGURATION_POLICY -DENABLE_NOTIFICATIONS -DUSE_UDEV -DDONT_EMBED_BUILD_METADATA -DENABLE_TASK_MANAGER=1 -DENABLE_EXTENSIONS=1 -DENABLE_PLUGINS=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1 -DENABLE_AUTOFILL_DIALOG=1 -DENABLE_BACKGROUND=1 -DENABLE_GOOGLE_NOW=1 -DCLD_VERSION=2 -DENABLE_PRINTING=1 -DENABLE_BASIC_PRINTING=1 -DENABLE_PRINT_PREVIEW=1 -DENABLE_SPELLCHECK=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DENABLE_APP_LIST=1 -DENABLE_SETTINGS_APP=1 -DENABLE_SUPERVISED_USERS=1 -DENABLE_MDNS=1 -DENABLE_SERVICE_DISCOVERY=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DFLAC__NO_DLL -DFLAC__OVERFLOW_DETECT '-DVERSION="1.2.1"' -DUSE_LIBPCI=1 -DUSE_GLIB=1 -DUSE_NSS=1 -DNDEBUG -DNVALGRIND -DDYNAMIC_ANNOTATIONS_ENABLED=0 -Igen -I../../third_party/flac/include -I../../third_party/flac/src/libFLAC/include -fstack-protector --param=ssp-buffer-size=4 -Werror -pthread -fno-strict-aliasing -Wno-unused-parameter -Wno-missing-field-initializers -fvisibility=hidden -pipe -fPIC -Wno-reserved-user-defined-literal -Xclang -load -Xclang /home/florent/src/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.so
-Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang check-weak-ptr-factory-order -Xclang -plugin-arg-find-bad-constructs -Xclang strict-virtual-specifiers -momit-leaf-frame-pointer
-mstack-alignment=16 -mstackrealign -fcolor-diagnostics -Wheader-hygiene -Wno-char-subscripts -Wno-unneeded-internal-declaration -Wno-covered-switch-default -Wstring-conversion -Wno-c++11-narrowing -Wno-deprecated-register -Wno-inconsistent-missing-override -Wno-conversion -Wno-format -Wno-unused-result -msse2 -mfpmath=sse -mmmx -m32 -O2 -fno-ident -fdata-sections -ffunction-sections -funwind-tables -c ../../third_party/flac/src/libFLAC/bitmath.c -o
obj/third_party/flac/src/libFLAC/libflac.bitmath.o
../../third_party/llvm-build/Release+Asserts/bin/clang: 1:
../../third_party/llvm-build/Release+Asserts/bin/clang: Syntax error:
")" unexpected ninja: build stopped: subcommand failed.
So sorry that it is so ugly to look at it!

Resources