glyr icon indicating copy to clipboard operation
glyr copied to clipboard

fix build on OpenBSD

Open hboetes opened this issue 4 years ago • 0 comments

I just tried building glyrc on OpenBSD and ran into not having execinfo.h, which is nice for backtraces but not required. In fact the code that requires it is already enclosed in an ifdef.

#ifdef __linux__                                                                                                                                                              
/* Backtrace*/                                                                                                                                                                
#include <execinfo.h>                                                                                                                                                         
#endif                                                                                                                                                                        

So applying this diff fixed the build for me. Now I'm not claiming this patch should be applied to the main source. It should be rewritten so that missing backtrace is not a problem.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f9bf068..c1e0d35 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,29 +94,6 @@ PKG_CHECK_MODULES(SQLITE3 sqlite3 REQUIRED)
 INCLUDE_DIRECTORIES(${GLIBPKG_INCLUDE_DIRS})
 
 
-# --------------------------
-# Check for backtrace
-# --------------------------
-
-INCLUDE(CheckIncludeFile)
-CHECK_INCLUDE_FILE("execinfo.h" HAVE_EXECINFO)
-IF(NOT HAVE_EXECINFO)
-  MESSAGE(FATAL_ERROR "execinfo.h could not be found on the system")
-ENDIF(NOT HAVE_EXECINFO)
-
-INCLUDE(CheckSymbolExists)
-CHECK_SYMBOL_EXISTS("backtrace" "execinfo.h" HAVE_BACKTRACE)
-IF(NOT HAVE_BACKTRACE)
-  SET(CMAKE_REQUIRED_FLAGS "-lexecinfo")
-  CHECK_SYMBOL_EXISTS("backtrace" "execinfo.h" HAVE_LIBEXECINFO)
-  IF(HAVE_LIBEXECINFO)
-    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lexecinfo")
-  ELSE(HAVE_LIBEXECINFO)
-    MESSAGE(FATAL_ERROR "Could not link to libexecinfo")
-  ENDIF(HAVE_LIBEXECINFO)
-ENDIF(NOT HAVE_BACKTRACE)
-
-
 # --------------------------
 # set directories
 # --------------------------

hboetes avatar Jun 19 '20 04:06 hboetes