Using github code for C++

424 views
Skip to first unread message

pras...@umich.edu

unread,
Jul 10, 2018, 1:33:00 PM7/10/18
to CasADi
Hi, 

I plan to use the C++ code from the Casadi github. 

However, while compiling using 

g++ sx_example.cpp 


 I am getting the following error :


fatal error: casadi/core/casadi_export.h: No such file or directory

 #include <casadi/core/casadi_export.h>


Similarly casadi_export.h is used in other header files too, but I couldnt find it anywhere. Any idea ?

 thanks 



Joel Andersson

unread,
Jul 10, 2018, 2:44:19 PM7/10/18
to CasADi
You need to build CasADi using the CMake build scripts. The file you refer to is auto-generated and will be included in installed header files.

Joel

pras...@umich.edu

unread,
Jul 10, 2018, 3:12:35 PM7/10/18
to CasADi
Hi Joel, 

I appreciate your response, however, I havent used cmake before , is similar to make command and just type "make" or more than that. 

Also is there a link which talks about it .

Thanks again 

James Goppert

unread,
Jul 10, 2018, 5:12:12 PM7/10/18
to pras...@umich.edu, CasADi
Here is a script which builds using cmake and creates a debian package of the C++ api: https://github.com/jgoppert/cymoca/blob/master/scripts/install_casadi.sh

--
Sent from CasADi's user forum at http://forum.casadi.org.
---
You received this message because you are subscribed to the Google Groups "CasADi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to casadi-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/casadi-users/8e0809d9-a2b0-4561-b3c1-2fda9c760f93%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

pras...@umich.edu

unread,
Jul 10, 2018, 5:42:09 PM7/10/18
to CasADi
Oh thats great ,  will try it out. 

thanks


On Tuesday, July 10, 2018 at 5:12:12 PM UTC-4, James Goppert wrote:
Here is a script which builds using cmake and creates a debian package of the C++ api: https://github.com/jgoppert/cymoca/blob/master/scripts/install_casadi.sh
On Tue, Jul 10, 2018 at 3:12 PM, <pras...@umich.edu> wrote:
Hi Joel, 

I appreciate your response, however, I havent used cmake before , is similar to make command and just type "make" or more than that. 

Also is there a link which talks about it .

Thanks again 

On Tuesday, July 10, 2018 at 2:44:19 PM UTC-4, Joel Andersson wrote:
You need to build CasADi using the CMake build scripts. The file you refer to is auto-generated and will be included in installed header files.

Joel

--
Sent from CasADi's user forum at http://forum.casadi.org.
---
You received this message because you are subscribed to the Google Groups "CasADi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to casadi-users...@googlegroups.com.

pras...@umich.edu

unread,
Jul 10, 2018, 11:57:32 PM7/10/18
to CasADi
Hi James, 

I used the install script works like a charm, however, it disables qpOASIS and ipopt - interface. How do I gain access to them ? 

Thanks 


On Tuesday, July 10, 2018 at 5:12:12 PM UTC-4, James Goppert wrote:
Here is a script which builds using cmake and creates a debian package of the C++ api: https://github.com/jgoppert/cymoca/blob/master/scripts/install_casadi.sh
On Tue, Jul 10, 2018 at 3:12 PM, <pras...@umich.edu> wrote:
Hi Joel, 

I appreciate your response, however, I havent used cmake before , is similar to make command and just type "make" or more than that. 

Also is there a link which talks about it .

Thanks again 

On Tuesday, July 10, 2018 at 2:44:19 PM UTC-4, Joel Andersson wrote:
You need to build CasADi using the CMake build scripts. The file you refer to is auto-generated and will be included in installed header files.

Joel

--
Sent from CasADi's user forum at http://forum.casadi.org.
---
You received this message because you are subscribed to the Google Groups "CasADi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to casadi-users...@googlegroups.com.

pras...@umich.edu

unread,
Jul 11, 2018, 3:18:04 AM7/11/18
to CasADi
Also to add to it , when I came back while stepping away from running the install script i got the the following 

[ 38%] Building C object external_packages/casadi-sundials/CMakeFiles/casadi_sundials.dir/idas/idas_ic.c.o

[ 38%] Building C object external_packages/casadi-sundials/CMakeFiles/casadi_sundials.dir/idas/idas_io.c.o

[ 38%] Building C object external_packages/casadi-sundials/CMakeFiles/casadi_sundials.dir/idas/idas_spbcgs.c.o

[ 39%] Building C object external_packages/casadi-sundials/CMakeFiles/casadi_sundials.dir/idas/idas_spgmr.c.o

c++: internal compiler error: Killed (program cc1plus)

Please submit a full bug report,

with preprocessed source if appropriate.

See <file:///usr/share/doc/gcc-6/README.Bugs> for instructions.

casadi/core/CMakeFiles/casadi.dir/build.make:326: recipe for target 'casadi/core/CMakeFiles/casadi.dir/matrix.cpp.o' failed


And finally in the end 

CMakeFiles/Makefile2:362: recipe for target 'casadi/core/CMakeFiles/casadi.dir/all' failed

make[1]: *** [casadi/core/CMakeFiles/casadi.dir/all] Error 2

Makefile:149: recipe for target 'all' failed

make: *** [all] Error 2


Any thoughts 

Thanks

James Goppert

unread,
Jul 11, 2018, 4:55:53 AM7/11/18
to pras...@umich.edu, CasADi

You might want to see if this binary works for you: https://github.com/casadi/casadi/releases/download/3.4.4/libcasadi-v3.4.4.deb

Otherwise, try this:

#!/bin/bash
set -e

rm -rf /tmp/casadi
mkdir -p /tmp/casadi
pushd /tmp/casadi
echo downloading casadi
wget -q https://github.com/jgoppert/casadi/archive/3.4.4-jmg.tar.gz
tar xzf 3.4.4-jmg.tar.gz
pushd casadi-3.4.4-jmg
mkdir -p build
pushd build
echo building casadi
sudo apt-get install coinor-libipopt-dev liblapack-dev libslicot-dev libclang-dev gfortran swig -y
cmake .. -DENABLE_SHARED=OFF -DENABLE_STATIC=ON -DWITH_SLICOT=ON -DWITH_COMMON=ON -DWITH_PYTHON=ON -DWITH_PYTHON3=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo
make -j4
echo packiaging casadi
cpack -G DEB
sudo dpkg -i *.deb
popd
popd
popd

To unsubscribe from this group and stop receiving emails from it, send an email to casadi-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/casadi-users/36e73a47-789d-4dec-afcf-4089978d6364%40googlegroups.com.

James Goppert

unread,
Jul 11, 2018, 5:10:49 AM7/11/18
to pras...@umich.edu, CasADi
When I wrote the above script 3.4.4 hadn't been released, so no need for using the custom source package above, this should be all you need below. If you build from source, I would recommend switching the above url's to: https://github.com/casadi/casadi/archive/3.4.4.tar.gz

#!/bin/bash
set -e

rm -rf /tmp/casadi
mkdir -p /tmp/casadi
pushd /tmp/casadi
echo downloading casadi
wget -q https://github.com/casadi/casadi/releases/download/3.4.4/libcasadi-v3.4.4.deb
echo installing casadi
sudo dpkg -i libcasadi-v3.4.4.deb
popd

pras...@umich.edu

unread,
Jul 11, 2018, 3:44:09 PM7/11/18
to CasADi

I am still getting internal compiler error. I am trying run the install script on Beagle Bone Blue. Any thoughts.

thanks  

James Goppert

unread,
Jul 11, 2018, 3:53:59 PM7/11/18
to pras...@umich.edu, CasADi
Looks like you are running out of memory :) https://github.com/JakobEngel/dso/issues/8

To unsubscribe from this group and stop receiving emails from it, send an email to casadi-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/casadi-users/dc0fa5dd-4504-4b1a-ba21-7053b036d744%40googlegroups.com.

pras...@umich.edu

unread,
Jul 11, 2018, 4:31:03 PM7/11/18
to CasADi
Oh thats interesting ... thank you..

