Fix building with musl libc

This commit is contained in:
Kylie McClain 2015-11-05 16:59:29 +00:00 committed by Maxime Coste
parent 788c358720
commit 1ed66e9b6a
2 changed files with 15 additions and 6 deletions

View File

@ -1,4 +1,6 @@
debug ?= yes
pedantic ?= yes
ifeq ($(debug),yes)
CPPFLAGS += -DKAK_DEBUG
suffix := .debug
@ -11,6 +13,10 @@ else
endif
endif
ifeq ($(pedantic),yes)
CXXFLAGS += -pedantic
endif
sources := $(wildcard *.cc)
objects := $(addprefix ., $(sources:.cc=$(suffix).o))
deps := $(addprefix ., $(sources:.cc=$(suffix).d))
@ -22,8 +28,6 @@ bindir := $(DESTDIR)$(PREFIX)/bin
sharedir := $(DESTDIR)$(PREFIX)/share/kak
docdir := $(DESTDIR)$(PREFIX)/share/doc/kak
CXXFLAGS += -std=gnu++11 -g -Wall -Wno-reorder -Wno-sign-compare -pedantic
os := $(shell uname)
ifeq ($(os),Darwin)
@ -46,6 +50,8 @@ else
LDFLAGS += -rdynamic
endif
CXXFLAGS += -std=gnu++11 -g -Wall -Wno-reorder -Wno-sign-compare
kak : $(objects)
$(CXX) $(LDFLAGS) $(CXXFLAGS) $(objects) $(LIBS) -o $@

View File

@ -2,21 +2,24 @@
#include "string.hh"
#if defined(__linux__) || defined(__APPLE__)
#if defined(__GLIBC__) || defined(__APPLE__)
# include <execinfo.h>
# include <stdlib.h>
#elif defined(__CYGWIN__)
# include <windows.h>
# include <dbghelp.h>
# include <stdio.h>
#endif
#if defined(__linux__) || defined(__APPLE__)
# include <stdlib.h>
#endif
namespace Kakoune
{
Backtrace::Backtrace()
{
#if defined(__linux__) || defined(__APPLE__)
#if defined(__GLIBC__) || defined(__APPLE__)
num_frames = backtrace(stackframes, max_frames);
#elif defined(__CYGWIN__)
num_frames = CaptureStackBackTrace(0, max_frames, stackframes, nullptr);
@ -25,7 +28,7 @@ Backtrace::Backtrace()
String Backtrace::desc() const
{
#if defined(__linux__) || defined(__APPLE__)
#if defined(__GLIBC__) || defined(__APPLE__)
char** symbols = backtrace_symbols(stackframes, num_frames);
ByteCount size = 0;
for (int i = 0; i < num_frames; ++i)