crc icon indicating copy to clipboard operation
crc copied to clipboard

Error compiling CRC for Nerves with non host target

Open taun opened this issue 1 year ago • 4 comments

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.

taun avatar Dec 07 '23 23:12 taun

@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 avatar Dec 18 '23 22:12 TattdCodeMonkey

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.

TattdCodeMonkey avatar Dec 18 '23 22:12 TattdCodeMonkey

Hi @TattdCodeMonkey, any updates on this?

Noarkhh avatar May 22 '24 12:05 Noarkhh

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

TattdCodeMonkey avatar Jun 24 '24 18:06 TattdCodeMonkey