apps icon indicating copy to clipboard operation
apps copied to clipboard

[Nexus] Getting `mix setup` error for `:crc` dependency on first run.

Open jaspervanbrian opened this issue 1 year ago • 3 comments

Seems renaming of crc_algorithm fails on the first try. Can confirm I both have gcc and make, but it's giving errors on the first mix setup

Second run of mix setup, seems the app is fine though.

Error message:

==> ex_stun                                                                                                                                                                                                                                   
Compiling 16 files (.ex)                                                                                                                                                                                                                      
warning: 0..(2 <<< 14) - 1 inside guards requires an explicit step, please write 0..(2 <<< 14) - 1//1 or 0..(2 <<< 14) - 1//-1 instead
  lib/ex_stun/message/type.ex:51: ExSTUN.Message.Type.from_value/1                                                     

Generated ex_stun app                                      
==> elixir_make                                            
Compiling 8 files (.ex)                                    
Generated elixir_make app                                  
==> crc                                                    
 C      checksum_xor.c                                     
 C      crc_8.c                                            
 C      crc_algorithm.c                                    
Rename failed: /Users/user/Projects/phoenix-projects/apps/nexus/_build/dev/lib/crc/obj/crc_algorithm-dc3af234.o.tmp -> /Users/user/Projects/phoenix-projects/apps/nexus/_build/dev/lib/crc/obj/crc_algorithm.o: No such file or directory
error: unable to rename temporary '/Users/user/Projects/phoenix-projects/apps/nexus/_build/dev/lib/crc/obj/crc_algorithm-dc3af234.o.tmp' to output file '/Users/user/Projects/phoenix-projects/apps/nexus/_build/dev/lib/crc/obj/crc_algorithm
.o': 'No such file or directory'                           
1 error generated.                                         
make: *** [/Users/user/Projects/phoenix-projects/apps/nexus/_build/dev/lib/crc/obj/crc_algorithm.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 --force", update it with "mix deps.update crc" or clean it with "mix deps.clean crc"
==> nexus                                                  
** (Mix) Could not compile with "make" (exit status: 2).
You need to have gcc and make installed. Try running the
commands "gcc --version" and / or "make --version". If these programs                                                  
are not installed, you will be prompted to install them.

jaspervanbrian avatar Dec 18 '24 14:12 jaspervanbrian

That's interesting. We didnt notice any problems with crc so far. What's your os, erlang and Elixir versions?

mickel8 avatar Dec 18 '24 15:12 mickel8

@mickel8 I'm on Sonoma, macOS 14.5 23F79 arm64

erl and elixir

Erlang/OTP 27 [erts-15.1.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

Elixir 1.17.3 (compiled with Erlang/OTP 27)

jaspervanbrian avatar Dec 18 '24 16:12 jaspervanbrian

Sorry for the late response. It looks like the problem lies in crc itself, especially looking at their issues(https://github.com/TattdCodeMonkey/crc/issues/32 https://github.com/TattdCodeMonkey/crc/issues/49 https://github.com/TattdCodeMonkey/crc/issues/46 https://github.com/TattdCodeMonkey/crc/issues/39). I am not sure what we can do with this. Erlang crc function (which is a wrapper on zlib) does not allow for specifying custom poly (we need 0x04C11DB7). OpenSSL does not offer crc functions (we already depend on OpenSSl so we could switch to it). The only option I can see is to either contribute to the crc library or move to the Rust library link but this would require other people to install Rust :thinking:

mickel8 avatar Dec 30 '24 13:12 mickel8