mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Configure libcpp assert to avoid macOS 13.0 issue (#12860)
This commit is contained in:
@@ -1000,8 +1000,20 @@ add_compile_definitions(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if(NOT ASSERT_ENABLED)
|
if(NOT ASSERT_ENABLED)
|
||||||
|
if(APPLE)
|
||||||
|
add_compile_definitions("_LIBCXX_ENABLE_ASSERTIONS=0")
|
||||||
|
add_compile_definitions("_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_compile_definitions("NDEBUG=1")
|
add_compile_definitions("NDEBUG=1")
|
||||||
else()
|
else()
|
||||||
|
if(APPLE)
|
||||||
|
add_compile_definitions("_LIBCXX_ENABLE_ASSERTIONS=1")
|
||||||
|
add_compile_definitions("_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG")
|
||||||
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
add_compile_definitions("_GLIBCXX_ASSERTIONS=1")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_compile_definitions("ASSERT_ENABLED=1")
|
add_compile_definitions("ASSERT_ENABLED=1")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ fi
|
|||||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/25755
|
# https://gitlab.kitware.com/cmake/cmake/-/issues/25755
|
||||||
if [[ $(uname -s) == 'Darwin' && $LLVM_VERSION == '18' ]]; then
|
if [[ $(uname -s) == 'Darwin' && $LLVM_VERSION == '18' ]]; then
|
||||||
export CFLAGS="$CFLAGS -fno-define-target-os-macros "
|
export CFLAGS="$CFLAGS -fno-define-target-os-macros "
|
||||||
export CXXFLAGS="$CXXFLAGS -fno-define-target-os-macros "
|
export CXXFLAGS="$CXXFLAGS -fno-define-target-os-macros -D_LIBCXX_ENABLE_ASSERTIONS=0 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_NONE "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# libarchive needs position-independent executables to compile successfully
|
# libarchive needs position-independent executables to compile successfully
|
||||||
@@ -120,7 +120,6 @@ fi
|
|||||||
|
|
||||||
if [[ $(uname -s) == 'Darwin' ]]; then
|
if [[ $(uname -s) == 'Darwin' ]]; then
|
||||||
export CMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET:-13.0}
|
export CMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET:-13.0}
|
||||||
|
|
||||||
CMAKE_FLAGS+=(-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET})
|
CMAKE_FLAGS+=(-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET})
|
||||||
export CFLAGS="$CFLAGS -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -D__DARWIN_NON_CANCELABLE=1 "
|
export CFLAGS="$CFLAGS -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -D__DARWIN_NON_CANCELABLE=1 "
|
||||||
export CXXFLAGS="$CXXFLAGS -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -D__DARWIN_NON_CANCELABLE=1 "
|
export CXXFLAGS="$CXXFLAGS -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET} -D__DARWIN_NON_CANCELABLE=1 "
|
||||||
|
|||||||
@@ -714,7 +714,6 @@ void Zig::GlobalObject::resetOnEachMicrotaskTick()
|
|||||||
|
|
||||||
extern "C" JSC__JSGlobalObject* Zig__GlobalObject__create(void* console_client, int32_t executionContextId, bool miniMode, bool evalMode, void* worker_ptr)
|
extern "C" JSC__JSGlobalObject* Zig__GlobalObject__create(void* console_client, int32_t executionContextId, bool miniMode, bool evalMode, void* worker_ptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
auto heapSize = miniMode ? JSC::HeapType::Small : JSC::HeapType::Large;
|
auto heapSize = miniMode ? JSC::HeapType::Small : JSC::HeapType::Large;
|
||||||
JSC::VM& vm = JSC::VM::create(heapSize).leakRef();
|
JSC::VM& vm = JSC::VM::create(heapSize).leakRef();
|
||||||
// This must happen before JSVMClientData::create
|
// This must happen before JSVMClientData::create
|
||||||
@@ -756,7 +755,7 @@ extern "C" JSC__JSGlobalObject* Zig__GlobalObject__create(void* console_client,
|
|||||||
|
|
||||||
auto* globalObject = createGlobalObject();
|
auto* globalObject = createGlobalObject();
|
||||||
if (UNLIKELY(!globalObject)) {
|
if (UNLIKELY(!globalObject)) {
|
||||||
PANIC("Failed to allocate JavaScript global object. Did your computer run out of memory?");
|
BUN_PANIC("Failed to allocate JavaScript global object. Did your computer run out of memory?");
|
||||||
}
|
}
|
||||||
|
|
||||||
globalObject->setConsole(console_client);
|
globalObject->setConsole(console_client);
|
||||||
|
|||||||
@@ -139,6 +139,9 @@ const ZigStackFrameCode ZigStackFrameCodeGlobal = 4;
|
|||||||
const ZigStackFrameCode ZigStackFrameCodeWasm = 5;
|
const ZigStackFrameCode ZigStackFrameCodeWasm = 5;
|
||||||
const ZigStackFrameCode ZigStackFrameCodeConstructor = 6;
|
const ZigStackFrameCode ZigStackFrameCodeConstructor = 6;
|
||||||
|
|
||||||
|
extern "C" void __attribute((__noreturn__)) Bun__panic(const char* message, size_t length);
|
||||||
|
#define BUN_PANIC(message) Bun__panic(message, sizeof(message) - 1)
|
||||||
|
|
||||||
typedef struct ZigStackFramePosition {
|
typedef struct ZigStackFramePosition {
|
||||||
int32_t line_zero_based;
|
int32_t line_zero_based;
|
||||||
int32_t column_zero_based;
|
int32_t column_zero_based;
|
||||||
@@ -273,10 +276,7 @@ extern "C" void Bun__WTFStringImpl__ref(WTF::StringImpl* impl);
|
|||||||
extern "C" bool BunString__fromJS(JSC::JSGlobalObject*, JSC::EncodedJSValue, BunString*);
|
extern "C" bool BunString__fromJS(JSC::JSGlobalObject*, JSC::EncodedJSValue, BunString*);
|
||||||
extern "C" JSC::EncodedJSValue BunString__toJS(JSC::JSGlobalObject*, const BunString*);
|
extern "C" JSC::EncodedJSValue BunString__toJS(JSC::JSGlobalObject*, const BunString*);
|
||||||
extern "C" void BunString__toWTFString(BunString*);
|
extern "C" void BunString__toWTFString(BunString*);
|
||||||
extern "C" void Bun__panic(const char* message, size_t length);
|
|
||||||
#ifndef PANIC
|
|
||||||
#define PANIC(message) Bun__panic(message, sizeof(message) - 1)
|
|
||||||
#endif
|
|
||||||
namespace Bun {
|
namespace Bun {
|
||||||
JSC::JSValue toJS(JSC::JSGlobalObject*, BunString);
|
JSC::JSValue toJS(JSC::JSGlobalObject*, BunString);
|
||||||
BunString toString(JSC::JSGlobalObject* globalObject, JSC::JSValue value);
|
BunString toString(JSC::JSGlobalObject* globalObject, JSC::JSValue value);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@@ -266,8 +267,23 @@ extern "C" int __wrap_mknodat(int dirfd, const char* path, __mode_t mode, __dev_
|
|||||||
// macOS
|
// macOS
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
|
||||||
|
#include <version>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <cstdarg>
|
||||||
|
#include <cstdio>
|
||||||
|
#include "headers.h"
|
||||||
|
|
||||||
|
void std::__libcpp_verbose_abort(char const* format, ...)
|
||||||
|
{
|
||||||
|
va_list list;
|
||||||
|
va_start(list, format);
|
||||||
|
char buffer[1024];
|
||||||
|
size_t len = vsnprintf(buffer, sizeof(buffer), format, list);
|
||||||
|
va_end(list);
|
||||||
|
|
||||||
|
Bun__panic(buffer, len);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" int pthread_self_is_exiting_np()
|
extern "C" int pthread_self_is_exiting_np()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user