Menu

Unable to build outside ACADO source tree

2014-09-10
2019-09-05
  • Andrea Zaneli

    Andrea Zaneli - 2014-09-10

    Hi,

    I'm trying to build my own project outside the source tree as explained here:
    http://sourceforge.net/p/acado/wiki/Using%20CMake%20-%20UNIX%20-%20Common/

    The build fails as follows:

    ==========================================================================================
    $ cmake ..
    -- ***********
    -- ---> Looking for ACADO toolkit:
    -- Found ACADO toolkit include directories:
    /home/zanellia/ACADOtoolkit/include;/home/zanellia/ACADOtoolkit/external_packages;
    /home/zanellia/ACADOtoolkit/external_packages/csparse/;/home/zanellia/ACADOtoolkit/external_packages/qpOASES-
    3.0beta/include;/home/zanellia/ACADOtoolkit/build/include
    -- Found ACADO toolkit library directories: /home/zanellia/ACADOtoolkit/build/libs
    -- Found ACADO static library: acado_toolkit
    -- Could not find ACADO shared library.
    --
    ***********
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/zanellia/ACADO_WS/getting_started/build

    zanellia@AUTWIN165 ~/ACADO_WS/getting_started/build
    $ make
    Linking CXX executable ../simple_ocp.exe
    CMakeFiles/simple_ocp.dir/simple_ocp.cpp.o:simple_ocp.cpp:(.text+0x24): undefined reference
    to ACADO::DifferentialState::DifferentialState()' CMakeFiles/simple_ocp.dir/simple_ocp.cpp.o:simple_ocp.cpp:(.text+0x24): relocation truncated to fit: R_X86_64_PC32 against undefined symbolACADO::DifferentialState::DifferentialState()'
    CMakeFiles/simple_ocp.dir/simple_ocp.cpp.o:simple_ocp.cpp:(.text+0x30): undefined reference
    to ACADO::DifferentialState::DifferentialState()' CMakeFiles/simple_ocp.dir/simple_ocp.cpp.o:simple_ocp.cpp:(.text+0x30): relocation truncated to fit: R_X86_64_PC32 against undefined symbolACADO::DifferentialState::DifferentialState()'
    CMakeFiles/simple_ocp.dir/simple_ocp.cpp.o:simple_ocp.cpp:(.text+0x3c): undefined reference
    to ACADO::DifferentialState::DifferentialState()' CMakeFiles/simple_ocp.dir/simple_ocp.cpp.o:simple_ocp.cpp:(.text+0x3c): relocation truncated to fit: R_X86_64_PC32 against undefined symbolACADO::DifferentialState::DifferentialState()'
    CMakeFiles/simple_ocp.dir/simple_ocp.cpp.o:simple_ocp.cpp:(.text+0x4b): undefined reference
    to ACADO::Control::Control()' CMakeFiles/simple_ocp.dir/simple_ocp.cpp.o:simple_ocp.cpp:(.text+0x4b): relocation truncated to fit: R_X86_64_PC32 against undefined symbolACADO::Control::Control()'
    CMakeFiles/simple_ocp.dir/simple_ocp.cpp.o:simple_ocp.cpp:(.text+0x5a): undefined reference
    to `ACADO::Parameter::Parameter()'

    [..]

    collect2: error: ld returned 1 exit status
    CMakeFiles/simple_ocp.dir/build.make:88: recipe for target '../simple_ocp.exe' failed
    make[2]: [../simple_ocp.exe] Error 1
    CMakeFiles/Makefile2:63: recipe for target 'CMakeFiles/simple_ocp.dir/all' failed
    make[1]:
    [CMakeFiles/simple_ocp.dir/all] Error 2
    Makefile:75: recipe for target 'all' failed
    make: *** [all] Error 2
    =====================================================================================================

    How can I fix it? Thanks for your help.

    Best,
    Andrea

     
  • Andrea Zaneli

    Andrea Zaneli - 2014-09-10

    Solved. Just in case somebody runs in the same issue:

    The CMakeLists.txt tells the linker to link against shared libraries which are not exported through acado_env.sh:

    export ACADO_ENV_SHARED_LIBRARIES=""

    I added all the needed static libraries

    export ACADO_ENV_STATIC_LIBRARIES="acado_toolkit;acado_qpOASESextras;
    acado_casadi;acado_csparse"

    and their folders. In CMakeLists I've changed to static linking

    TARGET_LINK_LIBRARIES( simple_ocp ${ACADO_STATIC_LIBRARIES} ).

    After this it works.

     
  • Milan Vukov

    Milan Vukov - 2014-09-11

    The webpage is fixed. Thanx a lot!

     
  • Vishwas Iyer

    Vishwas Iyer - 2019-09-05

    I have a similar error. I am trying to create the executable file in a separte folder where i have all the other executables placed. However when i run the program I have the following error:

    ''error while loading shared libraries: libacado_toolkit_s.so.1: cannot open shared object file: No such file or directory''

    This doesn't happen if the executable file is creted within the foler the original code is in. Any help would be appreciated.

    Thanks.

     

Log in to post a comment.