Bug 182247
Summary: | [GTK] Should pass through CFLAGS and LDFLAGS when creating gir files | ||
---|---|---|---|
Product: | WebKit | Reporter: | Michael Catanzaro <mcatanzaro> |
Component: | WebKitGTK | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW | ||
Severity: | Normal | CC: | bugs-noreply, calvaris, mcatanzaro |
Priority: | P2 | ||
Version: | Other | ||
Hardware: | PC | ||
OS: | Linux |
Michael Catanzaro
In a private bug, I received the following instructions on how to compile and run WebKitGTK+ with address sanitizer support. Step 1 should not be necessary; we should make this just work somehow.
1. Add appropriate ASAN flags to CFLAGS and LDFLAGS in Source/WebKit/PlatformGTK.cmake
Relevant parts:
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/WebKit2-${WEBKITGTK_API_VERSION}.gir
DEPENDS WebKit2
DEPENDS ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir
COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=\"-Wno-deprecated-declarations -fsanitize=address\" LDFLAGS=\"-fsanitize=address\"
${LOADER_LIBRARY_PATH_VAR}="${INTROSPECTION_ADDITIONAL_LIBRARY_PATH}"
${INTROSPECTION_SCANNER}
...
and
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/WebKit2WebExtension-${WEBKITGTK_API_VERSION}.gir
DEPENDS ${CMAKE_BINARY_DIR}/JavaScriptCore-${WEBKITGTK_API_VERSION}.gir
DEPENDS ${CMAKE_BINARY_DIR}/WebKit2-${WEBKITGTK_API_VERSION}.gir
COMMAND CC=${CMAKE_C_COMPILER} CFLAGS=\"-Wno-deprecated-declarations -fsanitize=address\"
LDFLAGS=\"${INTROSPECTION_ADDITIONAL_LDFLAGS} -fsanitize=address\"
${LOADER_LIBRARY_PATH_VAR}="${INTROSPECTION_ADDITIONAL_LIBRARY_PATH}"
${INTROSPECTION_SCANNER}
2.
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
export CFLAGS="-g -fsanitize=address"
export CXXFLAGS="-g -fsanitize=address"
export LDFLAGS="-g -fsanitize=address"
export ASAN_OPTIONS="detect_leaks=0"
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Michael Catanzaro
Also we probably should not be generating gir files when ENABLE_INTROSPECTION is turned off. This whole big chunk of code ought to go under that conditional.
Michael Catanzaro
(In reply to Michael Catanzaro from comment #1)
> Also we probably should not be generating gir files when
> ENABLE_INTROSPECTION is turned off. This whole big chunk of code ought to go
> under that conditional.
We fixed this at some point, so now I think all we need is to pass through CFLAGS and LDFLAGS.