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

Failing to build on Arch #286

Open
skwerlman opened this issue Oct 18, 2023 · 14 comments
Open

Failing to build on Arch #286

skwerlman opened this issue Oct 18, 2023 · 14 comments

Comments

@skwerlman
Copy link

skwerlman commented Oct 18, 2023

Currently, Erlang (specifically ODBC) is failing to build for me on arch linux with errors about undefined references to ei_*:

 CC ../priv/bin/x86_64-pc-linux-gnu/odbcserver
/usr/bin/ld: ../priv/obj/x86_64-pc-linux-gnu/odbcserver.o: in function `encode_column_dyn':
/home/sk/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.2/otp_src_26.1.2/lib/odbc/c_src/odbcserver.c:1511:(.text+0x787): undefined reference to `ei_x_encode_tuple_header'
/usr/bin/ld: /home/sk/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.2/otp_src_26.1.2/lib/odbc/c_src/odbcserver.c:1512:(.text+0x794): undefined reference to `ei_x_encode_tuple_header'
/usr/bin/ld: /home/sk/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.2/otp_src_26.1.2/lib/odbc/c_src/odbcserver.c:1513:(.text+0x7a1): undefined reference to `ei_x_encode_ulong'
/usr/bin/ld: /home/sk/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.2/otp_src_26.1.2/lib/odbc/c_src/odbcserver.c:1514:(.text+0x7ad): undefined reference to `ei_x_encode_ulong'
... ~200 lines of this in total, see full log attached ...
collect2: error: ld returned 1 exit status
make[4]: *** [x86_64-pc-linux-gnu/Makefile:112: ../priv/bin/x86_64-pc-linux-gnu/odbcserver] Error 1
make[4]: Leaving directory '/home/sk/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.2/otp_src_26.1.2/lib/odbc/c_src'
make[3]: *** [/home/sk/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.2/otp_src_26.1.2/make/run_make.mk:35: opt] Error 2
make[3]: Leaving directory '/home/sk/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.2/otp_src_26.1.2/lib/odbc/c_src'
make[2]: *** [/home/sk/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.2/otp_src_26.1.2/make/otp_subdir.mk:29: opt] Error 2
make[2]: Leaving directory '/home/sk/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.2/otp_src_26.1.2/lib/odbc'
make[1]: *** [/home/sk/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.2/otp_src_26.1.2/make/otp_subdir.mk:29: opt] Error 2
make[1]: Leaving directory '/home/sk/.asdf/plugins/erlang/kerl-home/builds/asdf_26.1.2/otp_src_26.1.2/lib'
make: *** [Makefile:518: libs] Error 2

asdf info:

a5% asdf info
OS:
Linux a5 6.5.7-zen2-1.1-zen #1 ZEN SMP PREEMPT_DYNAMIC Sun, 15 Oct 2023 23:30:34 +0000 x86_64 GNU/Linux

SHELL:
zsh 5.9 (x86_64-pc-linux-gnu)

BASH VERSION:
5.1.16(1)-release

ASDF VERSION:
v0.13.1-0586b37

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/home/sk/.asdf
ASDF_DIR=/home/sk/.local/share/zinit/plugins/asdf-vm---asdf
ASDF_CONFIG_FILE=/home/sk/.asdfrc

ASDF INSTALLED PLUGINS:
crystal                      https://github.com/asdf-community/asdf-crystal.git master 6b5c52a
direnv                       https://github.com/asdf-community/asdf-direnv.git master 2b649c8
elixir                       https://github.com/asdf-vm/asdf-elixir.git master a4c42e1
erlang                       https://github.com/asdf-vm/asdf-erlang.git master 6744df7
gleam                        https://github.com/vic/asdf-gleam.git master b45a651
lua                          https://github.com/Stratus3D/asdf-lua.git master 36fae6e
nim                          https://github.com/asdf-community/asdf-nim.git main 397c14a
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master 9c4e0f2
yarn                         https://github.com/twuni/asdf-yarn.git main 376c540
zig                          https://github.com/cheetah/asdf-zig.git master d88f6db

System library versions:

a5% pacman -Q glu mesa wxwidgets-gtk3 libpng libssh unixodbc libxslt fop
glu 9.0.3-1.1
mesa 1:23.2.1-2.1
wxwidgets-gtk3 3.2.3-1.1
libpng 1.6.40-2.1
libssh 0.10.5-1.1
unixodbc 2.3.12-1.1
libxslt 1.1.38-1.1
fop 2.9-1

The ones which have .1 in the last segment are optimized rebuilds from ALHP, but building without ALHP gives the same error.

Full build log: otp_build_26.1.2.log

@rawhat
Copy link

rawhat commented Oct 19, 2023

This may be related? I'm not totally sure erlang/otp#5609

@skwerlman
Copy link
Author

Unfortunately, using the flags specified in that issue both as prefixes to the asdf install command and as entries in kerlrc does not fix my issue.

the flags i tried:

CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -flto -ffat-lto-objects"
LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"

@skwerlman
Copy link
Author

skwerlman commented Oct 20, 2023

a5% nm lib/erl_interface/obj/x86_64-pc-linux-gnu/libei.a | grep ei_encode_atom
         U ei_encode_atom
         U ei_encode_atom
nm: decode_bignum.o: no symbols
nm: decode_long.o: no symbols
nm: decode_ulong.o: no symbols
00000000 T ei_encode_atom
00000000 T ei_encode_atom_as
00000000 T ei_encode_atom_len
00000000 T ei_encode_atom_len_as
nm: encode_bignum.o: no symbols
         U ei_encode_atom_as
nm: encode_long.o: no symbols
         U ei_encode_atom_len_as
         U ei_encode_atom_len_as
         U ei_encode_atom_len_as
nm: encode_ulong.o: no symbols
         U ei_encode_atom_len_as
         U ei_encode_atom
         U ei_encode_atom
         U ei_encode_atom
         U ei_encode_atom

it seems like its incorrectly stripping the values of a lot of symbols, but i'm at the limit of my ability to debug this kind of stuff

@derekkraan
Copy link

derekkraan commented Oct 25, 2023

A very temporary solution for anyone else in the same situation (who doesn't need odbc):

KERL_CONFIGURE_OPTIONS="--without-odbc" asdf install erlang 26.1.2

(recommended to me by someone in the Erlang slack)

@rawhat
Copy link

rawhat commented Oct 25, 2023

Interestingly, I was able to get this to install on WSL2 (also running Arch), but not a laptop running Arch. Not really sure what I might have set up differently between the two. I'm not sure where to start looking into that at the moment...

@ramoncreager
Copy link

ramoncreager commented Oct 26, 2023

This seems to be specific to Arch itself, not its derivatives (yet). I have 2 machines running Manjaro ARM and 1 running Manjaro amd64, and those can successfully build Erlang using asdf-erlang. I have 2 machines running Arch proper (amd64), and both fail. Moreover, both have built successfully not that long ago. The Erlang version I currently have installed and working on them is 26.0.2. But even that older version will no longer built on Arch. So the problem appears to be something that popped up at some point after doing an Arch update.

My guess is that it will eventually show up downstream in WSL2, Manjaro, etc. I just did an update on one of my Arch machines, but it still doesn't build. I also booted into Arch with the linux-lts kernel, but that didn't help either. My next step is to sidestep asdf and build using kerl, see how that goes.

Update: kerl build 26.1.2 also fails, same error.

@Damirados
Copy link

Weird thing in my case. I have 2 machines running fully updated Arch amd64. One is building Erlang using asdf-erlang and also nerves host-erlang successfully other one fails on both builds with same error.

@skwerlman
Copy link
Author

skwerlman commented Oct 31, 2023

Weird thing in my case. I have 2 machines running fully updated Arch amd64. One is building Erlang using asdf-erlang and also nerves host-erlang successfully other one fails on both builds with same error.

if two different installs are seeing different results, i wonder if some seemingly unrelated package is breaking stuff

@Damirados can you upload the build logs and lists of installed packages for each? there might be a clue in there

@Damirados
Copy link

First from successful system
packages.txt
otp_build_26.1.2.log
otp_install_26.1.2.log

And from one that fails
packages.txt
otp_build_26.1.2.log

@hscHeric
Copy link

Recently, I faced a compilation issue on Manjaro and chose to format the system to its base ISO version. I installed the specific versions required for my use and then updated the system. While it's not the ideal solution, it might work for those who frequently need specific versions and don't mind formatting the system when needed.

@eramoss
Copy link
Contributor

eramoss commented Feb 6, 2024

I faced the same problem, if it is only the odbc, just install via pacman and tell the kerl configure to use that.

In my case:

export KERL_CONFIGURE_OPTIONS="--with-odbc=/var/lib/pacman/local/unixodbc-2.3.12-1"

I didn't really test without the flag, so i don't know if the Autoconf can do it without export the flag --with-odbc

@skwerlman
Copy link
Author

skwerlman commented Feb 17, 2024

I faced the same problem, if it is only the odbc, just install via pacman and tell the kerl configure to use that.

In my case:

export KERL_CONFIGURE_OPTIONS="--with-odbc=/var/lib/pacman/local/unixodbc-2.3.12-1"

I didn't really test without the flag, so i don't know if the Autoconf can do it without export the flag --with-odbc

this worked for me, thanks!

i had unixodbc installed, but i hadnt set the set the configure flag

so that i wont need to manually update the variable later, i added this to my .zshenv:

export KERL_CONFIGURE_OPTIONS="--with-odbc=/var/lib/pacman/local/unixodbc-$(pacman -Q unixodbc | cut -d' ' -f2)"

@jfpedroza
Copy link

I have the same issue and found this. It seems Erlang has its own libei, but the linker is picking the version in the system if installed. The issue was already solved in master.

@warmwaffles
Copy link

warmwaffles commented May 3, 2024

Just ran into this issue as well. Following the suggestion here 708a750 seems to have worked.

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

9 participants