extendr / rextendr

An R package that helps scaffolding extendr-enabled packages or compiling Rust code dynamically
https://extendr.github.io/rextendr/
Other
181 stars 27 forks source link

Do not compile fake gcc code on Windows #217

Closed Ilia-Kosenkov closed 1 year ago

Ilia-Kosenkov commented 1 year ago

Another attempt to close #209. For successful compilation, linker requires libgcc_eh.a. Instead of compiling an empty .c file into a library file, which is a non-atomic operation, we can resort to simply touching libgcc_eh.a, which satisfies the linker's needs. In the end, it gets all of the necessary exports from other libgcc*.a libs, but requires libgcc_eh.a to just exist on the search path.

Ilia-Kosenkov commented 1 year ago

The ci shows I did not fix yet another usage of cp, will fix it later today

yutannihilation commented 1 year ago

Ah, probably that's the problem? Sorry, it might be my mistake. I can't remember why I added the lines also to configure.ucrt. Maybe we can delete the whole file.

Ilia-Kosenkov commented 1 year ago

Yep, that's the one. I'll test without it as well.

yutannihilation commented 1 year ago

Sorry, I just remembered how it works. On invoke_cargo(), the compilation is not what's done inside an R package, so it doesn't use Makevars.win. That's why we need another logic to inject the fake libgcc_eh.a.

https://github.com/extendr/rextendr/pull/218

Ilia-Kosenkov commented 1 year ago

Abandoning in favor of #218