-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++ driver: executable with static ruby + static python #4
Open
jmarrec
wants to merge
16
commits into
master
Choose a base branch
from
c++-driver-try-ruby-static
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…. evcentually I switched to gcc 7.5 since 10 wouldn't build)
… we don't have SwigDirector_Measure name clashing
… must be invocable as const`
…to turn off python for testing
… Add embedded files. Look for static python lib too. Add ability to turn off ruby Ruby will currently fail to undefined reference to rb_hasFile and rb_require_embedded
…(swig generated) and initialized _mylib (the statically linked _mylib.a) and eval this embedded mylib.py ```bash cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON -DCMAKE_BUILD_TYPE:String=Debug -DBUILD_RUBY_BINDINGS:BOOL=OFF .. ```
Init_mylib doesn't work. it segfaults ``` * thread #1, name = 'Test', stop reason = signal SIGSEGV: invalid address (fault address: 0x38) frame #0: 0x00005555558bdd17 Test`rb_usascii_encoding at encoding.c:1342:45 1339 rb_encoding * 1340 rb_usascii_encoding(void) 1341 { -> 1342 return enc_table.list[ENCINDEX_US_ASCII].enc; 1343 } 1344 1345 int ``` So I'm trying to initialize all encodings etc, but I'm not getting anywhere. Trying to include GC_VALUE.hpp results in a multiple definition such as `[100%][2/2] Linking CXX executable Products/Test FAILED: Products/Test : && /usr/bin/c++ -g CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o CMakeFiles/Test.dir/main.cpp.o CMakeFiles/Test.dir/PythonEngine.cpp.o CMakeFiles/Test.dir/RubyEngine.cpp.o CMakeFiles/Test.dir/embedded_scripting_wrap.cxx.o CMakeFiles/Test.dir/embedded_files.cxx.o -o Products/Test Products/libmylib.a Products/libruby_libs.a /home/julien/.pyenv/versions/3.9.1/lib/python3.9/config-3.9-x86_64-linux-gnu/libpython3.9.a Products/python/_mylib.a -licui18n -licuuc -lgmp /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/libruby-static.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/enc/libenc.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/enc/libtrans.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/rmd160.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/generator.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/pty.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/coverage.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/objspace.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/fcntl.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/etc.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/bigdecimal.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/ripper.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/fiddle.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/md5.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/fiber.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/sha1.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/stringio.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/zlib.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/strscan.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/escape.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/bubblebabble.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/nonblock.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/cparse.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/console.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/dbm.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/openssl.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/wait.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/gdbm.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/date_core.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/sizeof.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/syslog.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/monitor.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/sdbm.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/nkf.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/digest.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/sha2.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/readline.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/continuation.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/pathname.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/socket.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/parser.a /home/julien/.conan/data/openstudio_ruby/2.7.2/nrel/testing/package/8c98c8e7c8941d8bf2c5b65aa3303761e4c9336c/lib/ext/psych.a /home/julien/.conan/data/openssl/1.1.0l/_/_/package/75e99b627c196b65c439728670655ec3c366b334/lib/libssl.a /home/julien/.conan/data/openssl/1.1.0l/_/_/package/75e99b627c196b65c439728670655ec3c366b334/lib/libcrypto.a -ldl -lpthread /home/julien/.conan/data/zlib/1.2.11/_/_/package/24a116b2ab4212d508978c9d35c6a171a9b73fee/lib/libminizip.a /home/julien/.conan/data/zlib/1.2.11/_/_/package/24a116b2ab4212d508978c9d35c6a171a9b73fee/lib/libz.a /home/julien/.conan/data/libyaml/0.2.5/_/_/package/75e99b627c196b65c439728670655ec3c366b334/lib/libyaml.a /home/julien/.conan/data/libffi/3.3/_/_/package/75e99b627c196b65c439728670655ec3c366b334/lib/libffi.a /home/julien/.conan/data/gdbm/1.18.1/_/_/package/000d6b046920d22f02cec11ec895b1b45927eb08/lib/libgdbm_compat.a /home/julien/.conan/data/gdbm/1.18.1/_/_/package/000d6b046920d22f02cec11ec895b1b45927eb08/lib/libgdbm.a /home/julien/.conan/data/readline/8.0/_/_/package/adcbf8ecbce351b257a7edb13a6afc81d2e5c6dd/lib/libhistory.a /home/julien/.conan/data/readline/8.0/_/_/package/adcbf8ecbce351b257a7edb13a6afc81d2e5c6dd/lib/libreadline.a /home/julien/.conan/data/termcap/1.3.1/_/_/package/75e99b627c196b65c439728670655ec3c366b334/lib/libtermcap.a /home/julien/.conan/data/gmp/6.2.0/_/_/package/f18760887692af6dc18ffcc3bf0a48e1c02322ca/lib/libgmpxx.a /home/julien/.conan/data/gmp/6.2.0/_/_/package/f18760887692af6dc18ffcc3bf0a48e1c02322ca/lib/libgmp.a Products/libadditional_ruby_libs.a -lanl -lrt -lcrypt -lpthread -ldl -lutil -lm Products/libmylib.a && : CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x0): multiple definition of `swig::GC_VALUE::hash_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x0): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x8): multiple definition of `swig::GC_VALUE::lt_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x8): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x10): multiple definition of `swig::GC_VALUE::gt_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x10): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x18): multiple definition of `swig::GC_VALUE::eq_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x18): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x20): multiple definition of `swig::GC_VALUE::le_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x20): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x28): multiple definition of `swig::GC_VALUE::ge_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x28): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x30): multiple definition of `swig::GC_VALUE::pos_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x30): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x38): multiple definition of `swig::GC_VALUE::neg_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x38): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x40): multiple definition of `swig::GC_VALUE::inv_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x40): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x48): multiple definition of `swig::GC_VALUE::add_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x48): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x50): multiple definition of `swig::GC_VALUE::sub_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x50): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x58): multiple definition of `swig::GC_VALUE::mul_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x58): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x60): multiple definition of `swig::GC_VALUE::div_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x60): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x68): multiple definition of `swig::GC_VALUE::mod_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x68): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x70): multiple definition of `swig::GC_VALUE::and_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x70): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x78): multiple definition of `swig::GC_VALUE::or_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x78): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x80): multiple definition of `swig::GC_VALUE::xor_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x80): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x88): multiple definition of `swig::GC_VALUE::lshift_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x88): first defined here CMakeFiles/Test.dir/RubyEngine.cpp.o:(.bss+0x90): multiple definition of `swig::GC_VALUE::rshift_id' CMakeFiles/mylib_ruby.dir/ruby_wrapper/MeasureRUBY_wrap.cxx.o:(.bss+0x90): first defined here collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.`
…ctor.i really) then it works with ruby too.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I doubt this is the end of the trouble at all, but I have a working executable that is self contained with ruby and python, and more complex bindings than originally
I create a model from the C++ side, add a ModelObject to it. Then run a ruby measure that renames that model, and creates another one. Then a python measure that renames the one created from ruby, and adds a third one.
I can move the executable on my disk, and it still works (the path to the measure.py/ measure.rb are harcoded, but that's the only thing it "loads" dynamically)