From 59637673599b18d530916478237e97a7b6290fdb Mon Sep 17 00:00:00 2001 From: Dale Roberts Date: Thu, 19 Mar 2026 12:16:09 +1100 Subject: [PATCH 1/4] Fix locale issues --- dynadjust/CMakeLists.txt | 8 ++++---- dynadjust/include/functions/dnaiostreamfuncs.hpp | 2 +- dynadjust/include/functions/dnatemplatedatetimefuncs.hpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dynadjust/CMakeLists.txt b/dynadjust/CMakeLists.txt index 2e40f0d6d..6ad420c4f 100644 --- a/dynadjust/CMakeLists.txt +++ b/dynadjust/CMakeLists.txt @@ -59,10 +59,10 @@ if(BUILD_TESTING) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) endif() -# Set output directories for all platforms to use ../bin/ -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/../bin) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/../bin) -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/../bin) +# Set output directories for all platforms to use ../bin/ (unless overridden) +if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/../bin) +endif() # For multi-config generators (Visual Studio, Xcode) foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) diff --git a/dynadjust/include/functions/dnaiostreamfuncs.hpp b/dynadjust/include/functions/dnaiostreamfuncs.hpp index 75a011ed4..71d0b38ea 100644 --- a/dynadjust/include/functions/dnaiostreamfuncs.hpp +++ b/dynadjust/include/functions/dnaiostreamfuncs.hpp @@ -132,7 +132,7 @@ void print_file_header( stream << std::setw(PRINT_VAR_PAD) << std::left << "File created:"; std::ostringstream datetime_ss; boost::posix_time::time_facet* p_time_output = new boost::posix_time::time_facet; - std::locale special_locale (std::locale(""), p_time_output); + std::locale special_locale (std::locale::classic(), p_time_output); // special_locale takes ownership of the p_time_output facet datetime_ss.imbue (special_locale); (*p_time_output).format("%A, %d %B %Y, %X"); diff --git a/dynadjust/include/functions/dnatemplatedatetimefuncs.hpp b/dynadjust/include/functions/dnatemplatedatetimefuncs.hpp index 789507910..d5171ce1f 100644 --- a/dynadjust/include/functions/dnatemplatedatetimefuncs.hpp +++ b/dynadjust/include/functions/dnatemplatedatetimefuncs.hpp @@ -548,7 +548,7 @@ T formattedDateTimeString() { std::stringstream datetime_ss, stream; boost::posix_time::time_facet* p_time_output = new boost::posix_time::time_facet; - std::locale special_locale (std::locale(""), p_time_output); + std::locale special_locale (std::locale::classic(), p_time_output); // special_locale takes ownership of the p_time_output facet datetime_ss.imbue (special_locale); From eb53c637fa482f0c4cbab58391e99414d5ae847c Mon Sep 17 00:00:00 2001 From: Dale Roberts Date: Thu, 19 Mar 2026 12:34:52 +1100 Subject: [PATCH 2/4] Set LD_LIBRARY_PATH for Intel MKL testing, and set Threads --- .github/workflows/build_and_test.yml | 6 ++++-- dynadjust/CMakeLists.txt | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 5c6cb0704..9bfa2a6aa 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -1145,8 +1145,9 @@ jobs: # Source Intel OneAPI environment source /opt/intel/oneapi/setvars.sh - # Modify PATH to use our binaries + # Modify PATH and LD_LIBRARY_PATH to use our binaries export PATH="../bin:$PATH" + export LD_LIBRARY_PATH="../bin:${LD_LIBRARY_PATH:-}" # Run the test script and capture output set +e # Don't exit on error @@ -1169,8 +1170,9 @@ jobs: # Source Intel OneAPI environment source /opt/intel/oneapi/setvars.sh - # Modify PATH to use our binaries + # Modify PATH and LD_LIBRARY_PATH to use our binaries export PATH="../bin:$PATH" + export LD_LIBRARY_PATH="../bin:${LD_LIBRARY_PATH:-}" # Run the test script and capture output set +e # Don't exit on error diff --git a/dynadjust/CMakeLists.txt b/dynadjust/CMakeLists.txt index 6ad420c4f..eac2f9dc1 100644 --- a/dynadjust/CMakeLists.txt +++ b/dynadjust/CMakeLists.txt @@ -300,10 +300,13 @@ message(STATUS "Found Boost version: ${Boost_VERSION}") # Set up libraries # ---------------------------------------------------------------------------- +find_package(Threads REQUIRED) + set(DNA_LIBRARIES ${Boost_LIBRARIES} ${XercesC_LIBRARIES} ${XERCES_ICU_LIBRARIES} + Threads::Threads ) # ---------------------------------------------------------------------------- From d16c3749b6596de16ecd4ffa01d5e614c473d226 Mon Sep 17 00:00:00 2001 From: Dale Roberts Date: Thu, 19 Mar 2026 13:57:06 +1100 Subject: [PATCH 3/4] Static build fixes for locale and threading --- dynadjust/cmake/StaticBuildOptimizations.cmake | 17 +++++++++++++++-- dynadjust/include/config/dnaversion.hpp | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/dynadjust/cmake/StaticBuildOptimizations.cmake b/dynadjust/cmake/StaticBuildOptimizations.cmake index 2f3d45716..46b1126d2 100644 --- a/dynadjust/cmake/StaticBuildOptimizations.cmake +++ b/dynadjust/cmake/StaticBuildOptimizations.cmake @@ -6,13 +6,26 @@ function(optimize_static_target TARGET_NAME) if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") set_property(TARGET ${TARGET_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) endif() - + # Platform-specific optimizations if(UNIX AND NOT APPLE) # Linux-specific optimizations target_link_options(${TARGET_NAME} PRIVATE -static - -Wl,--gc-sections # Remove unused sections + -pthread + # Clang + static glibc: libstdc++'s gthr-posix.h uses __weakref__ aliases + # for pthread functions. GCC resolves these at link time, but Clang leaves + # them as null, causing segfaults when std::thread calls through them. + # Force the linker to pull in the real symbols from libc.a. + -Wl,-u,pthread_create + -Wl,-u,pthread_join + -Wl,-u,pthread_cancel + -Wl,-u,pthread_detach + -Wl,-u,pthread_mutex_lock + -Wl,-u,pthread_mutex_unlock + -Wl,-u,pthread_once + -Wl,-u,pthread_key_create + -Wl,--gc-sections # Remove unused sections -Wl,--as-needed # Only link libraries that are actually used -Wl,-O2 # Optimize at link time -Wl,--strip-all # Strip all symbols diff --git a/dynadjust/include/config/dnaversion.hpp b/dynadjust/include/config/dnaversion.hpp index 7bea80c4c..2216669e4 100644 --- a/dynadjust/include/config/dnaversion.hpp +++ b/dynadjust/include/config/dnaversion.hpp @@ -310,7 +310,7 @@ const char* const __plot_dll_name__ = "libdnaplot.so"; #if defined(__clang__) // Clang compiler #define __COMPILER__ "Clang" - #define __COMPILER_VERSION__ __VERSION__ + #define __COMPILER_VERSION__ __clang_version__ #elif defined(__GNUC__) || defined(__GNUG__) // GNU GCC #define __COMPILER__ "GNU GCC" #define __COMPILER_VERSION__ __VERSION__ From 412942857878587b55da11e3eae2cb2a98b0428e Mon Sep 17 00:00:00 2001 From: Dale Roberts Date: Thu, 19 Mar 2026 14:04:50 +1100 Subject: [PATCH 4/4] Fix CMAKE_ARCHIVE_OUTPUT_DIRECTORY --- dynadjust/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dynadjust/CMakeLists.txt b/dynadjust/CMakeLists.txt index eac2f9dc1..f49e96f67 100644 --- a/dynadjust/CMakeLists.txt +++ b/dynadjust/CMakeLists.txt @@ -63,6 +63,12 @@ endif() if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/../bin) endif() +if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/../bin) +endif() +if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/../bin) +endif() # For multi-config generators (Visual Studio, Xcode) foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})