Joel Andersson

unread,
Jul 12, 2018, 7:02:58 PM7/12/18
to CasADi
See the following link to how to do source builds:


Joel

pras...@umich.edu

unread,
Jul 12, 2018, 7:50:02 PM7/12/18
to CasADi
Hi Joel,

I had been doing that initially , but I guess as pointed by James, the RAM on Beagle Bone Blue is not sufficient to build the casadi code. 

I am thinking of cross compiling it.. and see if that works out 

Best 

pras...@umich.edu

unread,
Jul 12, 2018, 8:09:24 PM7/12/18
to CasADi
Also, I am curious, as mentioned on  Casadi's website, that it can be used on embedded platform, which one of the two routes is recommended :

1) Install casadi on embedded platform and then use the library 

2) Write code in Matlab and using code generation run it on embedded platform 

Thanks 

James Goppert

unread,
Jul 13, 2018, 1:11:49 AM7/13/18
to pras...@umich.edu, CasADi
For embedded systems you can generate pure c code which is very easy to compile and faster than using the virtual machine in the library. You don't want to install the library on your embedded system.


--
Sent from CasADi's user forum at http://forum.casadi.org.
---
You received this message because you are subscribed to the Google Groups "CasADi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to casadi-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/casadi-users/2c586613-b50c-4744-a791-1fdaa2ad4b96%40googlegroups.com.

pras...@umich.edu

unread,
Jul 13, 2018, 1:20:16 AM7/13/18
to CasADi
hmm.. 

I was going through this whole exercise with casadi , as I was planning to implement a SQP-NMPC  flight controller on BBBL , which works really well in MATLAB, but I guess code generation is the way to go.  

Just curious to know, for what application have you used casadi for 


On Friday, July 13, 2018 at 1:11:49 AM UTC-4, James Goppert wrote:
For embedded systems you can generate pure c code which is very easy to compile and faster than using the virtual machine in the library. You don't want to install the library on your embedded system.

On Thu, Jul 12, 2018 at 8:09 PM, <pras...@umich.edu> wrote:
Also, I am curious, as mentioned on  Casadi's website, that it can be used on embedded platform, which one of the two routes is recommended :

1) Install casadi on embedded platform and then use the library 

2) Write code in Matlab and using code generation run it on embedded platform 

Thanks 

On Thursday, July 12, 2018 at 7:02:58 PM UTC-4, Joel Andersson wrote:
See the following link to how to do source builds:


Joel

--
Sent from CasADi's user forum at http://forum.casadi.org.
---
You received this message because you are subscribed to the Google Groups "CasADi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to casadi-users...@googlegroups.com.

James Goppert

unread,
Jul 13, 2018, 1:24:49 AM7/13/18
to pras...@umich.edu, CasADi
Ah, that makes more sense. You will need to get it all of it compiled on your device then to use those solvers. For my application I'm using it for generation of filtering code for an autopilot on a very small stm32 chip. https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/casadi-users/74OhfoAEyB4/fZZGAP4MBAAJ

To unsubscribe from this group and stop receiving emails from it, send an email to casadi-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/casadi-users/328508ae-e987-47cc-947f-41a1ff8d67ea%40googlegroups.com.

James Goppert

unread,
Jul 13, 2018, 2:25:51 AM7/13/18
to pras...@umich.edu, CasADi
My application for building the casadi c++ api is that i'm writing a modelica compiler (think text based simulink) that uses casadi as the math backend. The ultimate goal being robust and verifiable autopilot code for safety critical systems.

pras...@umich.edu

unread,
Jul 13, 2018, 2:28:48 AM7/13/18
to CasADi
Interesting work of yours ..

Yes thats what I was going for as casadi allows optimization using qpOASES, it would be easier to compile everything in BBBL 

Hemant Bansal

unread,
Jan 8, 2019, 11:47:25 PM1/8/19
to CasADi
I am facing issues when i use Casadi with clr. Can some body help me.

I need clr in my project to include Windows.h and other reference like System , Data and etc.
Reply all
Reply to author
Forward
0 new messages