Page 1 of 1

SIMBODY_STANDARD_11/OPENSIM_STANDARD_11

Posted: Thu Dec 01, 2016 10:43 am
by mohammadhossein
Hello,

Previously, I have written code for the simulation of bipedal walking using Opensim API in C++ in windows (VS), and it works well.

I wanted to use our campus supercomputer (linux based) to run my codes.
I built simbody and opensim from source on it. Based on the instructions in following page for linux
http://simtk-confluence.stanford.edu:80 ... rom+Source
I turned off SIMBODY_STANDARD_11 and OPENSIM_STANDARD_11 when Simbody and Opensim.

Now when I'm compiling my codes, I get error: my codes needs c++11 features. I have used c++11 features in my own codes. My codes are really long, and I couldn't detect and remove all the c++ features, I have used.

Hence, I used "add_definitions(-std=c++11)" in my cmake file, and I could compile my codes. But now when I run the executable file I have generated, I receive segmentation error. I traced back and the error is somewhere in the Simbody package I have built.

Now please help me with this situation.

I also tried to use Open Science Grid, I could build simple opensim c++ programs and run on several cores, but when I try to build my own codes I receive similar errors as above. I believe the simbody and opensim on OpenScienceGrid server are installed without enabling c++11 standard.

Thanks a lot in advance.

Re: SIMBODY_STANDARD_11/OPENSIM_STANDARD_11

Posted: Thu Dec 01, 2016 1:51 pm
by mitkof6
add_definitions is the wrong way. You need to change the flags of the compiler. Why don't you want to build with c++11, do they support the new compiler?

Code: Select all

# c++11
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR
        "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
    # Using C++11 on OSX requires using libc++ instead of libstd++.
    # libc++ is an implementation of the C++ standard library for OSX.
    if(APPLE)
        if(XCODE)
            set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
            set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
        else()
            set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -stdlib=libc++")
        endif()
    else()
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
    endif()
endif()
or just

Code: Select all

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

Re: SIMBODY_STANDARD_11/OPENSIM_STANDARD_11

Posted: Thu Dec 01, 2016 2:29 pm
by mohammadhossein
Thank you Dimitar.

I didn't want to use c++11, because in the instructions for buildin on linux, it was mentioned that I would receive mysterious errors later.

Is there any way that I use c++11 just for my codes and not for opensim and simbody dependencies?

By the way, if I want to use opensim on OpenScienceGrid, I can not change the installation of opensim on it. Am I right?

Re: SIMBODY_STANDARD_11/OPENSIM_STANDARD_11

Posted: Thu Dec 01, 2016 3:14 pm
by chrisdembia
It is possible to use SIMBODY_STANDARD_11=on and OPENSIM_STANDARD_11=on. Then you can use C++11 in your own code.