crane icon indicating copy to clipboard operation
crane copied to clipboard

buildDepsOnly for #![no_std]

Open newAM opened this issue 3 years ago • 1 comments

buildDepsOnly creates a blank src/lib.rs with mkDummySrc. This will fail to compile for #![no_std] targets such as thumbv7em-none-eabi because of the absence of a panic handler.

My workaround is to add sed -i '1s/^/#![no_std]/' src/lib.rs to the top of buildPhaseCargoCommand. A full example of this is avaliable here.

This works, but I wish it was more elegant:

  • Should #![no_std] targets be supported in crane? I am not sure if this is within the scope of crane.
  • If this is in scope, how should this be implemented? There are many possible solutions, I would be interested to hear your ideas!

newAM avatar Oct 08 '22 17:10 newAM

Thanks for the report @newAM ! I believe #126 should address this issue if you are interested in testing it out locally

ipetkov avatar Oct 08 '22 20:10 ipetkov