Commit d2ecf673 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

compile js-drone components with ASAN

parent 2966b448
...@@ -37,6 +37,7 @@ pre-configure = ...@@ -37,6 +37,7 @@ pre-configure =
configure-command = configure-command =
${:cmake} ${:cmake}
configure-options = configure-options =
-DASAN=ON
-DCMAKE_BUILD_TYPE=Debug -DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_FLAGS="${:CMAKE_CFLAGS}" -DCMAKE_C_FLAGS="${:CMAKE_CFLAGS}"
-DCMAKE_CXX_FLAGS="${:CMAKE_CFLAGS}" -DCMAKE_CXX_FLAGS="${:CMAKE_CFLAGS}"
......
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f9448b08..a947877b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -725,13 +725,16 @@ if(NOT UA_FORCE_CPP AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" ST
# Debug
if(BUILD_TYPE_LOWER_CASE STREQUAL "debug" AND UNIX AND NOT UA_BUILD_OSS_FUZZ AND
- "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang" AND NOT UA_ENABLE_UNIT_TESTS_MEMCHECK)
- # Add default sanitizer settings when using clang and Debug build.
- # This allows e.g. CLion to find memory locations for SegFaults
+ NOT UA_ENABLE_UNIT_TESTS_MEMCHECK)
message(STATUS "Sanitizer enabled")
- set(SANITIZER_FLAGS "-g -fno-omit-frame-pointer -gline-tables-only -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=leak -fsanitize=undefined")
- if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
- set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -fsanitize-coverage=trace-pc-guard")
+ set(SANITIZER_FLAGS "-g -fsanitize=address")
+ if("x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang")
+ # Add default sanitizer settings when using clang and Debug build.
+ # This allows e.g. CLion to find memory locations for SegFaults
+ set(SANITIZER_FLAGS "-g -fno-omit-frame-pointer -gline-tables-only -fsanitize=address -fsanitize-address-use-after-scope -fsanitize=leak -fsanitize=undefined")
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
+ set(SANITIZER_FLAGS "${SANITIZER_FLAGS} -fsanitize-coverage=trace-pc-guard")
+ endif()
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS}")
...@@ -14,6 +14,7 @@ md5sum = c2e9938f082b027110fba538de76684c ...@@ -14,6 +14,7 @@ md5sum = c2e9938f082b027110fba538de76684c
patch-options = -p1 patch-options = -p1
patches = patches =
${:_profile_base_location_}/ipv6_bugfix.patch#355bec02adee4ea73ff5a56ba6971ad2 ${:_profile_base_location_}/ipv6_bugfix.patch#355bec02adee4ea73ff5a56ba6971ad2
${:_profile_base_location_}/address_sanitizer_for_gcc.patch#060c22208fb3e03e3855f2f0afae4143
configure-command = configure-command =
${cmake:location}/bin/cmake ${cmake:location}/bin/cmake
configure-options = configure-options =
......
...@@ -10,8 +10,8 @@ parts = qjs-wrapper ...@@ -10,8 +10,8 @@ parts = qjs-wrapper
recipe = slapos.recipe.cmmi recipe = slapos.recipe.cmmi
shared = true shared = true
configure-command = true configure-command = true
url = https://lab.nexedi.com/nexedi/qjs-wrapper/-/archive/debug/qjs-wrapper-debug.tar.gz url = https://lab.nexedi.com/nexedi/qjs-wrapper/-/archive/asan/qjs-wrapper-asan.tar.gz
md5sum = ad3b19805d0f0954ddaf8538e04e805c md5sum = c51ab047df1c773f219ab4c9cab6c4f2
environment = environment =
C_INCLUDE_PATH=include:${open62541:location}/include:${open62541:location}/deps:${open62541:location}/src/pubsub:${quickjs:location}/include C_INCLUDE_PATH=include:${open62541:location}/include:${open62541:location}/deps:${open62541:location}/src/pubsub:${quickjs:location}/include
CPLUS_INCLUDE_PATH=include:${mavsdk:location}/include:${mavsdk:location}/include/mavsdk CPLUS_INCLUDE_PATH=include:${mavsdk:location}/include:${mavsdk:location}/include/mavsdk
......
...@@ -15,3 +15,4 @@ pre-install = touch libquickjs.a libquickjs.lto.a ...@@ -15,3 +15,4 @@ pre-install = touch libquickjs.a libquickjs.lto.a
make-options = make-options =
PROGS=qjs PROGS=qjs
STRIP=echo STRIP=echo
ASAN=ON
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment