Error using mex_Undefined symbols for architecture x86_64:

Hi @FreyJo

Follow-up error from previous one. Thanks for your reply. I checked acados/lib folder and there are no .dylib files as they have been installed outside the acados main folder. So pasted them in the acados/lib folder and tried running the examples and this new error has popped up. It would be great if you have any idea about this.

>> extensive_example_ocp
Warning: Name is nonexistent or not a directory: /Users/raghuboppana/../pendulum_on_cart_model 
> In path (line 109)
In addpath (line 86)
In extensive_example_ocp (line 37) 
compiling /Users/raghuboppana/acados/examples/acados_matlab_octave/getting_started/../../../interfaces/acados_matlab_octave/ocp_create.c
Building with 'Xcode with Clang'.
Error using mex
ld: warning: ignoring file /Users/raghuboppana/acados/lib/libhpipm.dylib, building for macOS-x86_64
but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/raghuboppana/acados/lib/libacados.dylib, building for macOS-x86_64
but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/raghuboppana/acados/lib/libblasfeo.dylib, building for macOS-x86_64
but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /Users/raghuboppana/acados/lib/libqpOASES_e.dylib, building for
macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
  "_ocp_nlp_config_create", referenced from:
      _mexFunction in ocp_create.o
  "_ocp_nlp_constraints_model_set", referenced from:
      _mexFunction in ocp_create.o
  "_ocp_nlp_cost_model_set", referenced from:
      _mexFunction in ocp_create.o
  "_ocp_nlp_dims_create", referenced from:
      _mexFunction in ocp_create.o
  "_ocp_nlp_dims_set_constraints", referenced from:
      _mexFunction in ocp_create.o
  "_ocp_nlp_dims_set_cost", referenced from:
      _mexFunction in ocp_create.o
  "_ocp_nlp_dims_set_dynamics", referenced from:
      _mexFunction in ocp_create.o
  "_ocp_nlp_dims_set_opt_vars", referenced from:
      _mexFunction in ocp_create.o
  "_ocp_nlp_in_create", referenced from:
      _mexFunction in ocp_create.o
  "_ocp_nlp_in_set", referenced from:
      _mexFunction in ocp_create.o
  "_ocp_nlp_out_create", referenced from:
      _mexFunction in ocp_create.o
  "_ocp_nlp_out_set", referenced from:
      _mexFunction in ocp_create.o
  "_ocp_nlp_plan_create", referenced from:
      _mexFunction in ocp_create.o
  "_ocp_nlp_solver_create", referenced from:
      _mexFunction in ocp_create.o
  "_ocp_nlp_solver_opts_create", referenced from:
      _mexFunction in ocp_create.o
  "_ocp_nlp_solver_opts_set", referenced from:
      _mexFunction in ocp_create.o
  "_ocp_nlp_solver_opts_set_at_stage", referenced from:
      _mexFunction in ocp_create.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Error in ocp_compile_interface (line 175)
        mex(mex_flags, FLAGS, LDFLAGS, COMPDEFINES, COMPFLAGS, acados_include, acados_interfaces_include, external_include, blasfeo_include, hpipm_include,...

Error in acados_ocp (line 181)
                ocp_compile_interface(obj.opts_struct);

Error in extensive_example_ocp (line 240)
ocp = acados_ocp(ocp_model, ocp_opts);

I am using macOS 12.6 with MATLABR2022a and Xcode 14.

Thanks

Hi,

do you have an M1 Mac?
It seems very related to this issue:

Hi,

Yes I have M1 MAC.

Above solution only resolves for python interface. There is no option to choose the processor as ARM64 during installation for MATLAB. is there any other way that we can change the processor settings because I tried reinstalling MATLAB as well?

In this case, you should try to compile the acados library also for the emulated x86_64 target.

This should help:

Let me know if it works :slight_smile:

Hello Frey,

Thank you for your reply. I assume that in the solution provided the source file for Cmake is the CMakeLists.txt file and I have updated below command at the top of every .txt file in the Acados folder. set(CMAKE_OSX_ARCHITECTURES “x86_64” CACHE INTERNAL “” FORCE).

I even tried setting the cmake architecture in terminal as below.

(base) raghuboppana@MacBook-Air ~ % cmake /Users/raghuboppana/acados -DCMAKE_OSX_ARCHITECTURES="x86_64"
-- The C compiler identification is AppleClang 14.0.0.14000029
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build type is Release
-- ACADOS_WITH_OPENMP: OFF
CMake Deprecation Warning at external/blasfeo/CMakeLists.txt:36 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Using linear algebra: HIGH_PERFORMANCE
-- Using matrix format: PANELMAJ
-- Using external BLAS: 0
-- Testing target X64_INTEL_HASWELL: assembly compilation [success]
-- Testing target X64_INTEL_HASWELL: assembly run [failed]
-- Testing target X64_INTEL_HASWELL: intrinsic compilation [success]
-- Testing target X64_INTEL_HASWELL: intrinsic run [success]
-- Testing target X64_AMD_BULLDOZER: assembly compilation [success]
-- Testing target X64_AMD_BULLDOZER: assembly run [failed]
-- Testing target X64_AMD_BULLDOZER: intrinsic compilation [success]
-- Testing target X64_AMD_BULLDOZER: intrinsic run [success]
-- Testing target X64_INTEL_SANDY_BRIDGE: assembly compilation [success]
-- Testing target X64_INTEL_SANDY_BRIDGE: assembly run [failed]
-- Testing target X64_INTEL_SANDY_BRIDGE: intrinsic compilation [success]
-- Testing target X64_INTEL_SANDY_BRIDGE: intrinsic run [success]
-- Testing target X64_INTEL_CORE: assembly compilation [success]
-- Testing target X64_INTEL_CORE: assembly run [success]
-- Testing target X64_INTEL_CORE: intrinsic compilation [success]
-- Testing target X64_INTEL_CORE: intrinsic run [success]
-- Detected target X64_INTEL_CORE
CMake Deprecation Warning at external/hpipm/CMakeLists.txt:36 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Using BLASFEO path: 
-- Installation directory: /Users/raghuboppana
CMake Deprecation Warning at external/qpoases/CMakeLists.txt:32 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


--  
-- Target: BLASFEO is X64_AUTOMATIC, HPIPM is X64_AUTOMATIC
-- Linear algebra: HIGH_PERFORMANCE
-- Matlab MEX (OFF)
-- Octave MEX (OFF)
-- Octave Templates (OFF)
-- System name:version Darwin:21.6.0
-- Build type is Release
-- Installation directory is /Users/raghuboppana
-- OpenMP parallelization is OFF
--  
-- Configuring done

But still the error remains same. Also one observation is there is a folder called compilerTest in the Acados root folder which has subfolders for Cmake and I see them all empty. Is this something that I need to update or take care of during installation. If you have any idea let me know.

Thanks and Regards
Raghu Boppana

Hi,

did you remove the old CMakeCache.txt file?

This folder should be inside the build directory, if you install acados corectly.

Cheers!

Hello

Thank you so much for the reply. It worked after uninstalling the CMakeCache.txt file and compiled successfully.