Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Setting debug mode, errors in debug but not release

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Setting debug mode, errors in debug but not release


Chronological Thread 
  • From: Qingnan Zhou <>
  • To:
  • Subject: Re: [cgal-discuss] Setting debug mode, errors in debug but not release
  • Date: Thu, 5 Mar 2015 15:53:21 -0500

Hi Adam,

Have you tried this?

cmake -DCGAL_DONT_OVERRIDE_CMAKE_FLAGS=TRUE -DCMAKE_BUILD_TYPE=Debug ..

CGAL's UseCGAL.cmake script overwrite the flags $CMAKE_BUILD_TYPE and $CMAKE_CXX_FLAGS with $CGAL_BUILD_TYPE and $CGAL_CXX_FLAGS which is set when CGAL was compiled (in your case it is set when you install CGAL from homebrew).  See section 15.4 of the manual.

best,
James

On Thu, Mar 5, 2015 at 2:33 PM, Alex Tsui <> wrote:
The homebrew script is set to compile in Release mode, and so it seems that it will switch your build type to Release regardless of what you set it. I tried building a test project in Release mode and linking to a CGAL built in Debug mode and it did the opposite - it was switched to Debug mode.

Maybe try to fetch CGAL and build it yourself in Debug mode? Then export CGAL_DIR=/path/to/your/cgal and try rebuilding your project.

--Alex

On Thu, Mar 5, 2015 at 11:23 AM, Adam Getchell <> wrote:
No, I installed it via Homebrew:

┌─[adam][Hapkido][±][master ][~/CDT-plusplus]

└─▪ brew info cgal

cgal: stable 4.5.2 (bottled)

http://www.cgal.org/

/usr/local/Cellar/cgal/4.5.2 (2731 files, 33M) *

  Built from source with: --c++11, --imaging, --with-eigen3, --with-lapack

From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/cgal.rb

==> Dependencies

Build: cmake

Required: boost , gmp , mpfr

==> Options

--c++11

Build using C++11 mode

--imaging

Build ImageIO and QT compoments of CGAL

--with-eigen3

Build with Eigen3 support

--with-lapack

Build with LAPACK support



On Thu, Mar 5, 2015 at 6:33 AM, Alex Tsui <> wrote:
What's your CGAL_DIR? Did you build CGAL from source with CMAKE_BUILD_TYPE=Debug?

--Alex

On Thu, Mar 5, 2015 at 2:10 AM, Adam Getchell <> wrote:
Hello all,

No matter that I set -DCMAKE_BUILD_TYPE=Debug, I always get a Release build:

┌─[adam][Hapkido][±][master ][~/CDT-plusplus]

└─▪ mkdir build

┌─[adam][Hapkido][±][master ][~/CDT-plusplus]

└─▪ cd build

┌─[adam][Hapkido][±][master ][~/CDT-plusplus/build]

└─▪ cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ..

-- The C compiler identification is AppleClang 6.0.0.6000056

-- The CXX compiler identification is AppleClang 6.0.0.6000056

-- Check for working C compiler using: Ninja

-- Check for working C compiler using: Ninja -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Check for working CXX compiler using: Ninja

-- Check for working CXX compiler using: Ninja -- works

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Build type: Release

-- USING CXXFLAGS = ' -O3 -DNDEBUG'

-- USING EXEFLAGS = ' -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib '

-- Targetting Ninja

-- Using /usr/bin/c++ compiler.

-- DARWIN_VERSION=14

-- Mac Leopard detected

-- Requested component: Core

-- Requested component: MPFR

-- Requested component: GMP

-- Found Eigen3: /usr/local/include/eigen3 (found suitable version "3.2.4", minimum required is "3.1.0") 

-- Found Intel TBB

-- Configuring done

-- Generating done

-- Build files have been written to: /Users/adam/CDT-plusplus/build


According to the cmake list, one of CGALs find_package modules is setting the CMAKE_BUILD_TYPE, though I have been unable to verify this.

The only workaround I've found is to build twice, e.g. the script scan-build.sh is:

#! /bin/bash
rm -rf build/
mkdir build
cd build
cmake -G Ninja -DCMAKE_C_COMPILER=/usr/local/Cellar/llvm/3.5.1/share/clang/tools/scan-build/ccc-analyzer -DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm/3.5.1/share/clang/tools/scan-build/c++-analyzer ..
cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug ..
/usr/local/opt/llvm/bin/scan-build -o $(pwd)/scanresults -v ninja

Which results in:

