Syntax error compiling tensorflow lite in Jetson Nano - linux

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?

Related

ninja: build stopped: subcommand failed when building llvm10 on Fedora 35

I have been trying to build llvm10 from source. I downloaded the source from llvm's github and have been trying for the past few days to complete the build but each and everytime towards the end of the ninja process, the error pops up -ninja: build stopped: subcommand failed
I am using the following commands to build:
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/llvm -DLLVM_ENABLE_PROJECTS=clang -DLLVM_LIBDIR_SUFFIX=64 -DLLVM_TARGETS_TO_BUILD="AMDGPU" -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_PARALLEL_LINK_JOBS=1
Since multiple of my attempts failed, I also tried running by setting the parallel jobs to 1 as many threads recommended. Also did ninja -j1 but none of this helps.
I remember having done this successfully on Fedora 34, so, I reinstalled Fedora 34, but, it too gives me the same error.
This is the portion where the error pops up:
[1/17] Building CXX object utils/bench.../benchmark.dir/benchmark_register.cc.o
FAILED: utils/benchmark/src/CMakeFiles/benchmark.dir/benchmark_register.cc.o
/bin/c++ -DHAVE_POSIX_REGEX -DHAVE_STD_REGEX -DHAVE_STEADY_CLOCK -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/build/utils/benchmark/src -I/home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/utils/benchmark/src -I/usr/include/libxml2 -I/home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/build/include -I/home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/include -I/home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/utils/benchmark/include -I/home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/utils/benchmark/src/../include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -std=c++11 -Wall -Wextra -Wshadow -pedantic -pedantic-errors -Wfloat-equal -fstrict-aliasing -fno-exceptions -Wstrict-aliasing -O3 -DNDEBUG -std=c++14 -MD -MT utils/benchmark/src/CMakeFiles/benchmark.dir/benchmark_register.cc.o -MF utils/benchmark/src/CMakeFiles/benchmark.dir/benchmark_register.cc.o.d -o utils/benchmark/src/CMakeFiles/benchmark.dir/benchmark_register.cc.o -c /home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/utils/benchmark/src/benchmark_register.cc
In file included from /home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/utils/benchmark/src/benchmark_register.cc:15:
/home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/utils/benchmark/src/benchmark_register.h: In function ‘void AddRange(std::vector<T>*, T, T, int)’:
/home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/utils/benchmark/src/benchmark_register.h:17:30: error: ‘numeric_limits’ is not a member of ‘std’
17 | static const T kmax = std::numeric_limits<T>::max();
| ^~~~~~~~~~~~~~
/home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/utils/benchmark/src/benchmark_register.h:17:46: error: expected primary-expression before ‘>’ token
17 | static const T kmax = std::numeric_limits<T>::max();
| ^
/home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/utils/benchmark/src/benchmark_register.h:17:49: error: ‘::max’ has not been declared; did you mean ‘std::max’?
17 | static const T kmax = std::numeric_limits<T>::max();
| ^~~
| std::max
In file included from /usr/include/c++/11/algorithm:62,
from /home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/utils/benchmark/include/benchmark/benchmark.h:175,
from /home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/utils/benchmark/src/internal_macros.h:4,
from /home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/utils/benchmark/src/check.h:8,
from /home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/utils/benchmark/src/benchmark_register.h:6,
from /home/test/Desktop/llvm-project-llvmorg-10.0.0/llvm/utils/benchmark/src/benchmark_register.cc:15:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
3467 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
ninja: build stopped: subcommand failed.
Any help is appreciated.
The header include was missed at that time. You may want to add it by yourself (https://github.com/llvm/llvm-project/commit/b498303066a63a203d24f739b2d2e0e56dca70d1) or use newer version of LLVM ;)

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.

undefined symbol:_ZTVN10__cxxabiv121__vmi_class_type_infoE error

When I run python eval.py, it comes to the error::
ImportError: /home/aa/EAST/lanms/adaptor.so: undefined
symbol:_ZTVN10__cxxabiv121__vmi_class_type_infoE
I uses $make clean && make but it is still give me the same error and with some warring during execute the make
This is the makefile::
CXXFLAGS = -I include -std=c++11 -O3 $(shell python3-config --cflags)
LDFLAGS = $(shell python3-config --ldflags)
DEPS = lanms.h $(shell find include -xtype f)
CXX_SOURCES = adaptor.cpp include/clipper/clipper.cpp
LIB_SO = adaptor.so
$(LIB_SO): $(CXX_SOURCES) $(DEPS)
$(CXX) -o $# $(CXXFLAGS) $(LDFLAGS) $(CXX_SOURCES) --shared -fPIC
clean:
rm -rf $(LIB_SO)
when I use make command it show these warning::
/usr/bin/gcc-7 -o adaptor.so -I include -std=c++11 -O3 -I/home/ashwaq/anaconda3/include/python3.5m -I/home/aa/anaconda3/include/python3.5m -Wno-unused-result -Wsign-compare -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O3 -pipe -flto -fuse-linker-plugin -ffat-lto-objects -DNDEBUG -fwrapv -O3 -Wall -Wstrict-prototypes -L/home/ashwaq/anaconda3/lib/python3.5/config-3.5m -L/home/ashwaq/anaconda3/lib -lpython3.5m -lpthread -ldl -lutil -lrt -lm -Xlinker -export-dynamic adaptor.cpp include/clipper/clipper.cpp --shared -fPIC
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from include/pybind11/pytypes.h:12:0,
from include/pybind11/cast.h:13,
from include/pybind11/attr.h:13,
from include/pybind11/pybind11.h:43,
from adaptor.cpp:1:
adaptor.cpp: In function ‘PyObject* PyInit_adaptor()’:
include/pybind11/common.h:232:34: warning: ‘PyObject* pybind11_init()’ is deprecated: PYBIND11_PLUGIN is deprecated, use PYBIND11_MODULE [-Wdeprecated-declarations]
return pybind11_init(); \
^
adaptor.cpp:53:1: note: in expansion of macro ‘PYBIND11_PLUGIN’
PYBIND11_PLUGIN(adaptor) {
^~~~~~~~~~~~~~~
include/pybind11/common.h:217:22: note: declared here
static PyObject *pybind11_init(); \
^
adaptor.cpp:53:1: note: in expansion of macro ‘PYBIND11_PLUGIN’
PYBIND11_PLUGIN(adaptor) {
^~~~~~~~~~~~~~~
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
include/clipper/clipper.cpp: In member function ‘void ClipperLib::Clipper::FixupFirstLefts3(ClipperLib::OutRec*, ClipperLib::OutRec*)’:
include/clipper/clipper.cpp:3665:13: warning: unused variable ‘firstLeft’ [-Wunused-variable]
OutRec* firstLeft = ParseFirstLeft(outRec->FirstLeft);
I use::
ubuntu-17.4
tensorflow-1.4.0
python-3.5
gcc-7.0.1
cuda-8.0

Resources