Skip to content

Commit

Permalink
Solved few issues with CI.
Browse files Browse the repository at this point in the history
  • Loading branch information
viferga committed Aug 23, 2023
1 parent 419ffb5 commit 79a17a2
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 25 deletions.
21 changes: 11 additions & 10 deletions cmake/InstallPatchelf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ if(Patchelf_FOUND)
endif()

if(WIN32 OR APPLE)
# TODO: Download binaries (https://github.com/NixOS/patchelf/releases/tag/0.18.0)
message(WARNING "Patchelf not supported in MacOs or Windows")
endif()

Expand All @@ -33,23 +34,23 @@ set(Patchelf_TMP_DIR "${Patchelf_PREFIX_DIR}/tmp/patchelf")

include(ExternalProject)

set(Patchelf_ENV_COMMAND env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} CXXFLAGS=-static)

ExternalProject_Add(Patchelf
PREFIX "${Patchelf_PREFIX_DIR}"
URL "http://nixos.org/releases/patchelf/patchelf-0.11/patchelf-0.11.tar.bz2"
PATCH_COMMAND
GIT_REPOSITORY "https://github.com/NixOS/patchelf"
GIT_TAG "0.18.0"
PATCH_COMMAND ""
SOURCE_DIR "${Patchelf_SOURCE_DIR}"
BINARY_DIR "${Patchelf_SOURCE_DIR}"
INSTALL_DIR "${Patchelf_INSTALL_DIR}"
STAMP_DIR "${Patchelf_STAMP_DIR}"
TMP_DIR "${Patchelf_TMP_DIR}"
CONFIGURE_COMMAND ${Patchelf_ENV_COMMAND} ${Patchelf_SOURCE_DIR}/configure
INSTALL_COMMAND ""
LOG_DOWNLOAD 1
LOG_CONFIGURE 1
LOG_BUILD 1
LOG_INSTALL 1
CONFIGURE_COMMAND ${Patchelf_SOURCE_DIR}/bootstrap.sh
BUILD_COMMAND ${Patchelf_SOURCE_DIR}/configure
INSTALL_COMMAND make
LOG_DOWNLOAD 1
LOG_CONFIGURE 1
LOG_BUILD 1
LOG_INSTALL 1
)

set(Patchelf_EXECUTABLE "${CMAKE_BINARY_DIR}/Patchelf/src/patchelf/src/patchelf")
Expand Down
12 changes: 6 additions & 6 deletions source/loader/source/loader_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static int loader_impl_initialize_registered(plugin_manager manager, plugin p);

static int loader_impl_initialize(plugin_manager manager, plugin p, loader_impl impl);

static loader_handle_impl loader_impl_load_handle(loader_impl impl, loader_impl_interface iface, loader_handle module, const loader_path path);
static loader_handle_impl loader_impl_load_handle(loader_impl impl, loader_impl_interface iface, loader_handle module, const char *path, size_t size);

static int loader_impl_handle_init(loader_impl impl, const char *path, loader_handle_impl handle_impl, void **handle_ptr, int populated);

Expand Down Expand Up @@ -522,7 +522,7 @@ int loader_impl_type_define(loader_impl impl, const char *name, type t)
return 1;
}