┌─[adam][Hapkido][±][master ][~/CDT-plusplus]

└─▪ ./scan-build.sh 

-- The C compiler identification is AppleClang 6.0.0.6000056

-- The CXX compiler identification is AppleClang 6.0.0.6000056

-- Check for working C compiler using: Ninja

-- Check for working C compiler using: Ninja -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

-- Check for working CXX compiler using: Ninja

-- Check for working CXX compiler using: Ninja -- works

-- Detecting CXX compiler ABI info

-- Detecting CXX compiler ABI info - done

-- Build type: Release

-- USING CXXFLAGS = ' -O3 -DNDEBUG'

-- USING EXEFLAGS = ' -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib '

-- Targetting Ninja

-- Using /usr/local/Cellar/llvm/3.5.1/share/clang/tools/scan-build/c++-analyzer compiler.

-- DARWIN_VERSION=14

-- Mac Leopard detected

-- Requested component: Core

-- Requested component: MPFR

-- Requested component: GMP

-- Found Eigen3: /usr/local/include/eigen3 (found suitable version "3.2.4", minimum required is "3.1.0") 

-- Found Intel TBB

-- Configuring done

-- Generating done

-- Build files have been written to: /Users/adam/CDT-plusplus/build

-- Build type: Debug

-- USING CXXFLAGS = ' -g'

-- USING EXEFLAGS = ' -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib '

-- Targetting Ninja

-- Using /usr/local/Cellar/llvm/3.5.1/share/clang/tools/scan-build/c++-analyzer compiler.

-- DARWIN_VERSION=14

-- Mac Leopard detected

-- Requested component: Core

-- Requested component: MPFR

-- Requested component: GMP

-- Found Intel TBB

-- Configuring done

-- Generating done

-- Build files have been written to: /Users/adam/CDT-plusplus/build

scan-build: Using '/usr/local/Cellar/llvm/3.5.1/bin/clang' for static analysis

scan-build: Emitting reports for this run to '/Users/adam/CDT-plusplus/build/scanresults/2015-03-05-020325-15162-1'.

[13/13] Linking CXX executable unittests

FAILED: : && /usr/local/Cellar/llvm/3.5.1/share/clang/tools/scan-build/c++-analyzer   -g -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib CMakeFiles/unittests.dir/unittests/main.cpp.o CMakeFiles/unittests.dir/unittests/PointTest.cpp.o CMakeFiles/unittests.dir/unittests/S3BulkActionTest.cpp.o CMakeFiles/unittests.dir/unittests/S3ErgodicMovesTest.cpp.o CMakeFiles/unittests.dir/unittests/S3TetrahedronTest.cpp.o CMakeFiles/unittests.dir/unittests/SdTriangulationTest.cpp.o CMakeFiles/unittests.dir/unittests/SphereTest.cpp.o CMakeFiles/unittests.dir/unittests/Triangulated2SphereTest.cpp.o CMakeFiles/unittests.dir/unittests/VertexTest.cpp.o  -o unittests -L/usr/local/Cellar/cgal/4.5.2/lib  -L/Users/adam/gmock-1.7.0/lib/.libs  -L/Users/adam/gmock-1.7.0/gtest/lib/.libs /usr/local/lib/libmpfr.dylib /usr/local/lib/libgmp.dylib /usr/local/Cellar/cgal/4.5.2/lib/libCGAL_Core.dylib /usr/local/Cellar/cgal/4.5.2/lib/libCGAL.dylib /usr/local/lib/libboost_thread-mt.dylib /usr/local/lib/libboost_system-mt.dylib -lgmock -lgtest -lpthread -Wl,-rpath,/usr/local/Cellar/cgal/4.5.2/lib -Wl,-rpath,/Users/adam/gmock-1.7.0/lib/.libs -Wl,-rpath,/Users/adam/gmock-1.7.0/gtest/lib/.libs && :

Undefined symbols for architecture x86_64:

  "tbb::task_group_context::init()", referenced from:

tbb::task_group_context::task_group_context(tbb::task_group_context::kind_type, unsigned long) in S3TetrahedronTest.cpp.o

  "tbb::task_group_context::~task_group_context()", referenced from:


Plus a ton of errors about tbb. Full dump here:


Thanks for any tips,
--
Adam Getchell
"Invincibility is in oneself, vulnerability in the opponent." -- Sun Tzu




--
Adam Getchell
"Invincibility is in oneself, vulnerability in the opponent." -- Sun Tzu





Archive powered by MHonArc 2.6.18.

Top of Page