casadi icon indicating copy to clipboard operation
casadi copied to clipboard

illegal hardware instruction

Open jcrismer opened this issue 1 year ago • 2 comments

Hi,

Running a script that uses some python packages (awebox: https://github.com/awebox/awebox) relying on casadi, I am encountering the following error: [1] 45159 illegal hardware instruction python3

Without any additional information. I have installed the latest version of casadi (3.6.4) with python 3.10.7 and I am using an Apple machine that has a M1 chip.

The line triggering the error is the following: sol = solver(x0=w0, lbx=bounds['lbw'], ubx=bounds['ubw'], lbg=bounds['lbg'], ubg=bounds['ubg'], p=ca.vertcat(x0, ref, u_ref, Q, R, P))

where solver is created like this: solver = ca.nlpsol('solver', 'ipopt', foldername + 'mpc_solver.so', opts)

and the mpc_solver.so was itself created from mpc.solver.generate_dependencies('mpc_solver.c') os.system("mv ./mpc_solver.c" + " " + src_filename) os.system("gcc -fPIC -shared -O3 " + src_filename + " -o " + lib_filename)

I hope you will be to help with those informations,

Thanks in advance ;)

jcrismer avatar Dec 06 '23 09:12 jcrismer

Hi jcrismer,

I'm not familiar with awebox other than hearing about its existance. If you want to see the bug looked into, please provide exact instructions (or a script) to reproduce this..

jgillis avatar Dec 06 '23 12:12 jgillis

It seems that doing "gcc -fPIC -shared -g" (instead od -O3) solved the problem. It is ok as temporary solution for me.

jcrismer avatar Dec 07 '23 09:12 jcrismer