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

Building an Erlang drivers failed on Apple Silicon #8866

Closed
amitabhadatta14 opened this issue Sep 27, 2024 · 3 comments
Closed

Building an Erlang drivers failed on Apple Silicon #8866

amitabhadatta14 opened this issue Sep 27, 2024 · 3 comments
Labels
team:VM Assigned to OTP team VM

Comments

@amitabhadatta14
Copy link

amitabhadatta14 commented Sep 27, 2024

Hi,

I am trying to build an Erlang driver with IBM MQ client calls and it is failing to resolve some calls from erl_driver. Please see the below error logs:-

amitabhadatta@VL-MWLGJ26CQ4 c_src % gcc -I /opt/mqm/inc  -I /usr/local/lib/erlang/usr/include  -o mq_series_drv.so mq_series_drv.c -fpic -shared -L /opt/mqm/lib64 -L /usr/local/lib/erlang/lib -L /usr/local/lib/erlang/lib/erl_interface-5.5.1/lib  -lei -lmqic_r -lpthread
ld: Undefined symbols:
  _driver_alloc, referenced from:
      _mq_drv_start in mq_series_drv-1e7a57.o
      _do_connect in mq_series_drv-1e7a57.o
      _do_put in mq_series_drv-1e7a57.o
      _do_get in mq_series_drv-1e7a57.o
      _alloc_and_decode_binary in mq_series_drv-1e7a57.o
      _handle_get in mq_series_drv-1e7a57.o
  _driver_async, referenced from:
      _do_connect in mq_series_drv-1e7a57.o
      _do_put in mq_series_drv-1e7a57.o
      _do_get in mq_series_drv-1e7a57.o
  _driver_free, referenced from:
      _mq_drv_stop in mq_series_drv-1e7a57.o
      _ready_async in mq_series_drv-1e7a57.o
      _ready_async in mq_series_drv-1e7a57.o
      _do_put in mq_series_drv-1e7a57.o
      _do_get in mq_series_drv-1e7a57.o
      _do_free in mq_series_drv-1e7a57.o
      _do_free in mq_series_drv-1e7a57.o
      ...
  _driver_output, referenced from:
      _ready_async in mq_series_drv-1e7a57.o
      _error_bad_arg in mq_series_drv-1e7a57.o
      _return_error in mq_series_drv-1e7a57.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Please advise.

your help is appreciated.

@IngelaAndin IngelaAndin added the team:VM Assigned to OTP team VM label Sep 28, 2024
@jhogberg
Copy link
Contributor

jhogberg commented Sep 30, 2024

This is an issue tracker, not a support forum. Try https://erlangforums.com/ :)

@amitabhadatta14
Copy link
Author

amitabhadatta14 commented Sep 30, 2024

This is an issue with the Erlang distribution in MacOS. ERL_DRIVER doesn't included in libel.a library, where as we have no issues in linux version.

@jhogberg
Copy link
Contributor

jhogberg commented Sep 30, 2024

No. libei has nothing to do with drivers, and the error is reported by the linker because you have failed to tell it what to do with undefined symbols. You must add some flags to make the linker on MacOS behave like the Linux one, as the defaults are different on each OS. This has nothing to do with Erlang as such.

Had you asked on the forum instead of opening a ticket, someone would already have told you which flags to use. The issue tracker is not for asking for help, and is in either case only checked on weekdays and then mostly during European working hours.

For what it's worth, the documentation mentions which additional flags you need on MacOS:

If you develop linked-in drivers (shared library) you need to link using gcc and the flags -bundle -flat_namespace -undefined suppress. You also include -fno-common in CFLAGS when compiling. Use .so as the library suffix.

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

No branches or pull requests

3 participants