Skip to content

Symbol not found: _SASToken_CreateString on Apple Silicon with Azure Functions #278

@jimbobbennett

Description

@jimbobbennett
  • UAMQP Package Version: 1.2.14
  • Operating System: macOS Big Sur on Apple M1
  • Python Version: 3.9

Describe the bug
When importing the azure.iot.hub package into an Azure Functions Project, the application throws an ImportError:

Result: Failure
[2021-09-30T19:48:47.531Z] Exception: ImportError: dlopen(/Users/jim/scratch-pad/.venv/lib/python3.9/site-packages/uamqp/c_uamqp.cpython-39-darwin.so, 2): Symbol not found: _SASToken_CreateString
[2021-09-30T19:48:47.531Z]   Referenced from: /Users/jim/scratch-pad/.venv/lib/python3.9/site-packages/uamqp/c_uamqp.cpython-39-darwin.so
[2021-09-30T19:48:47.531Z]   Expected in: flat namespace
[2021-09-30T19:48:47.531Z]  in /Users/jim/scratch-pad/.venv/lib/python3.9/site-packages/uamqp/c_uamqp.cpython-39-darwin.so. Troubleshooting Guide: https://aka.ms/functions-modulenotfound
[2021-09-30T19:48:47.531Z] Stack:   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3734/workers/python/3.9/OSX/X64/azure_functions_worker/dispatcher.py", line 305, in _handle__function_load_request
[2021-09-30T19:48:47.531Z]     func = loader.load_function(
[2021-09-30T19:48:47.531Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3734/workers/python/3.9/OSX/X64/azure_functions_worker/utils/wrappers.py", line 42, in call
[2021-09-30T19:48:47.531Z]     raise extend_exception_message(e, message)
[2021-09-30T19:48:47.531Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3734/workers/python/3.9/OSX/X64/azure_functions_worker/utils/wrappers.py", line 40, in call
[2021-09-30T19:48:47.531Z]     return func(*args, **kwargs)
[2021-09-30T19:48:47.531Z]   File "/opt/homebrew/Cellar/azure-functions-core-tools@3/3.0.3734/workers/python/3.9/OSX/X64/azure_functions_worker/loader.py", line 83, in load_function
[2021-09-30T19:48:47.531Z]     mod = importlib.import_module(fullmodname)
[2021-09-30T19:48:47.532Z]   File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module
[2021-09-30T19:48:47.532Z]     return _bootstrap._gcd_import(name[level:], package, level)
[2021-09-30T19:48:47.532Z]   File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
[2021-09-30T19:48:47.532Z]   File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
[2021-09-30T19:48:47.532Z]   File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
[2021-09-30T19:48:47.532Z]   File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
[2021-09-30T19:48:47.532Z]   File "<frozen importlib._bootstrap_external>", line 850, in exec_module
[2021-09-30T19:48:47.532Z]   File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
[2021-09-30T19:48:47.532Z]   File "/Users/jim/scratch-pad/iot-trigger/__init__.py", line 6, in <module>
[2021-09-30T19:48:47.532Z]     from azure.iot.hub import IoTHubRegistryManager
[2021-09-30T19:48:47.532Z]   File "/Users/jim/scratch-pad/.venv/lib/python3.9/site-packages/azure/iot/hub/__init__.py", line 6, in <module>
[2021-09-30T19:48:47.532Z]     from .iothub_registry_manager import IoTHubRegistryManager
[2021-09-30T19:48:47.532Z]   File "/Users/jim/scratch-pad/.venv/lib/python3.9/site-packages/azure/iot/hub/iothub_registry_manager.py", line 6, in <module>
[2021-09-30T19:48:47.532Z]     from . import iothub_amqp_client
[2021-09-30T19:48:47.532Z]   File "/Users/jim/scratch-pad/.venv/lib/python3.9/site-packages/azure/iot/hub/iothub_amqp_client.py", line 23, in <module>
[2021-09-30T19:48:47.532Z]     import uamqp
[2021-09-30T19:48:47.532Z]   File "/Users/jim/scratch-pad/.venv/lib/python3.9/site-packages/uamqp/__init__.py", line 12, in <module>
[2021-09-30T19:48:47.532Z]     from uamqp import c_uamqp  # pylint: disable=import-self

To Reproduce
Steps to reproduce the behavior:

  1. Create an Azure Functions project
  2. Add azure-iot-hub to the requirements.txt file, create a virtual environment and install the packages from this file
  3. Import from azure.iot.hub in the __init__.py file

You can find a project to reproduce this here: https://github.com/jimbobbennett/iot-func-error

Expected behavior
It should work and not thrown an exception.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions