Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using loadlibrary #2

Closed
alphaville opened this issue Oct 2, 2018 · 9 comments
Closed

Error using loadlibrary #2

alphaville opened this issue Oct 2, 2018 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@alphaville
Copy link
Member

This is a follow-up on issue #1.

I run TwoCircTrailer (I run it from inside nmpc-codegen-matlab/demos) and I first get following log messages:

GENERATING output folders of controller:
GENERATING PANOC
GENERATING static globals
GENERATING python interface
GENERATING Build system
Generating globals file at: ../test_controller_builds/demo_controller_matlab/globals/globals_dyn.h
generating g-type function

ans = 

  Source_file_generator with properties:

         location: '../test_controller_builds/demo_controller_matlab/casadi/g.c'
    function_type: 'g'

generating proxg-type function

ans = 

  Source_file_generator with properties:

         location: '../test_controller_builds/demo_controller_matlab/casadi/proxg.c'
    function_type: 'proxg'

but then there seem to be some issues with compilation...

cmake: /usr/local/MATLAB/R2017a/bin/glnxa64/libcurl.so.4: no version information available (required by cmake)
-- The C compiler identification is GNU 4.8.5
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detected the following casadi files: cost_function_derivative_combined.c;cost_function.c;integrator.c
-- No main.c detected in project root folder
-- Configuring done
-- Generating done
-- Build files have been written to: /home/chung/Documents/nmpc-codegen-matlab/test_controller_builds/demo_controller_matlab/build
cmake: /usr/local/MATLAB/R2017a/bin/glnxa64/libcurl.so.4: no version information available (required by cmake)
/usr/bin/cmake: /usr/local/MATLAB/R2017a/bin/glnxa64/libcurl.so.4: no version information available (required by /usr/bin/cmake)
/usr/bin/cmake: /usr/local/MATLAB/R2017a/bin/glnxa64/libcurl.so.4: no version information available (required by /usr/bin/cmake)
/usr/bin/cmake: /usr/local/MATLAB/R2017a/bin/glnxa64/libcurl.so.4: no version information available (required by /usr/bin/cmake)
/usr/bin/cmake: /usr/local/MATLAB/R2017a/bin/glnxa64/libcurl.so.4: no version information available (required by /usr/bin/cmake)
Scanning dependencies of target PANOC_lib
/usr/bin/cmake: /usr/local/MATLAB/R2017a/bin/glnxa64/libcurl.so.4: no version information available (required by /usr/bin/cmake)
[  7%] /usr/bin/cmake: /usr/local/MATLAB/R2017a/bin/glnxa64/libcurl.so.4: no version information available (required by /usr/bin/cmake)
Building C object PANOC/CMakeFiles/PANOC_lib.dir/proximal_gradient_descent.c.o
/usr/bin/cmake: /usr/local/MATLAB/R2017a/bin/glnxa64/libcurl.so.4: no version information available (required by /usr/bin/cmake)
[ 15%] /usr/bin/cmake: /usr/local/MATLAB/R2017a/bin/glnxa64/libcurl.so.4: no version information available (required by /usr/bin/cmake)
Building C object PANOC/CMakeFiles/PANOC_lib.dir/buffer.c.o
/usr/bin/cmake: /usr/local/MATLAB/R2017a/bin/glnxa64/libcurl.so.4: no version information available (required by /usr/bin/cmake)
[ 23%] /usr/bin/cmake: /usr/local/MATLAB/R2017a/bin/glnxa64/libcurl.so.4: no version information available (required by /usr/bin/cmake)
Building C object PANOC/CMakeFiles/PANOC_lib.dir/casadi_interface.c.o
In file included from /home/chung/Documents/nmpc-codegen-matlab/test_controller_builds/demo_controller_matlab/PANOC/casadi_interface.c:3:0:
/home/chung/Documents/nmpc-codegen-matlab/test_controller_builds/demo_controller_matlab/PANOC/../casadi/cost_function_derivative_combined.h:12:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
 CASADI_SYMBOL_EXPORT void cost_function_derivative_combined_incref(void);
                      ^
/home/chung/Documents/nmpc-codegen-matlab/test_controller_builds/demo_controller_matlab/PANOC/../casadi/cost_function_derivative_combined.h:13:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘void’
 CASADI_SYMBOL_EXPORT void cost_function_derivative_combined_decref(void);
                      ^
/home/chung/Documents/nmpc-codegen-matlab/test_controller_builds/demo_controller_matlab/PANOC/../casadi/cost_function_derivative_combined.h:14:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’
 CASADI_SYMBOL_EXPORT int cost_function_derivative_combined_n_out(void);
                      ^
/home/chung/Documents/nmpc-codegen-matlab/test_controller_builds/demo_controller_matlab/PANOC/../casadi/cost_function_derivative_combined.h:15:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’
 CASADI_SYMBOL_EXPORT int cost_function_derivative_combined_n_in(void);
                      ^
/home/chung/Documents/nmpc-codegen-matlab/test_controller_builds/demo_controller_matlab/PANOC/../casadi/cost_function_derivative_combined.h:16:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘const’
 CASADI_SYMBOL_EXPORT const char* cost_function_derivative_combined_name_in(int i);
                      ^
/home/chung/Documents/nmpc-codegen-matlab/test_controller_builds/demo_controller_matlab/PANOC/../casadi/cost_function_derivative_combined.h:17:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘const’
 CASADI_SYMBOL_EXPORT const char* cost_function_derivative_combined_name_out(int i);
                      ^
/home/chung/Documents/nmpc-codegen-matlab/test_controller_builds/demo_controller_matlab/PANOC/../casadi/cost_function_derivative_combined.h:18:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘const’
 CASADI_SYMBOL_EXPORT const int* cost_function_derivative_combined_sparsity_in(int i);
                      ^
/home/chung/Documents/nmpc-codegen-matlab/test_controller_builds/demo_controller_matlab/PANOC/../casadi/cost_function_derivative_combined.h:19:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘const’
 CASADI_SYMBOL_EXPORT const int* cost_function_derivative_combined_sparsity_out(int i);
                      ^
/home/chung/Documents/nmpc-codegen-matlab/test_controller_builds/demo_controller_matlab/PANOC/../casadi/cost_function_derivative_combined.h:20:22: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’
 CASADI_SYMBOL_EXPORT int cost_function_derivative_combined_work(int *sz_arg, int* sz_res, int *sz_iw, int *sz_w);
                      ^
make[3]: *** [PANOC/CMakeFiles/PANOC_lib.dir/casadi_interface.c.o] Error 1
make[2]: *** [PANOC/CMakeFiles/PANOC_lib.dir/all] Error 2
make[1]: *** [CMakeFiles/python_interface.dir/rule] Error 2
make: *** [python_interface] Error 2
Loading nmpc_panoc library \n
Error using loadlibrary
There was an error loading the library "../test_controller_builds/demo_controller_matlab/build/libpython_interface.so"
../test_controller_builds/demo_controller_matlab/build/libpython_interface.so: cannot open shared object file: No such file or directory

Error in nmpccodegen.tools.Simulator/load_library (line 77)
                [notfound,warnings] = loadlibrary(lib_file_name,lib_file_header_name,'alias','nmpc_panoc');

Error in nmpccodegen.tools.Simulator (line 104)
            obj.load_library();

Error in simulate_demo_trailer (line 9)
    sim = nmpccodegen.tools.Simulator(trailer_controller.location);

Error in TwoCircTrailer (line 47)
[ state_history,time_history,iteration_history,input_history,~ ] = simulate_demo_trailer(trailer_controller,initial_state,...

Caused by:
    Error using loaddefinedlibrary
    ../test_controller_builds/demo_controller_matlab/build/libpython_interface.so: cannot open shared object file: No such file or directory

I suspect this is because it doesn't find CASADI_SYMBOL_EXPORT.

@alphaville alphaville added the bug Something isn't working label Oct 2, 2018
@MelisWillem
Copy link

Ha Joris release a new Casadi, those guy's break the interface with minor releases. Might take till weekend that i fix this, can take a while.

@MelisWillem
Copy link

use the previous version 3.4 that one should be fine

@alphaville
Copy link
Member Author

I tried again with casadi version 3.4.4, I deleted the folder test_controller_builds and got the following error...

>> TwoCircTrailer
GENERATING output folders of controller:
GENERATING PANOC
GENERATING static globals
GENERATING python interface
GENERATING Build system
Invalid MEX-file '/home/chung/Documents/MATLAB/casadi-linux-matlabR2014b-v3.4.4/casadiMEX.mexa64': /home/chung/Documents/MATLAB/casadi-linux-matlabR2014b-v3.4.4/casadiMEX.mexa64:
undefined symbol: _ZNK6casadi8Callback4evalEPPKdPPdPxS4_Pv.

Error in casadi.GenSX.sym (line 367)
     [varargout{1:nargout}] = casadiMEX(330, varargin{:});

Error in nmpccodegen.controller.Single_shot_definition/generate_cost_function (line 23)
            initial_state = casadi.SX.sym('initial_state', obj.controller.model.number_of_states, 1);

Error in nmpccodegen.controller.Nmpc_panoc/generate_cost_function_singleshot (line 130)
            [cost_function_, cost_function_derivative_combined_] = ssd.generate_cost_function();

Error in nmpccodegen.controller.Nmpc_panoc/generate_code (line 62)
                    obj = obj.generate_cost_function_singleshot();

Error in TwoCircTrailer (line 38)
trailer_controller.generate_code();

By the way, the script ran for about 2 minutes before it threw this error.

Should I try with some other version of casadi?

@MelisWillem
Copy link

So odd that it error's when generating code in the Casadi Mex file, this might be a casadi bug. Does demo1 till 4 work?

@alphaville
Copy link
Member Author

I changed to casadi version 3.4.0. Which version do you use?

I don't see any files called demo1.m. Are you referring to the Python demos?

When running TwoCircTrailer I get the same error:

Invalid MEX-file '/home/chung/Documents/MATLAB/casadi-linux-matlabR2014b-v3.4.0/casadiMEX.mexa64': /home/chung/Documents/MATLAB/casadi-linux-matlabR2014b-v3.4.0/casadiMEX.mexa64:
undefined symbol: _ZNK6casadi8Callback4evalEPPKdPPdPxS4_Pv.

I tried to run nmpc-codegen-matlab/demos/demos.m and nmpc-codegen-matlab/demos/demo_lbfgs_speedup.m, but I keep getting the same error.

@alphaville
Copy link
Member Author

Solved! I tried again with casadi v3.4.5 and it works. Although I had previously changed with version of casadi (and used clear all and clear classes), the issue was solved after I restarted MATLAB.

@MelisWillem
Copy link

Yea very dangerous that Casadi changes it's interface with minor updates.

@alphaville
Copy link
Member Author

Maybe we should state in the documentation that nmpc-codegen has been tested with 3.4.5 and it works, so it's best if the users installed this exact version of casadi.

@MelisWillem
Copy link

@alphaville actually i ran it with 3.2/3.3/3.4 nmpc-codegen behaves differently depending upon your Casadi version.But yes everytime Casadi releases a new version, nmpc-codegen needs adjustments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants