Open vegardjervell opened 1 year ago
Hi, thanks for your interest. I haven't been actively working on this repo in quite a while because I am no longer involved in the project that needed this wrapping approach. I'm not particularly up to date on what all alternatives are out there these days, but this was kind of a niche solution when it was originally developed, and I wasn't aware of other work taking this same approach.
I'm open to helping address minor issues, but I probably won't have time for significant developments/enhancements.
Based on your errors, I don't think this is a wrapping issue. My first guess is it may be an incompatibility between the C++ compiler that is compiled the C++ object code vs the libstdc++ that it is linking to. The tests use a Makefile that uses Fortran as the linker language, and it links against libstdc++:
I'm not super-familiar with Macs, but my understanding is the default C/C++ toolchains use Clang. If you do g++ --version
on a default install, I think it will indicate Clang. I'm not sure if you also have GNU g++ installed, but maybe there's a mismatch between the C++ compiler and the libstdc++ that is being linked? If you have a working mixed-language compilation Makefile/command, you might check that and see if you can adapt the compilation/linking commands in the FortWrap test Makefile.
Another thought is you might try the iso_c_binding
branch and see if that changes anything. That uses a more portable wrapping approach. I don't think that will fix your issue, though, since I think your errors are not originating from the wrapping code, but it's worth a try.
Thanks for your quick reply! What you outline seems reasonable, I'll have a closer look at the makefiles and the iso_c_binding
branch. If you don't really maintain this anymore I won't expect any updates, but I'll leave a PR if we move forward with this and make any further developments :)
First of all I want to say that this project looks awesome! I am currently looking at options for refactoring and making a robust wrapper for a quite large Fortran project, and this looks like exactly what I need!
I noticed this repo has been quiet for a while, and was also kind of wondering why? Have better options come up or is it just one of those things that has gone quiet after a while?
Finally (i needed an excuse to post an issue): When running
run_tests.py
I get some failed builds, running gfortran 12.2.0 on MacBook Pro with M1 Pro (arm64) chip. Specifically:They all result from similar
Undefined symbols for architecture arm64:
errors, respectively:matrices :
"__ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv", referenced from: __ZNKSt3__113__vector_baseIiNS_9allocatorIiEEE20__throw_length_errorEv in prog.o
pointers :
"__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKc", referenced from: __ZN6Object19get_alias_with_charEPNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE in Object.o
arrays :
"__ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv", referenced from: __ZNKSt3__113__vector_baseIiNS_9allocatorIiEEE20__throw_length_errorEv in prog.o
complex :
"__ZNKSt3__120__vector_base_commonILb1EE20__throw_length_errorEv", referenced from: __ZNKSt3__113__vector_baseINS_7complexIfEENS_9allocatorIS2_EEE20__throw_length_errorEv in prog.o
strings :
"__ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEPKc", referenced from: _main in prog.o "__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKc", referenced from: __ZN9FortFuncs22string_out_literal_lenEPNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE in FortFuncs.o __ZN9FortFuncs23string_out_literal_len2EPNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE in FortFuncs.o __ZN9FortFuncs20string_out_param_lenEPNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES7_S7_S7_ in FortFuncs.o __ZN9FortFuncs21string_out_param_len2EPNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEES7_S7_S7_ in FortFuncs.o __ZN9FortFuncs22string_out_assumed_lenEPNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEiS7_ in FortFuncs.o __ZN9FortFuncs13multiple_argsEiPKcfPNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE in FortFuncs.o __ZN9FortFuncs12optional_outEPNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE in FortFuncs.o ... "__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6resizeEmc", referenced from: __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6resizeEm in prog.o "__ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEED1Ev", referenced from: _main in prog.o
I also got some linker warnings that I'm currently looking more closely at. However (and more importantly for what I need) the
classes
seem to run as expected. I'll let you know if I move forward with this and find a fix.