Skip to content

Commit 8764fa5

Browse files
committed
Respect LDSHAREDXX in RbConfig
1 parent 0bf3059 commit 8764fa5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

ext/jsonnet/extconf.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ def using_system_libraries?
77

88
dir_config('jsonnet')
99

10-
RbConfig::MAKEFILE_CONFIG['LDSHARED'] = '$(CXX) -shared'
1110
unless using_system_libraries?
1211
message "Building jsonnet using packaged libraries.\n"
1312
require 'rubygems'
@@ -77,6 +76,13 @@ def target_object_files
7776
# but the makefile to fail. These commands add the necessary paths to do both
7877
$LIBPATH = ["#{recipe.path}/lib"] | $LIBPATH
7978
$CPPFLAGS << " -I#{recipe.path}/include"
79+
80+
# jsonnet_wrap extension must be linked with c++ stdlib because
81+
# the C++ library Rapid YAML is being statically linked.
82+
rbconfig = RbConfig::MAKEFILE_CONFIG
83+
if rbconfig['LDSHAREDXX']
84+
rbconfig['LDSHARED'] = rbconfig['LDSHAREDXX']
85+
end
8086
end
8187

8288
abort 'libjsonnet.h not found' unless have_header('libjsonnet.h')

0 commit comments

Comments
 (0)