提交 2e12aebf 编写于 作者: C chenzhiyu

fix missed with_musl macro control

上级 dec3371c
...@@ -54,10 +54,10 @@ endif(WIN32) ...@@ -54,10 +54,10 @@ endif(WIN32)
if(WITH_MUSL) if(WITH_MUSL)
add_definitions(-DPADDLE_WITH_MUSL) add_definitions(-DPADDLE_WITH_MUSL)
message(STATUS, "WITH_MKL=OFF, when WITH_MUSL=ON") message(STATUS, "Set compile option WITH_MKL=OFF when WITH_MUSL=ON")
SET(WITH_MKL OFF) SET(WITH_MKL OFF)
message(STATUS, "WITH_GPU=OFF, when WITH_MUSL=ON") message(STATUS, "Set compile option WITH_GPU=OFF when WITH_MUSL=ON")
SET(WITH_GPU OFF) SET(WITH_GPU OFF)
endif() endif()
......
...@@ -47,6 +47,10 @@ limitations under the License. */ ...@@ -47,6 +47,10 @@ limitations under the License. */
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#ifndef PADDLE_WITH_MUSL
#include <execinfo.h>
#endif
#define GLOG_NO_ABBREVIATED_SEVERITIES // msvc conflict logging with windows.h #define GLOG_NO_ABBREVIATED_SEVERITIES // msvc conflict logging with windows.h
#include "glog/logging.h" #include "glog/logging.h"
#include "paddle/fluid/platform/errors.h" #include "paddle/fluid/platform/errors.h"
...@@ -230,13 +234,14 @@ inline std::string SimplifyDemangleStr(std::string str) { ...@@ -230,13 +234,14 @@ inline std::string SimplifyDemangleStr(std::string str) {
} }
inline std::string GetCurrentTraceBackString() { inline std::string GetCurrentTraceBackString() {
//static constexpr int TRACE_STACK_LIMIT = 100;
std::ostringstream sout; std::ostringstream sout;
sout << "\n\n--------------------------------------\n"; sout << "\n\n--------------------------------------\n";
sout << "C++ Traceback (most recent call last):"; sout << "C++ Traceback (most recent call last):";
sout << "\n--------------------------------------\n"; sout << "\n--------------------------------------\n";
#if !defined(_WIN32) && 0 #if !defined(_WIN32) && !defined(PADDLE_WITH_MUSL)
static constexpr int TRACE_STACK_LIMIT = 100;
void* call_stack[TRACE_STACK_LIMIT]; void* call_stack[TRACE_STACK_LIMIT];
auto size = backtrace(call_stack, TRACE_STACK_LIMIT); auto size = backtrace(call_stack, TRACE_STACK_LIMIT);
auto symbols = backtrace_symbols(call_stack, size); auto symbols = backtrace_symbols(call_stack, size);
...@@ -255,7 +260,7 @@ inline std::string GetCurrentTraceBackString() { ...@@ -255,7 +260,7 @@ inline std::string GetCurrentTraceBackString() {
} }
free(symbols); free(symbols);
#else #else
sout << "Windows not support stack backtrace yet.\n"; sout << "Not support stack backtrace yet.\n";
#endif #endif
return sout.str(); return sout.str();
} }
......
...@@ -25,6 +25,8 @@ limitations under the License. */ ...@@ -25,6 +25,8 @@ limitations under the License. */
classname& operator=(classname&&) = delete classname& operator=(classname&&) = delete
#endif #endif
//#if defined(__FLT_MAX__) #ifndef PADDLE_WITH_MUSL
//#define FLT_MAX __FLT_MAX__ #if defined(__FLT_MAX__)
//#endif // __FLT_MAX__ #define FLT_MAX __FLT_MAX__
#endif // __FLT_MAX__
#endif
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#if !defined(_WIN32) #if !defined(_WIN32)
#include <dlfcn.h> // dladdr #include <dlfcn.h> // dladdr
//#include <execinfo.h> // backtrace
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
#include <algorithm> // std::accumulate #include <algorithm> // std::accumulate
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册