Skip to content

VTR_BUILD: -lasan not found #815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2019

Conversation

jeanlego
Copy link
Contributor

Description

with the previous flags, vtr would not build with libasan.
the changes remove linking asan as a static library

Related Issue

this fixes #814

Motivation and Context

Ability to run with sanitize flags.

How Has This Been Tested?

built with gcc 9

Types of changes

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

@probot-autolabeler probot-autolabeler bot added build Build system lang-make CMake/Make code labels Jul 20, 2019
@jeanlego
Copy link
Contributor Author

@kmurray any reason why -static-libasan should not be removed?

    link_libraries("-static-libasan") #Fixes 'ASan runtime does not come first in initial library list'	

if we add the link flags, static-libasan prevent a successful build.

The only error I have ran into is that Valgrind will not play nice with -fsanitize=address turned on but they should not be used together anyways.

@kmurray
Copy link
Contributor

kmurray commented Jul 22, 2019

Valgrind will not play nice with -fsanitize=address turned on

That is my experience also, so they should be used in a mutually exclusive manner.

any reason why -static-libasan should not be removed?

I recall adding that for the reason in the comment: there was some link order dependence (libasan needed to be linked first). If that issue has been resolved and it works without static (i.e. dynamic) linking it should be fine to remove it.

CMakeLists.txt Outdated
@@ -267,6 +272,9 @@ endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARN_FLAGS} ${SANITIZE_FLAGS} ${PROFILING_FLAGS} ${COVERAGE_FLAGS} ${LOGGING_FLAGS} ${COLORED_COMPILE}")
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${SANITIZE_LDFLAGS}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to split out the linker/compiler flags here? Or is removing -static-libasan enough?

My preference is to keep it simple and avoid complicating the code. It looks like the SANITIZER_FLAGS and SANITIZER_LDFLAGS are the same. So if the fix is to remove -static-libasan we should just do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated as per request

@kmurray kmurray merged commit bae60ba into verilog-to-routing:master Jul 23, 2019
@kmurray
Copy link
Contributor

kmurray commented Jul 23, 2019

Thanks!

@jeanlego jeanlego deleted the static_asan_fix branch July 26, 2019 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Build system lang-make CMake/Make code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VTR_BUILD: unable to build with -DVTR_ENABLE_SANITIZE=ON
2 participants