-
Notifications
You must be signed in to change notification settings - Fork 118
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
Cannot build with ODBC support on M1 Macs using ARM-based version of Homebrew #191
Comments
it worked for me: |
@cdeyoung Did you find a way to build it with ODBC support? |
Hope this will help anyone. You need to install unixodbc with
Add
Also we need to set ENVs
After this you can install erlang with |
Sorry for the very late reply, @Stratus3D. I've been down with health issues and just got back to this. No, I have not compiled Erlang with ODBC support yet on an M1 but I haven't tried @nikneroz's suggestion either. I'll try it. |
@nikneroz This didn't work for me (erlang 24.1.7), mac os 12.1 M1 (terminal kitty, in x86 mode) |
Worked fine 🚀 I just needed:
|
What is worked for me: |
@carlogilmar which variables are you referring to in step 4? |
The environment variables that were mentioned above. Worked for me too. |
After some testing based on @nikneroz's instructions, I've determined that the following pattern works, at least on Apple Silicon Macs with Erlang 25.0.3 when building using The first expectation is that the ODBC library is installed using Homebrew: Second, you must link the install directory to Then, the following environment variables must be set before triggering the Erlang build system:
Then, you can build Erlang using whatever build pattern you prefer. For example, I use The configuration depends on the helper command Autoconf is the program that determines how to configure the Erlang build and as part of that process it will try to detect whether dependency libraries are installed for different features. If the library isn't installed, it disables the feature.
Note, you do not need to pass |
In my case, But So I just changed it to Thanks, guys! |
Thanks @leandro-cft! Edited my instructions with your updates. |
Updated instructions You need to install unixodbc with
Add
Also we need to set ENVs
After this you can install erlang with asdf install erlang 25.1.2 |
I didn't like the solution of having to create a symbolic link so I dug deep into the Erlang Makefiles in an attempt to discover the root of this problem. In short: the Erlang build system doesn't recognize it's building on Darwin in recent versions because it assumes the version string starts with $ uname -a
Darwin <hostname> 22.5.0 Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000 arm64 This causes it to fall through to a generic case that looks for ODBC libraries and headers in It will also check in the directory supplied with I considered submitting a patch to fix this upstream but I really hate fighting with Autotools and I couldn't figure out how to make it work generically, and I don't know what Erlang/OTP's support policy is for older versions of macOS (I typically only care about the latest because I try to upgrade as soon as possible). The build system also expects macOS to ship with So in conclusion, to build without linking export CPPFLAGS="${CPPFLAGS+"$CPPFLAGS "}-I/opt/homebrew/opt/unixodbc/include"
export LDFLAGS="${LDFLAGS+"$LDFLAGS "}-L/opt/homebrew/opt/unixodbc/lib"
export KERL_CONFIGURE_OPTIONS="--with-odbc=/opt/homebrew/opt/unixodbc" Ironically, I've still yet to use the ODBC support in Erlang and Elixir, I just hate build errors and having "incomplete" Erlang runtime installs hanging around. |
Homebrew installs packages on Intel-based Macs into
/usr/local
. It installs packages on M1-based Macs into/opt/homebrew
. The asdf-erlang package currently fails to build support for ODBC (even though the unixodbc package is installed) with the following error:* odbc : ODBC library - link check failed
I've verified that the library files are linked using the
brew link
command. I've also tried setting my environment to manually point to the ODBC files in/opt/homebrew
, but the asdf-erlang package still can't seem to find the library files on M1 Macs. It works fine on Intel-based Macs.The text was updated successfully, but these errors were encountered: