diff --git a/CMakeLists.txt b/CMakeLists.txt
index 01db361b08108d79985190700a13bf5c09eafe4f..8ed064eb1de0ebce012daf328173b420ada0f0a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -79,8 +79,7 @@ endif()
 
 # set Debug/Release options
 set( CMAKE_CXX_FLAGS "-std=c++11 -pthread -Wall -Wno-unused-local-typedefs -Wno-unused-variable" )
-# -DPACKAGE -DPACKAGE_VERSION are needed for bfd.h, see https://stackoverflow.com/a/11748919
-set( CMAKE_CXX_FLAGS_DEBUG "-g -DPACKAGE -DPACKAGE_VERSION" )
+set( CMAKE_CXX_FLAGS_DEBUG "-g" )
 set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -mtune=native -DNDEBUG" )
 #set( CMAKE_CXX_FLAGS_RELEASE "-O3 -march=native -mtune=native -DNDEBUG -ftree-vectorizer-verbose=1 -ftree-vectorize -fopt-info-vec-missed -funroll-loops" )
 # pass -rdynamic only in Debug mode
diff --git a/src/TNL/Debugging/backtrace2line.h b/src/TNL/Debugging/backtrace2line.h
index 7f2bacb283cc52fdcc64c9a61ab8969edb1deb19..751c89149d35a15dbe4af64c71c597e1dee5316e 100644
--- a/src/TNL/Debugging/backtrace2line.h
+++ b/src/TNL/Debugging/backtrace2line.h
@@ -7,13 +7,19 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <execinfo.h>
-#include <bfd.h>
 #include <dlfcn.h>
 #include <link.h>
 #include <linux/types.h>
 #include <execinfo.h>
 #include <cxxabi.h>
 
+// THe PACKAGE and PACKAGE_VERSION macros are needed for bfd.h,
+// see https://stackoverflow.com/a/11748919
+#define PACKAGE
+#define PACKAGE_VERSION
+#include <bfd.h>
+#undef PACKAGE
+#undef PACKAGE_VERSION
 
 
 //from: https://oroboro.com/printing-stack-traces-file-line/