TattdCodeMonkey / crc

CRC library in elixir
MIT License
26 stars 15 forks source link

Cannot compile crc on archlinux #39

Open wowi42 opened 3 years ago

wowi42 commented 3 years ago

Error

noven/deps/crc on ī‚  main [!] is šŸ“¦ v0.9.2 via šŸ’§ 1.11.0 (OTP 23) via īž± 23.2 
šŸ•™ [ 19:21:17 ] āÆ elixir -v
Erlang/OTP 23 [erts-11.1.4] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe]

Elixir 1.11.0 (compiled with Erlang/OTP 23)

noven/deps/crc on ī‚  main [!] is šŸ“¦ v0.9.2 via šŸ’§ 1.11.0 (OTP 23) via īž± 23.2 
šŸ•™ [ 19:21:32 ] āÆ uname -a 
Linux palladium 5.9.14-arch1-1 #1 SMP PREEMPT Sat, 12 Dec 2020 14:37:12 +0000 x86_64 GNU/Linux

noven/deps/crc on ī‚  main [!] is šŸ“¦ v0.9.2 via šŸ’§ 1.11.0 (OTP 23) via īž± 23.2 
šŸ•™ [ 19:21:41 ] āÆ mix compile\

 LD     crc_nif.so
/usr/bin/ld: cannot find -lerl_interface
collect2: error: ld returned 1 exit status
make: *** [Makefile:151: /home/loictosser/github.com/KalvadTech/noven/deps/crc/priv/crc_nif.so] Error 1
** (Mix) Could not compile with "make" (exit status: 2).
You need to have gcc and make installed. If you are using
Ubuntu or any other Debian-based system, install the packages
"build-essential". Also install "erlang-dev" package if not
included in your Erlang/OTP version. If you're on Fedora, run
"dnf group install 'Development Tools'".

Notes

Dlacreme commented 3 years ago

I am facing the same issue. Any updates?

TattdCodeMonkey commented 3 years ago

@wowi42 @Dlacreme I do not have a machine with Archlinux or the time to investigate at the moment. I'd welcome a PR, but otherwise I expect this is an issue with the local environment and elixir/erlang dev tools, maybe elixir_make.

TattdCodeMonkey commented 3 years ago

Something similar has been seen on other OSs #32 but I've only seen it a few times and not been able to reproduce to investigate it properly.

vsouza commented 3 years ago

I was facing the same issue and I solved using the following steps:

RUN apk update              \
 && apk upgrade \
 && apk --no-cache --update add build-base \
 && apk add bash gcc g++ make erlang-dev alpine-sdk \
 && rm -rf /var/cache/apk/*

and after mix deps.get and before mix deps.compile :

RUN mix deps.update crc

The version of CRC will be upgraded and you can build without any problems.

Upgraded:
  crc 0.10.0 => 0.10.1
  elixir_make 0.6.0 => 0.6.2

Hope that this can help you folks.

cokron commented 2 years ago

I had the same problem when I upgraded from {:crc, "0.9.1"} to {:crc, "0.10.4"}.

My app uses the nerves-framework to build applications for an RPI Zero on Mac OS Big Sur on an Intel platform. The cross compilation fails with

==> crc
 C      checksum_xor.c
armv6-nerves-linux-gnueabihf-gcc: error: x86_64: No such file or directory
armv6-nerves-linux-gnueabihf-gcc: error: unrecognized command-line option '-arch'; did you mean '-march='?
make: *** [[...]/_build/rpi_rpi/lib/crc/obj/checksum_xor.o] Error 1
could not compile dependency :crc, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile crc", update it with "mix deps.update crc" or clean it with "mix deps.clean crc"

I am staying with the old version of crc, hoping that I will not want to switch to M1 too soon...

UPDATE: I was wrong, I can neither compile version 0.9.1 nor version 0.10.4.

For nerves, I do export MIX_TARGET=rpi. mix deps.get runs fine, but mix compile fails with above error message.

I updated XCode and developer tools, but this did not fix anything. I am stuck here and google is not helpful this time. So any help is greatly appreciated.

Everything compiled fine before I updated Erlang and Elixir from Erlang 21.3.8.9, Elixir 1.6.6-otp-20 to

erl -version
Erlang (SMP,ASYNC_THREADS) (BEAM) emulator version 12.1.5

iex --version
Erlang/OTP 24 [erts-12.1.5] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [jit]

IEx 1.13.3 (compiled with Erlang/OTP 24)

and Nerves from 1.0 to 1.7.16.