pure-c / purec

C backend for PureScript
234 stars 8 forks source link

Windows compilation issues #58

Open btrepp opened 5 years ago

btrepp commented 5 years ago

So I was feeling adventurous and tried to see how far I could get on windows. I figure this is way outside of the short term goals, but in case anyone tries to get purec going on windows here is my notes.

Find is annoying on windows.

Find seems to always want to be the windows find, rather than any alternatives. No matter how you manipulate the path. I've had some success defining FIND?=find and setting that in the shell to make 'make' not use the find in system32.

BWDGC needs autogen+configure.

These seem to be hard to come buy without a whole msys environment. However I did succeed using the Makefile.direct and clang to get a static lib compiled.

Purs doesn't get all the dependencies

https://github.com/pure-c/purec/blob/7cac5ea8db3db11123ce8c151f35127010bd675a/mk/target.mk#L111 doesn't seem to pass all the .purs files in.

I seem to only get the src files, none of the dependencies here, this causes purs to fail to generate the corefn as it doesn't know its packages. adding on $(PACKAGE_SOURCES) gets this to the next step.

I haven't been able to figure out the linker.

Following the above gets me plenty of object files, but the link step fails. It spews out

Effect.Unsafe.o : error LNK2005: utf8casecmp already defined in Control.Applicative.o Effect.Unsafe.o : error LNK2005: utf8codepoint already defined in Control.Applicative.o Which is the last part I couldn't figure out, I'll admit my toolchain is probably weird, clang on windows and I'm not sure what clangs linker is doing here.