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

Compiler mex errors #133

Open
PanosSken opened this issue Jul 4, 2023 · 3 comments
Open

Compiler mex errors #133

PanosSken opened this issue Jul 4, 2023 · 3 comments

Comments

@PanosSken
Copy link

PanosSken commented Jul 4, 2023

Hello. I am trying to use hpipm in Matlab and Simulink. I am using Matlab 2021b and I have installed Visula Studio 2022 at my computer.
I have followed the instruction of the installation but I face some problems.
The blasfeo installation and build proccess has been done without problems. When I try to build hpipm and run the command:
cmake --build, I get the following error:

C:\myfiles\hpipm\examples\c\example_d_ocp_qp.c(45,10): fatal  error C1083: Cannot open include file: 'sys/time
.h': No such file or directory [C:\myfiles\hpipm\build\examples\c\example_d_ocp_qp.vcxproj]
  getting_started_data.c
C:\myfiles\hpipm\examples\c\data\getting_started_data.c(100,29): error C2059: syntax error: '}' [C:\myfiles\hpipm\build\examples\c\example_d_ocp_qp.vcxproj].

This problem started popping up after I tried to rebuild hpipm to overcome the following two problems.

  1. In order to use hpipm in Matlab, I run env.m and then hpipm/interfaces/matlab_octave/compile_mex_all.m. After running th file the following error pops up:
Building with 'MinGW64 Compiler (C)'.
Error using mex
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
Warning: corrupt .drectve at end of def file
C:\myfiles\hpipm\lib\hpipm.lib(hpipm.dir/Debug/d_ocp_qp_dim.obj):(.rtc$IMZ+0x0):
undefined reference to `_RTC_InitBase'
C:\myfiles\hpipm\lib\hpipm.lib(hpipm.dir/Debug/d_ocp_qp_dim.obj):(.rtc$TMZ+0x0):
undefined reference to `_RTC_Shutdown'
collect2.exe: error: ld returned 1 exit status
  1. Another error comes up when I follow the instruction in order to use hpipm in Simulink after running hpipm/examples/simulink/make_sfun.m :
Error using mex
Warning: corrupt .drectve at end of def file
C:\myfiles\hpipm\lib\hpipm.lib(hpipm.dir/Debug/timing.obj):(.rtc$IMZ+0x0):
undefined reference to `_RTC_InitBase'.

Could you please help me solving this issues?

@giaf
Copy link
Owner

giaf commented Jul 5, 2023

About the error of the missing sys/time.h, it happens when trying to compile the examples, while the HPIPM library should have successfully compiled before hand, right?
The examples have not yet been rewritten in a portable way, so they may still fail in windows, still work in progress.

About the other errors, it likely happens because you are compiling HPIPM with one compiler (visual studio), while matlab is compiling mex with a different compiler (I assume mingw from your reported error).
Please double check if this is the case, and try again using the same compiler for both HPIPM and matlab mex.

@PanosSken
Copy link
Author

PanosSken commented Jul 5, 2023

Regarding the error of the missing sys/time.h , it happens when I run the command cmake --build . for the HPIPM library. When I run cmake .. , I do not see any errors at the command prompt.

@giaf
Copy link
Owner

giaf commented Jul 11, 2023

The linux-specific dependence on sys/time.h is now removed from the C examples 6b14d89
Hopefully this fixes your issue.

In case of further issues with the examples, you can always turn them off, see e.g. https://github.com/giaf/hpipm/blob/master/CMakeLists.txt#L354

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants