Skip to content

Commit

Permalink
fix compilation in debug mode with Clang
Browse files Browse the repository at this point in the history
On my machine, Clang cannot compile the code in debug mode.

    quadiron/src/arith.h:299: undefined reference to `__muloti4'
    quadiron/src/arith.h:303: undefined reference to `__muloti4'
    quadiron/src/arith.h:307: undefined reference to `__muloti4'

This seems related to this bug: https://bugs.llvm.org/show_bug.cgi?id=16404

Removing `-ftrapv` for Clang solves the issue.
  • Loading branch information
slaperche-scality committed Aug 3, 2018
1 parent 922eaf6 commit 3665e27
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ endforeach(flag)
# Debug flags
set(DEBUG_CXX_FLAGS
-O0 -g3 -ggdb3 -fno-limit-debug-info
-ftrapv
)
foreach(flag ${DEBUG_CXX_FLAGS})
check_cxx_compiler_flag(${flag} has_flag_${flag})
Expand All @@ -162,6 +161,11 @@ foreach(flag ${DEBUG_CXX_FLAGS})
endif(has_flag_${flag})
endforeach(flag)

# Seems buggy on Clang: see https://bugs.llvm.org/show_bug.cgi?id=16404
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ftrapv")
endif()

# Release flags
set(RELEASE_CXX_FLAGS
-O3 -DNDEBUG
Expand Down

0 comments on commit 3665e27

Please sign in to comment.