Building from the source code - Matlab Not found - Java wrapping

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Dario Cazzola
Posts: 44
Joined: Mon Jun 03, 2013 8:08 am

Building from the source code - Matlab Not found - Java wrapping

Post by Dario Cazzola » Sat Feb 15, 2020 10:08 am

Hi All,

I am trying to build OpenSim 4.0 from the source cose from a OSX, and I am following this instructions: https://github.com/opensim-org/opensim- ... sing-xcode

However I get the following error when I build the JAVA wrapping:
Screenshot 2020-02-15 at 16.58.19.png
Screenshot 2020-02-15 at 16.58.19.png (698.1 KiB) Viewed 522 times
Therefore when I run the test I get this output:
Screenshot 2020-02-15 at 16.58.59.png
Screenshot 2020-02-15 at 16.58.59.png (117.88 KiB) Viewed 522 times
MATLAB is installed on my Mac but in /Application. Do I need to run this code (https://github.com/opensim-org/opensim- ... tlab.cmake ) to fix the problem?

Many thanks.

Dario

Tags:

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: Building from the source code - Matlab Not found - Java wrapping

Post by Christopher Dembia » Sat Feb 15, 2020 11:21 am

What version of Matlab do you have? The issue is usually that your version is more recent than FindMatlab.cmake knows about.

You can probably install and the Matlab bindings will still work fine.

User avatar
Ayman Habib
Posts: 2238
Joined: Fri Apr 01, 2005 12:24 pm

Re: Building from the source code - Matlab Not found - Java wrapping

Post by Ayman Habib » Sat Feb 15, 2020 12:41 pm

Dario,

Before you even look into Matlab, make sure the Java bindings build and that the java tests pass. Check for compilation errors of Java bindings, likely due to using wrong version of SWIG and/or JDK (Java 1.8 expected 9 unsupported).

-Ayman

User avatar
Dario Cazzola
Posts: 44
Joined: Mon Jun 03, 2013 8:08 am

Re: Building from the source code - Matlab Not found - Java wrapping

Post by Dario Cazzola » Mon Feb 17, 2020 5:56 am

@Chris: Thanks! Yep, I have installed Matlab 2019a.

@Ayman: Thanks! I think you're right. I got 8 errors and 4 warnings.

I have used Home-brew to install swing (currently version 4.0.1) and Java (version SE 13.0.2 ):
brew install cmake swig
brew cask install java

Does this look OK?

Thanks a lot.

Dario


PS: I have copied the errors here below:
make[2]: *** [Bindings/Java/src/org-opensim-modeling.jar] Error 1
make[1]: *** [Bindings/Java/CMakeFiles/JavaBindings.dir/all] Error 2

org/opensim/modeling/StdMapStringTimeSeriesTableVec3.java:57: error: incompatible types: SWIGTYPE_p_std__mapT_std__string_std__shared_ptrT_OpenSim__TimeSeriesTable_T_SimTK__Vec3_t_t_std__lessT_std__string_t_t__iterator cannot be converted to Iterator
Iterator itr = find((String) key);
^
org/opensim/modeling/StdMapStringTimeSeriesTableVec3.java:66: error: incompatible types: SWIGTYPE_p_std__mapT_std__string_std__shared_ptrT_OpenSim__TimeSeriesTable_T_SimTK__Vec3_t_t_std__lessT_std__string_t_t__iterator cannot be converted to Iterator
Iterator itr = find((String) key);
^
org/opensim/modeling/StdMapStringTimeSeriesTableVec3.java:82: error: incompatible types: SWIGTYPE_p_std__mapT_std__string_std__shared_ptrT_OpenSim__TimeSeriesTable_T_SimTK__Vec3_t_t_std__lessT_std__string_t_t__iterator cannot be converted to Iterator
Iterator itr = find((String) key);
^
org/opensim/modeling/StdMapStringTimeSeriesTableVec3.java:85: error: incompatible types: Iterator cannot be converted to SWIGTYPE_p_std__mapT_std__string_std__shared_ptrT_OpenSim__TimeSeriesTable_T_SimTK__Vec3_t_t_std__lessT_std__string_t_t__iterator
removeUnchecked(itr);
^
org/opensim/modeling/StdMapStringTimeSeriesTableVec3.java:96: error: incompatible types: SWIGTYPE_p_std__mapT_std__string_std__shared_ptrT_OpenSim__TimeSeriesTable_T_SimTK__Vec3_t_t_std__lessT_std__string_t_t__iterator cannot be converted to Iterator
Iterator itr = begin();
^
org/opensim/modeling/StdMapStringTimeSeriesTableVec3.java:97: error: incompatible types: SWIGTYPE_p_std__mapT_std__string_std__shared_ptrT_OpenSim__TimeSeriesTable_T_SimTK__Vec3_t_t_std__lessT_std__string_t_t__iterator cannot be converted to Iterator
final Iterator end = end();
^
org/opensim/modeling/StdMapStringTimeSeriesTableVec3.java:98: error: incompatible types: Iterator cannot be converted to SWIGTYPE_p_std__mapT_std__string_std__shared_ptrT_OpenSim__TimeSeriesTable_T_SimTK__Vec3_t_t_std__lessT_std__string_t_t__iterator
while (itr.isNot(end)) {
^
org/opensim/modeling/StdMapStringTimeSeriesTableVec3.java:121: error: incompatible types: SWIGTYPE_p_std__mapT_std__string_std__shared_ptrT_OpenSim__TimeSeriesTable_T_SimTK__Vec3_t_t_std__lessT_std__string_t_t__iterator cannot be converted to Iterator
itr = itr.getNextUnchecked();

User avatar
Ayman Habib
Posts: 2238
Joined: Fri Apr 01, 2005 12:24 pm

Re: Building from the source code - Matlab Not found - Java wrapping

Post by Ayman Habib » Mon Feb 17, 2020 3:52 pm

Hi Dario,

Swig version 4.0 is not supported yet (we saw similar errors to what you got when we tried it out of the box), we're working on it but as of now please use SWIG 3.0.9 if you can and let us know if it solves your build issues.

Best regards,
-Ayman

User avatar
Dario Cazzola
Posts: 44
Joined: Mon Jun 03, 2013 8:08 am

Re: Building from the source code - Matlab Not found - Java wrapping

Post by Dario Cazzola » Tue Feb 18, 2020 4:00 am

Hi Ayman,

Thanks for the great tip.

I can confirm that SWIG 3.0.9 works well:
Screenshot 2020-02-18 at 10.56.28.png
Screenshot 2020-02-18 at 10.56.28.png (52.45 KiB) Viewed 466 times
I have downloaded SWIG 3.0.9 and followed this installation instructions:
1) Make sure you have installed pcre (Perl-Compatible Regular Expression) first to successfully compile SWIG.
2) Open a terminal window.
3) Make your working directory the folder: SWIG.
4) Type ./configure.
5) Type make.
6) Type sudo make install and input your administrator password upon prompt.
7) Make sure that the folder that contains the swig executable (the version to use is specified in Requirements to build the Integration yourself:) is in the Xcode PATH variable. The default location is /usr/local/bin.

Then I run again the following:

cd opensim_build
cmake ../opensim-core \
-DCMAKE_INSTALL_PREFIX="~/opensim_install" \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DBUILD_PYTHON_WRAPPING=ON \
-DBUILD_JAVA_WRAPPING=ON \
-DOPENSIM_DEPENDENCIES_DIR="~/opensim_dependencies_install" \
-DWITH_BTK=ON
make -j8
ctest -j8
make -j8 install

Hope it helps.

Dario

POST REPLY