opensim-core icon indicating copy to clipboard operation
opensim-core copied to clipboard

Issues with building the casadi and BTK dependency

Open willov opened this issue 2 years ago • 2 comments

This issue have been edited since the first submission. After more testing and with the newer version, the following is now the issue:

This has been run on Arch Linux, kernel: 5.18.14-arch1-1 gcc: 12.1.0 Swig: 4.0.2

First off, when selecting everything at the first cmake-gui step (the dependencies step), it was not possible to build the BTK and casadi package. In the case of casadi, I assume it has something to do with ipopt not being compiled properly. This is the error:

In file included from /home/william/Software/opensim-core-source/dependencies/casadi/casadi/interfaces/ipopt/ipopt_interface.cpp:28: /home/william/Software/opensim-core-source/dependencies/casadi/casadi/interfaces/ipopt/ipopt_nlp.hpp:29:10: fatal error: IpTNLP.hpp: No such file or directory 29 | #include <IpTNLP.hpp> | ^~~~~~~~~~~~ compilation terminated. make[5]: *** [casadi/interfaces/ipopt/CMakeFiles/casadi_nlpsol_ipopt.dir/build.make:76: casadi/interfaces/ipopt/CMakeFiles/casadi_nlpsol_ipopt.dir/ipopt_interface.cpp.o] Error 1 make[4]: *** [CMakeFiles/Makefile2:650: casadi/interfaces/ipopt/CMakeFiles/casadi_nlpsol_ipopt.dir/all] Error 2 make[3]: *** [Makefile:156: all] Error 2 make[2]: *** [CMakeFiles/casadi.dir/build.make:86: casadi/stamp/casadi-build] Error 2 make[1]: *** [CMakeFiles/Makefile2:251: CMakeFiles/casadi.dir/all] Error 2 make: *** [Makefile:91: all] Error 2

Although it was possible to compile the casadi package manually running make casadi before the full make command. I wonder if could have something to do with different packages relying on ipopt? Perhaps they use different naming (ipopt/Ipopt/IPOPT). Running make BTK starts a compilation, but is not able to finish due to many errors:

from /home/william/Software/opensim-core-source/dependencies/BTK/Code/IO/btkMDFFileIO.cpp:37: /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/OpenORM/Mappings/RichBinary/BinaryStructure.h:32:112: error: ISO C++17 does not allow dynamic exception specifications 32 | void GetFieldOffset(BinaryFieldSpec const*& spec, size_t& offset, const char* fieldname) const throw(NoSuchFieldException); | ^~~~~

In file included from /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/Biomechanics/Trial/EventGroup.h:12, from /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/Biomechanics/Trial/Trial.h:12: /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/OpenORM/Mappings/RichBinary/BinIter.h:34:148: error: ISO C++17 does not allow dynamic exception specifications 34 | tic const DataType* GetFieldPointer(const RichBinary& bin, const char* fieldname, size_t dimension) throw(NoSuchFieldException) | ^~~~~

/home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/OpenORM/Mappings/RichBinary/BinIter.h:163:87: error: ISO C++17 does not allow dynamic exception specifications 163 | BinConstIter1(const RichBinary& bin, const char* fieldA, size_t dimA) throw(NoSuchFieldException) : | ^~~~~ /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/OpenORM/Mappings/RichBinary/BinIter.h:194:77: error: ISO C++17 does not allow dynamic exception specifications 194 | BinIter1(RichBinary& bin, const char* fieldA, size_t dimA) throw(NoSuchFieldException) : | ^~~~~ /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/OpenORM/Mappings/RichBinary/BinIter.h:208:120: error: ISO C++17 does not allow dynamic exception specifications 208 | ConstIter2(const RichBinary& bin, const char* fieldA, size_t dimA, const char* fieldB, size_t dimB) throw(NoSuchFieldException) : | ^~~~~

/home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/OpenORM/Mappings/RichBinary/BinIter.h:241:115: error: ISO C++17 does not allow dynamic exception specifications 241 | BinIter2(const RichBinary& bin, const char* fieldA, size_t dimA, const char* fieldB, size_t dimB) throw(NoSuchFieldException) : | ^~~~~

/home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/OpenORM/Mappings/RichBinary/BinIter.h:257:153: error: ISO C++17 does not allow dynamic exception specifications 257 | const char* fieldA, size_t dimA, const char* fieldB, size_t dimB, const char* fieldC, size_t dimC) throw(NoSuchFieldException) : | ^~~~~

/home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/OpenORM/Mappings/RichBinary/BinIter.h:290:148: error: ISO C++17 does not allow dynamic exception specifications 290 | const char* fieldA, size_t dimA, const char* fieldB, size_t dimB, const char* fieldC, size_t dimC) throw(NoSuchFieldException) : | ^~~~~

/home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/MotionFile/MotionFileHandler.h:40:181: error: ISO C++17 does not allow dynamic exception specifications 40 | & formatlist = MotionFileFormatListAll(), const BinMemFactory& memfactory = BinMemFactoryDefault()) throw(MotionFileException); | ^~~~~

/home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/MotionFile/MotionFileHandler.h:43:177: error: ISO C++17 does not allow dynamic exception specifications 43 | & formatlist = MotionFileFormatListAll(), const BinMemFactory& memfactory = BinMemFactoryDefault()) throw(MotionFileException); | ^~~~~

/home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/MotionFile/MotionFileHandler.h:46:176: error: ISO C++17 does not allow dynamic exception specifications 46 | const TreeValue* writeoptions, const MotionFileFormatList& formatlist = MotionFileFormatListAll()) throw(MotionFileException); | ^~~~~

/home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/MotionFile/MotionFileHandler.h:49:194: error: ISO C++17 does not allow dynamic exception specifications 49 | const TreeValue* writeoptions, const MotionFileFormatList& formatlist = MotionFileFormatListAll()) throw(MotionFileException); | ^~~~~

/home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/MotionFile/MotionFileFormat.h:64:107: error: ISO C++17 does not allow dynamic exception specifications 64 | rtual bool Probe(const MotionFileHandler& context, TreeValue*& readoptions, std::istream& is) const throw(MotionFileException) = 0; | ^~~~~

/home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/MotionFile/MotionFileFormat.h:67:150: error: ISO C++17 does not allow dynamic exception specifications 67 | er& context, std::istream& is, const BinMemFactory& memfactory, const TreeValue* readoptions) const throw(MotionFileException) = 0; | ^~~~~

/home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/MotionFile/MotionFileFormat.h:70:140: error: ISO C++17 does not allow dynamic exception specifications 70 | Handler& context, const TreeValue* contents, std::ostream& os, const TreeValue* writeoptions) const throw(MotionFileException) = 0; | ^~~~~

In file included from /home/william/Software/opensim-core-source/dependencies/BTK/Code/IO/btkCodamotionFileIOUtils_p.h:48: /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/Biomechanics/Trial/TSFactory.h:54:59: error: ISO C++17 does not allow dynamic exception specifications 54 | TSScalarConstIter(const TimeSequence& ts) throw(NoSuchFieldException) : | ^~~~~ /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/Biomechanics/Trial/TSFactory.h:67:48: error: ISO C++17 does not allow dynamic exception specifications 67 | TSScalarIter(TimeSequence& ts) throw(NoSuchFieldException) : | ^~~~~ /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/Biomechanics/Trial/TSFactory.h:80:68: error: ISO C++17 does not allow dynamic exception specifications 80 | TSVector3ConstIter(const TimeSequence& ts) throw(NoSuchFieldException) : | ^~~~~ /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/Biomechanics/Trial/TSFactory.h:93:49: error: ISO C++17 does not allow dynamic exception specifications 93 | TSVector3Iter(TimeSequence& ts) throw(NoSuchFieldException) : | ^~~~~ /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/Biomechanics/Trial/TSFactory.h:106:71: error: ISO C++17 does not allow dynamic exception specifications 106 | TSOccVector3ConstIter(const TimeSequence& ts) throw(NoSuchFieldException) : | ^~~~~ /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/Biomechanics/Trial/TSFactory.h:122:52: error: ISO C++17 does not allow dynamic exception specifications 122 | TSOccVector3Iter(TimeSequence& ts) throw(NoSuchFieldException) : | ^~~~~ /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/Biomechanics/Trial/TSFactory.h:138:56: error: ISO C++17 does not allow dynamic exception specifications 138 | TSOccConstIter(const TimeSequence& ts) throw(NoSuchFieldException) : | ^~~~~ /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/Biomechanics/Trial/TSFactory.h:151:45: error: ISO C++17 does not allow dynamic exception specifications 151 | TSOccIter(TimeSequence& ts) throw(NoSuchFieldException) : | ^~~~~ /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/Biomechanics/Trial/TSFactory.h:164:87: error: ISO C++17 does not allow dynamic exception specifications 164 | TSOccMatrix3x3ConstIter(const Open3DMotion::TimeSequence& ts) throw(Open3DMotion::NoSuchFieldException) : | ^~~~~ /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/Biomechanics/Trial/TSFactory.h:180:76: error: ISO C++17 does not allow dynamic exception specifications 180 | TSOccMatrix3x3Iter(Open3DMotion::TimeSequence& ts) throw(Open3DMotion::NoSuchFieldException) : | ^~~~~ In file included from /home/william/Software/opensim-core-source/dependencies/BTK/Code/IO/btkMDFFileIO.cpp:40: /home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/MotionFile/Formats/MDF/FileFormatMDF.h:70:107: error: ISO C++17 does not allow dynamic exception specifications 70 | rtual bool Probe(const MotionFileHandler& context, TreeValue*& readoptions, std::istream& is) const throw(MotionFileException); | ^~~~~

/home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/MotionFile/Formats/MDF/FileFormatMDF.h:73:150: error: ISO C++17 does not allow dynamic exception specifications 73 | er& context, std::istream& is, const BinMemFactory& memfactory, const TreeValue* readoptions) const throw(MotionFileException) ; | ^~~~~

/home/william/Software/opensim-core-source/dependencies/BTK/Utilities/Open3DMotion/src/Open3DMotion/MotionFile/Formats/MDF/FileFormatMDF.h:76:140: error: ISO C++17 does not allow dynamic exception specifications 76 | Handler& context, const TreeValue* contents, std::ostream& os, const TreeValue* writeoptions) const throw(MotionFileException); | ^~~~~

make[6]: *** [Code/IO/CMakeFiles/BTKIO.dir/build.make:384: Code/IO/CMakeFiles/BTKIO.dir/btkMDFFileIO.cpp.o] Error 1 make[5]: *** [CMakeFiles/Makefile2:270: Code/IO/CMakeFiles/BTKIO.dir/all] Error 2 make[4]: *** [Makefile:136: all] Error 2 make[3]: *** [CMakeFiles/BTK.dir/build.make:86: BTK/stamp/BTK-build] Error 2 make[2]: *** [CMakeFiles/Makefile2:125: CMakeFiles/BTK.dir/all] Error 2 make[1]: *** [CMakeFiles/Makefile2:132: CMakeFiles/BTK.dir/rule] Error 2 make: *** [Makefile:137: BTK] Error 2

If running without BTK, and compiling casadi manually first, the dependencies build without issue. Note that if Tropter was not built, the next build step (of the main code) complains of a missing ADOLC dependency. Even if Tropter is not selected.

Building the main code, with python bindings, appears to work. Seven test fails with timeout, and will be re run. I will update this later on to confirm if it is actually working or not.

willov avatar Jul 14 '22 21:07 willov

libadolc.so.2 was not copied on install and had to be copied manually from the depency-install location to install/lib.

The libipopt.so.1 symlink was also not present. So I had to copy libipopt.so.1.10.8 to lib, and link libipopt.so.1 to it. The same goes for libcoinmumps.so.1, linked to libcoinmumps.so.1.6.0, libcoinmetis.so.1 to libcoinmetis.so.1.3.5.

At least then the opensim-cmd runs without error. I have yet to test any real example to validate if this actually works.

willov avatar Jul 27 '22 15:07 willov

Went back to reinstall with java support, and realized that there were more issues when building the python bindings.

make[2]: *** No rule to make target 'Bindings/Python/Bindings/preliminaries.i', needed by 'Bindings/Python/simbody.py'. Stop. make[1]: *** [CMakeFiles/Makefile2:7145: Bindings/Python/CMakeFiles/_simbody.dir/all] Error 2

In the build folder, in build/Bindings/Python/CMakeFiles/_simbody.dir/build.cmake, on line 75 and 76:

Bindings/Python/simbody.py: Bindings/Python/Bindings/preliminaries.i Bindings/Python/simbody.py: Bindings/Python/Bindings/simbody.i

If I manually change the above to by replacing Bindings/Python with absolute_path_to_source,i.e. to the following it works:

Bindings/Python/simbody.py: absolute_path_to_source/Bindings/preliminaries.i Bindings/Python/simbody.py: absolute_path_to_source/Bindings/simbody.i

When this was fixed, it triggers the same or similar issue in the other build.make in Bindings/Python/CMakeFiles/(_common.dir, _simulation.dir, _actuators.dir, _analyses.dir, _tools.dir, _examplecomponents.dir, _moco.dir). In all cases, Bindings/Python should be replaced with absolute_path_to_source.

This is then repeated with the java bindings:

make[2]: *** No rule to make target 'Bindings/Java/OpenSimJNI/Bindings/preliminaries.i', needed by 'Bindings/Java/OpenSimJNI/java_simulation.cxx'. Stop. make[1]: *** [CMakeFiles/Makefile2:7494: Bindings/Java/OpenSimJNI/CMakeFiles/osimJavaJNI.dir/all] Error 2

Again at line 74 and 75 (and then a few more places):

Bindings/Java/OpenSimJNI/java_simbody.cxx: Bindings/Java/OpenSimJNI/Bindings/preliminaries.i Bindings/Java/OpenSimJNI/java_simbody.cxx: Bindings/Java/OpenSimJNI/Bindings/simbody.i

This time, replacingBindings/Java/OpenSimJNI with absolute_path_to_source. And later on, replacing the same in more places. Now, it occured in the make file in the osimJavaJNI.dir,

Unfortunately, the java testa does not finish succesfully. I will have to look into what is the issue a bit more and get back

willov avatar Jul 31 '22 18:07 willov

Please re-open if you are still having issues. Thanks!

jenhicks avatar Nov 23 '22 19:11 jenhicks