loader_handle_impl loader_impl_load_handle(loader_impl impl, loader_impl_interface iface, loader_handle module, const loader_path path)
loader_handle_impl loader_impl_load_handle(loader_impl impl, loader_impl_interface iface, loader_handle module, const char *path, size_t size)
{
loader_handle_impl handle_impl = malloc(sizeof(struct loader_handle_impl_type));

Expand All @@ -533,7 +533,7 @@ loader_handle_impl loader_impl_load_handle(loader_impl impl, loader_impl_interfa

handle_impl->impl = impl;
handle_impl->iface = iface;
strncpy(handle_impl->path, path, LOADER_PATH_SIZE);
strncpy(handle_impl->path, path, size);
handle_impl->module = module;
handle_impl->ctx = context_create(handle_impl->path);

Expand Down Expand Up @@ -846,7 +846,7 @@ int loader_impl_load_from_file(plugin_manager manager, plugin p, loader_impl imp

if (handle != NULL)
{
loader_handle_impl handle_impl = loader_impl_load_handle(impl, iface, handle, path);
loader_handle_impl handle_impl = loader_impl_load_handle(impl, iface, handle, path, LOADER_PATH_SIZE);

/* TODO: Disable logs here until log is completely thread safe and async signal safe */
/* log_write("metacall", LOG_LEVEL_DEBUG, "Loader handle impl: %p", (void *)handle_impl); */
Expand Down Expand Up @@ -979,7 +979,7 @@ int loader_impl_load_from_memory(plugin_manager manager, plugin p, loader_impl i

if (handle != NULL)
{
loader_handle_impl handle_impl = loader_impl_load_handle(impl, iface, handle, name);
loader_handle_impl handle_impl = loader_impl_load_handle(impl, iface, handle, name, LOADER_NAME_SIZE);

if (handle_impl != NULL)
{
Expand Down Expand Up @@ -1077,7 +1077,7 @@ int loader_impl_load_from_package(plugin_manager manager, plugin p, loader_impl

if (handle != NULL)
{
loader_handle_impl handle_impl = loader_impl_load_handle(impl, iface, handle, subpath);
loader_handle_impl handle_impl = loader_impl_load_handle(impl, iface, handle, subpath, LOADER_PATH_SIZE);

if (handle_impl != NULL)
{
Expand Down
8 changes: 6 additions & 2 deletions source/loaders/py_loader/source/py_loader_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2410,7 +2410,9 @@ int py_loader_impl_initialize_import(loader_impl_py py_impl)
#endif
;

py_impl->import_module = py_loader_impl_load_from_memory_compile(py_impl, "py_loader_impl_load_from_file_path", import_module_str);
static const loader_name name = "py_loader_impl_load_from_file_path";

py_impl->import_module = py_loader_impl_load_from_memory_compile(py_impl, name, import_module_str);

if (py_impl->import_module == NULL)
{
Expand Down Expand Up @@ -2499,7 +2501,9 @@ int py_loader_impl_initialize_thread_background_module(loader_impl_py py_impl)
main()
*/

py_impl->thread_background_module = py_loader_impl_load_from_memory_compile(py_impl, "py_loader_impl_thread_background", thread_background_module_str);
static const loader_name name = "py_loader_impl_thread_background";

py_impl->thread_background_module = py_loader_impl_load_from_memory_compile(py_impl, name, thread_background_module_str);

if (py_impl->thread_background_module == NULL)
{
Expand Down
21 changes: 16 additions & 5 deletions source/ports/rb_port/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,24 @@ target_compile_options(${SWIG_MODULE_${target}_REAL_NAME}
INTERFACE
)

# Fix Ruby MacOSX LLVM bug
# '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
include(Portability)

if("${PROJECT_OS_FAMILY}" STREQUAL "macos" AND CMAKE_C_COMPILER_ID MATCHES "Clang")
target_compile_options(${target} PRIVATE "-fdeclspec")
endif()
target_compile_options(${target}
PRIVATE

# Fix Ruby MacOSX LLVM bug
# '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for __declspec attributes
$<$<AND:$<STREQUAL:${PROJECT_OS_FAMILY},macos>,$<OR:$<STREQUAL:${CMAKE_CXX_COMPILER_ID},Clang>,$<STREQUAL:${CMAKE_CXX_COMPILER_ID},AppleClang>>>:-fdeclspec>

# Disable warnings (Clang, GCC) for unused parameters and variables generated by Swig
$<$<OR:$<STREQUAL:${CMAKE_CXX_COMPILER_ID},Clang>,$<STREQUAL:${CMAKE_CXX_COMPILER_ID},AppleClang>,$<STREQUAL:${CMAKE_CXX_COMPILER_ID},GNU>>:-Wno-unused-parameter>
$<$<OR:$<STREQUAL:${CMAKE_CXX_COMPILER_ID},Clang>,$<STREQUAL:${CMAKE_CXX_COMPILER_ID},AppleClang>,$<STREQUAL:${CMAKE_CXX_COMPILER_ID},GNU>>:-Wno-unused-variable>

PUBLIC
${DEFAULT_COMPILE_OPTIONS}

INTERFACE
)

#
# Linker options
Expand Down
2 changes: 1 addition & 1 deletion source/ports/rs_port/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if(NOT (OPTION_BUILD_ADDRESS_SANITIZER OR OPTION_BUILD_THREAD_SANITIZER OR OPTIO
)

if(NOT Rust_BINDGEN_EXECUTABLE AND NOT OPTION_BUILD_GUIX)
execute_process(COMMAND ${Rust_CARGO_EXECUTABLE} install bindgen)
execute_process(COMMAND ${Rust_CARGO_EXECUTABLE} install bindgen-cli)

find_program(Rust_BINDGEN_EXECUTABLE bindgen
HINTS ${Rust_CARGO_HOME}
Expand Down
2 changes: 1 addition & 1 deletion tools/metacall-environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ sub_rust(){

if [ "${OPERATIVE_SYSTEM}" = "Linux" ]; then
if [ "${LINUX_DISTRO}" = "debian" ] || [ "${LINUX_DISTRO}" = "ubuntu" ]; then
$SUDO_CMD apt-get $APT_CACHE_CMD install -y --no-install-recommends curl
$SUDO_CMD apt-get $APT_CACHE_CMD install -y --no-install-recommends curl autoconf automake
elif [ "${LINUX_DISTRO}" = "alpine" ]; then
$SUDO_CMD apk add --no-cache curl musl-dev linux-headers libgcc
fi
Expand Down

0 comments on commit 79a17a2

Please sign in to comment.