macOS compile failed

Hello,

I would like to use ACADOS on my macOS system (Intel CPU, 8 Gen). However, it cannot compile correctly whether I use clang or gcc-10 for blasfeo.

When I used cmake, the test of blasfeo is ok:

– Testing target X64_INTEL_HASWELL: assembly compilation [success]
– Testing target X64_INTEL_HASWELL: assembly run [success]
– Testing target X64_INTEL_HASWELL: intrinsic compilation [success]
– Testing target X64_INTEL_HASWELL: intrinsic run [success]
– Detected target X64_INTEL_HASWELL

A typical error could be:

:13:14: error: unknown token in expression
vinsertf128 , %xmm15, %ymm15, %ymm15
./acados/external/blasfeo/kernel/avx/kernel_dgemv_4_lib4.S:4087:2: note: while in macro instantiation
INNER_STORE_4_VS_LIB4
^
make[2]: *** [external/blasfeo/CMakeFiles/blasfeo.dir/kernel/avx/kernel_dgemv_4_lib4.S.o] Error 1
make[1]: *** [external/blasfeo/CMakeFiles/blasfeo.dir/all] Error 2

I’ve also tried to compile blasfeo directly (pull from blasfeo GitHub). It has failed too. So is there any suggestion for solving this problem. Thanks.

Hi,

other users have reported similar issues compiling BLASFEO assembly code on macOS (e.g. https://github.com/giaf/hpipm/issues/95), but since I don’t have access to a macOS system I couldn’t investigate the issue myself.
If you are willing to help, we can try to figure out the issue together.

In the specific case of the line you report as an example, in the BLASFEO source code it looks like
vinsertf128 $1, %xmm15, %ymm15, %ymm15
instead of
vinsertf128 , %xmm15, %ymm15, %ymm15
as in the error print you report.
As you can see, the “immediate” (i.e. numerical constant) has been somehow removed.
In case of exadecimal immediate, there is a similar issue, with e.g. $0x12 becoming x12.

Now, I could not find many hints of the issue googling around, but we can start trying this:

  • try to put a space in between the dollar symbol and the following number, e.g. $1 becomes $ 1.

If this still fails, can you double check that the compiler is set up to expect the correct assembly syntax? More specifically, BLASFEO uses AT&T syntax (which is the standard in linux/gcc), as opposite to Intel syntax with is more common in windows/intel compilers.
In case of gcc or clang compilers, this can be enforced by passing the compiler flag -masm=att.

1 Like

The short term solution for MAC would be to set the BLASFEO_TARGET to GENERIC when compiling acados.
It would of course be great if you could help giaf to fix this issue properly.

Hi,

thanks for your suggestion. I’ve tried to correct some of the *.S file with

$ xxx

They work. But it takes time to correct all of these in files.

I’ve not found where to force the compiler to use -masm=att. Is it in the file Makefile.rule?

Thanks, it works with Generic. I’ll try the suggestion from giaf.

Ok great, thanks for trying it out.
Don’t worry about correcting any file, I will do with some automatic bash script when I find some time one of these days, I just needed to know what works :stuck_out_tongue:
Once done, I will ping you here to test it on your PC, on my machines it already works smooth so I won’t notice the difference.

And don’t worry about the -masm=att, it was just another hypothesis to test out, but since the space after the dollar makes the job, that was not the issue.

Great.

Another warning when one uses macOS is

MACOSX_RPATH is not specified for the following targets:
blasfeo
hpipm
qpOASES_e

One may consider adding a line in the main CMakeList.txt

set(CMAKE_MACOSX_RPATH 1)

With this commit https://github.com/giaf/blasfeo/commit/e6356a7aea2458c57176073bd27a78091aabb7f7
the current BLASFEO master branch should compile correctly also on macOS.

Could you test it our and confirm if this is the case, or if there are more issues?

Hi,
thanks. When I change to master, it works now for blasfeo.
However, I’ve got new error

In file included from ./acados/external/hpipm/cond/d_cond_aux.c:107:
./external/hpipm/cond/x_cond_aux.c:807:108: error: too many arguments to function call, expected 12, have 13
…SYMV_L(nx[nn], nx[nn], 1.0, RSQrq+nn, nu[nn], nu[nn], Gammab+nn-1, 0, 1.0, rqz+nn, nu[nn], tmp_nuxM, 0);

Then I pull hpipm as master, then I’ve got errors

./acados/acados/ocp_nlp/ocp_nlp_cost_ls.c:796:58: error: too many arguments to function call, expected 12, have 13
0, 0.0, &work->tmp_ny, 0, &work->tmp_ny, 0);
^
./acados/external/blasfeo/include/blasfeo_d_blasfeo_api.h:120:1: note: ‘blasfeo_dsymv_l’ declared here
void blasfeo_dsymv_l(int m, double alpha, struct blasfeo_dmat *sA, int ai, int aj, struct blasfeo_dvec *sx, int xi, double beta, struct blas…
^
.acados/acados/ocp_nlp/ocp_nlp_cost_ls.c:817:63: error: too many arguments to function call, expected 12, have 13
0.0, &work->tmp_ny, 0, &work->tmp_ny, 0);

Thanks for checking, great that BLASFEO works now on your PC.

We will take care of updating the default versions of BLASFEO and HPIPM in acados, and make the needed changes.