jsonnet icon indicating copy to clipboard operation
jsonnet copied to clipboard

Shared libjsonnet++ not linked against libjosnnet

Open thkukuk opened this issue 4 years ago • 2 comments

If you have a stricter linker, who does not like unresolved symbols in a shared library (which is always a bad idea), the build will fail when generating libjsonnet++.so.0.15.0.

Possible fix:

--- cpp/CMakeLists.txt
+++ cpp/CMakeLists.txt  2020/03/06 11:50:35
@@ -38,6 +38,9 @@
     add_library(libjsonnet++_for_binaries ALIAS libjsonnet++_static)
 endif()
 
+add_dependencies(libjsonnet++ jsonnet)
+target_link_libraries(libjsonnet++ libjsonnet)
+
 # Tests
 function(add_test_executablepp test_name)
     if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/${test_name}.cpp)

thkukuk avatar Mar 06 '20 11:03 thkukuk

Thanks for reporting. We should do something about it.

sbarzowski avatar Mar 06 '20 14:03 sbarzowski

Hi, just a note that adding target_link_libraries(libjsonnet++ libjsonnet) (the other was already present) as mentioned in the OP fixed a linking error for me on aarch64-darwin.

See https://github.com/NixOS/nixpkgs/issues/239912

nrhtr avatar Jul 10 '23 12:07 nrhtr

Thanks for reporting this! It looks like the necessary target_link_libraries command was added with PR #1113 (November 2023). I'll close this as complete.

johnbartholomew avatar Mar 03 '24 00:03 johnbartholomew