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

Can not build on ARM64 Darwin #2858

Open
themightyoarfish opened this issue Jul 20, 2023 · 2 comments
Open

Can not build on ARM64 Darwin #2858

themightyoarfish opened this issue Jul 20, 2023 · 2 comments

Comments

@themightyoarfish
Copy link

This issue, which was deemed resolved occurs on current master.

[ 85%] Linking C shared module mosquitto_dynamic_security.so
Undefined symbols for architecture arm64:
  "_mosquitto_broker_publish", referenced from:
      _send_response in plugin.c.o
  "_mosquitto_callback_register", referenced from:
      _mosquitto_plugin_init in plugin.c.o
  "_mosquitto_callback_unregister", referenced from:
      _mosquitto_plugin_cleanup in plugin.c.o
  "_mosquitto_calloc", referenced from:
      _dynsec_auth__base64_decode in auth.c.o
      _dynsec_clients__config_load in clients.c.o
      _dynsec_clients__process_create in clients.c.o
      _dynsec_groups__config_load in groups.c.o
      _dynsec_groups__process_create in groups.c.o
      _dynsec__config_load in plugin.c.o
      _dynsec_roles__config_load in roles.c.o
      ...

cmake invocation is cmake .. -DOPENSSL_ROOT_DIR=/opt/homebrew/Cellar/[email protected]/1.1.1u/

  • OS version: 12.6.5
  • arch: apple silicon
  • compiler: Apple clang version 14.0.0
@danh1979
Copy link

danh1979 commented Aug 4, 2023

I also discovered this problem when attempting to update mosquitto in macports: https://trac.macports.org/ticket/67874

At first, I was able to add -DCMAKE_MODULE_LINKER_FLAGS="-undefined dynamic_lookup" to my cmake invocation to solve the problem, but perhaps the fix should be here in mosquitto's CMakeLists.txt as follows?

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b8913c2d..145f6255 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,7 @@ if (WIN32)
 endif (WIN32)
 
 if(APPLE)
-       set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -undefined dynamic_lookup")
+       set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -undefined dynamic_lookup")
 endif(APPLE)
 
 include(GNUInstallDirs)

@BB-301
Copy link

BB-301 commented Oct 24, 2023

I also discovered this problem when attempting to update mosquitto in macports: https://trac.macports.org/ticket/67874

At first, I was able to add -DCMAKE_MODULE_LINKER_FLAGS="-undefined dynamic_lookup" to my cmake invocation to solve the problem, but perhaps the fix should be here in mosquitto's CMakeLists.txt as follows?

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b8913c2d..145f6255 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,7 @@ if (WIN32)
 endif (WIN32)
 
 if(APPLE)
-       set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -undefined dynamic_lookup")
+       set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -undefined dynamic_lookup")
 endif(APPLE)
 
 include(GNUInstallDirs)

@danh1979

The proposed solution worked for me. Thank you!

As I'm mentioning in #2744 (comment), I was having a similar problem while trying to build master tag v2.0.18 on macOS Ventura 13.2 (Intel).

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

3 participants