Skip to content

Please adapt code to build properly with static and dynamic boost libraries #165

@stoecker

Description

@stoecker

Packaging rules for most distributions require to build programs ONLY against dynamic libraries. Usually static libraries aren't available anymore at all. ginan has hardcoded static settings and also wont properly build against dynamic libraries without some workarounds (usually linker errors).

Please fix this.

Also please support build against newest boost version, which has no longer the "system" component.

For openSUSE I build with
%cmake -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_STATIC_LIBS:BOOL=ON -DCMAKE_BUILD_TYPE="Release"
-DCMAKE_SKIP_INSTALL_RPATH=ON -DCMAKE_SKIP_RPATH=ON

and following patch:

diff -ur ginan-4.0.0/src/CMakeLists.txt ginan-4.0.0_fix/src/CMakeLists.txt
--- ginan-4.0.0/src/CMakeLists.txt	2025-12-16 01:48:13.000000000 +0100
+++ ginan-4.0.0_fix/src/CMakeLists.txt	2026-01-20 11:08:21.880397242 +0100
@@ -185,14 +185,15 @@
 	set (CMAKE_CXX_FLAGS				"${CMAKE_CXX_FLAGS} -pthread")
 endif()
 
-set(YAML_CPP_USE_STATIC_LIBS ON)
+set(YAML_CPP_USE_STATIC_LIBS OFF)
 find_package(YAML_CPP 0.6.2 REQUIRED)
 
 # OpenSSL - use MODULE mode for vcpkg compatibility (wrapper handles it)
 find_package(OpenSSL REQUIRED)
 
 #set(Boost_NO_SYSTEM_PATHS ON)
-set(Boost_USE_STATIC_LIBS ON)
+set(Boost_USE_STATIC_LIBS OFF)
+add_compile_definitions(BOOST_LOG_DYN_LINK)
 find_package(Boost 1.75.0 REQUIRED COMPONENTS log log_setup date_time system thread program_options serialization timer json)
 
 # Try CONFIG mode first (for vcpkg), fall back to module mode (for brew/system)
diff -ur ginan-4.0.0/src/cpp/3rdparty/nrlmsise/nrlmsise-00.cpp ginan-4.0.0_fix/src/cpp/3rdparty/nrlmsise/nrlmsise-00.cpp
--- ginan-4.0.0/src/cpp/3rdparty/nrlmsise/nrlmsise-00.cpp	2025-12-16 01:48:13.000000000 +0100
+++ ginan-4.0.0_fix/src/cpp/3rdparty/nrlmsise/nrlmsise-00.cpp	2026-01-22 12:29:36.725451318 +0100
@@ -61,7 +61,7 @@
 extern double sam[100];
 
 /* LOWER7 */
-extern double ptm[10];
+extern double ptm[50];
 extern double pdm[8][10];
 extern double pavgm[10];
 
diff -ur ginan-4.0.0/src/cpp/3rdparty/slr/crd.h ginan-4.0.0_fix/src/cpp/3rdparty/slr/crd.h
--- ginan-4.0.0/src/cpp/3rdparty/slr/crd.h	2025-12-16 01:48:13.000000000 +0100
+++ ginan-4.0.0_fix/src/cpp/3rdparty/slr/crd.h	2026-01-20 11:21:26.349936977 +0100
@@ -384,8 +384,6 @@
 int read_h3 (char *, struct CrdH3 *);
 int read_h4 (char *, struct CrdH4 *);
 int read_h5 (char *, struct CrdH5 *);
-int read_h8 (char*);
-int read_h9 (char*);
 int read_c0 (char *, struct CrdC0 *);
 int read_c1 (char *, struct CrdC1 *);
 int read_c2 (char *, struct CrdC2 *);
diff -ur ginan-4.0.0/src/cpp/3rdparty/slr/read_crd.c ginan-4.0.0_fix/src/cpp/3rdparty/slr/read_crd.c
--- ginan-4.0.0/src/cpp/3rdparty/slr/read_crd.c	2025-12-16 01:48:13.000000000 +0100
+++ ginan-4.0.0_fix/src/cpp/3rdparty/slr/read_crd.c	2026-01-20 11:21:12.260721773 +0100
@@ -220,21 +220,6 @@
 return (nstat+1);
 }
 
-/* Need indicators that these have been read? */
-/* H8 - End of Session footer */
-int
-read_h8 (char * str)
-{
-sscanf (str, "H8");
-}
-
-/* H9 - End of File footer */
-int
-read_h9 (char * str)
-{
-sscanf (str, "H9");
-}
-
 /* Ranging data configuration records (1 of n) */
 	/* C0 - System Configuration Record */
 int

The ptm[10/50] is a mismatch in the current code. The read_h8 and read_h9 cause a build errors and are useless functions anyway. The other parts are a workaround for the static/dynamic build issues.

With this build works (see https://build.opensuse.org/package/show/home:dstoecker:ginan/ginan), but these workarounds aren't nice and probably can have unwanted side effects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions