Skip to content

Commit

Permalink
fixed emscripten detection (#897)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiud authored Feb 24, 2023
1 parent f545ff5 commit 4056374
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
1 change: 0 additions & 1 deletion .github/workflows/emscripten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
cmake -S . -B build_${{matrix.build_type}} \
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \
-DCMAKE_AR=$(which emar) \
-DCMAKE_C_COMPILER=$(which emcc) \
-DCMAKE_CXX_COMPILER=$(which em++) \
-DCMAKE_CXX_STANDARD=${{matrix.std}} \
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
Expand Down
18 changes: 14 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -503,15 +503,25 @@ if (WITH_SYMBOLIZE)
if (HAVE_SYMBOLIZE)
set (HAVE_STACKTRACE 1)
endif (HAVE_SYMBOLIZE)
elseif (UNIX OR (APPLE AND HAVE_DLADDR))
elseif (UNIX)
cmake_push_check_state (RESET)
check_cxx_source_compiles ([=[
int main()
{
#ifndef __ELF__
#error __ELF__ not defined
#endif
}
]=] HAVE_SYMBOLIZE)
cmake_pop_check_state ()
elseif (APPLE AND HAVE_DLADDR)
set (HAVE_SYMBOLIZE 1)
endif (WIN32 OR CYGWIN)
endif (WITH_SYMBOLIZE)

# CMake manages symbolize availability. The definition is necessary only when
# building the library. Switch to add_compile_definitions once we drop support
# for CMake below version 3.12.
add_definitions (-DGLOG_NO_SYMBOLIZE_DETECTION)
# building the library.
add_compile_definitions (GLOG_NO_SYMBOLIZE_DETECTION)

check_cxx_source_compiles ("
#include <cstdlib>
Expand Down
2 changes: 1 addition & 1 deletion src/symbolize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ static ATTRIBUTE_NOINLINE bool SymbolizeAndDemangle(void *pc, char *out,

_END_GOOGLE_NAMESPACE_

#elif (defined(GLOG_OS_MACOSX) || defined(GLOG_OS_EMSCRIPTEN)) && defined(HAVE_DLADDR)
#elif defined(GLOG_OS_MACOSX) && defined(HAVE_DLADDR)

#include <dlfcn.h>
#include <cstring>
Expand Down

0 comments on commit 4056374

Please sign in to comment.