TattdCodeMonkey / crc

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

Error compiling CRC for Nerves with non host target #49

Open taun opened 7 months ago

taun commented 7 months ago

It seems the CRC makefile may not be using the correct compiler when CROSSCOMPILE is set by Nerves.

Comments added to crc_src/makefile

$(info "**** CRC PLATFORM set to [$(PLATFORM)] ****")
$(info "**** CRC CROSSCOMPILE set to [$(CROSSCOMPILE)] ****")

Error when compiling crc ...

>MIX_TARGET=bbb mix deps.compile crc
==> nerves
==> atmos

Nerves environment
  MIX_TARGET:   bbb
  MIX_ENV:      dev

==> crc
"**** CRC PLATFORM set to [darwin] ****"
"**** CRC CROSSCOMPILE set to [/Users/taun/.nerves/artifacts/nerves_toolchain_armv7_nerves_linux_gnueabihf-darwin_arm-1.8.0/bin/armv7-nerves-linux-gnueabihf] ****"
 C      checksum_xor.c
armv7-nerves-linux-gnueabihf-gcc: error: unrecognized command-line option '-arch'; did you mean '-march='?
make: *** [/Users/taun/Development/Elixir/atmos/_build/bbb_dev/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 --force", update it with "mix deps.update crc" or clean it with "mix deps.clean crc"
==> atmos
** (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.

It seems the above is indicating, the platform is darwin which is correct but the crc source should be compiled using the cross compiler armv7-nerves-linux-gnueabihf-gcc and not compiled using darwin's cc which is what the makefile attempts.

TattdCodeMonkey commented 6 months ago

@taun 🤔 this will likely require some Makefile tinkering to adhere to the right cross compiler when provided from Nerves.

I might be able to tinker with this after the holidays as I have some time off but no guarantees on that.

TattdCodeMonkey commented 6 months ago

side note this really makes me want to work on #37 and ditch the NIFs entirely but alas thats on my wish list for awhile without the time to devote to the refactor.

Noarkhh commented 1 month ago

Hi @TattdCodeMonkey, any updates on this?

TattdCodeMonkey commented 2 weeks ago

@Noarkhh not really, I haven't had the time to reproduce this then work on a workaround