Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

wscript uses sys.platform to check OS rather than DEST_OS #1266

Closed
adammw opened this issue Jul 3, 2011 · 4 comments
Closed

wscript uses sys.platform to check OS rather than DEST_OS #1266

adammw opened this issue Jul 3, 2011 · 4 comments

Comments

@adammw
Copy link

adammw commented Jul 3, 2011

wscript uses sys.platform to check OS (e.g. sys.platform.startswith("win32")) rather than env['DEST_OS'] which prevents cross-compilation.

This is present also in deps/libeio/wscript as well as root wscript.

@sh1mmer
Copy link

sh1mmer commented Nov 2, 2011

This seems like a valid issue, but it seems like it should fallback to sys.platform.startswith()

Can you submit a patch for this?

@adammw
Copy link
Author

adammw commented Nov 9, 2011

I've started on a patch for this, but encountered a whole bunch of other problems preventing cross-compile from working.

  1. There is some places in wscript where the Envrionment object is not available, specifically shutdown(), which would be required to get make clean to work properly in that scenario. I think a waf/python expert is needed to handle that.
  2. A lot of the dependencies use different and weird compiling tools, specifically uv's makefile or tools need to be rewritten to support some of this cross-compiling, at the moment it depends on uname and can't easily be overridden.
  3. Also scons V8 build command doesn't take into account DEST_OS #1264 needs addessing. I've included that patch but I'm not even sure where DEST_OS comes from, so I don't know what values it could have or if it needs special mapping to the v8 equivilants.

Another thing to consider is that there is three different ways to support cross-compiling, ideally we would want to support all three:

  1. Setting $AS,$AR,$RANLIB,$CPPFLAGS,$CFLAGS,$CXXFLAGS,$CC,$CPP,$CXX,$LD,$STRIP, etc. environmental variables.
  2. Setting $PREFIX (and/or using --prefix in configure script)
  3. Using --host in configure script

#1 seems to be the closest to working with my patch in place (although work needs to be done for uv, etc.).
#2 seems to be partially supported by uv, not by any of the others
#3 isn't supported at all by node's wscript, but I would like it to be...

Another issue I came across is i'm not sure exactly what in the configure script uses sys.platform because of build platform problems vs using sys.platform to detect host platform of the final binary, so I guess some checking by people who understand the configure script better would be needed to ensure no accidental bugs make it in.

The patch is in my fork, adammw@14b070a, but I'd rather that patches to fix this other stuff all gets committed at once.

@adammw
Copy link
Author

adammw commented Nov 17, 2011

Seems like node is dropping wscript/waf/scons on master, perhaps this will become easier with GYP?
Not sure if I should continue with my wscript patches, seeing as they are reasonably buggy and have the problems listed above, hopefully I'll be able to understand how GYP works and not many changes are needed for it to support cross compiling.

@adammw
Copy link
Author

adammw commented Nov 19, 2011

Assuming GYP is replacing wscript and scons, see #2148 for GYP equivalent. Closing this issue unless anyone really wants to get it to work with waf/scons/whatever, then I'll reopen.

@adammw adammw closed this as completed Nov 19, 2011
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants