Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
build a node addon on windows for linux
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
NodeNinja  
View profile  
 More options Oct 28 2012, 9:31 am
From: NodeNinja <aeon6f...@gmail.com>
Date: Sun, 28 Oct 2012 06:31:43 -0700 (PDT)
Local: Sun, Oct 28 2012 9:31 am
Subject: build a node addon on windows for linux

I successfully built a node add-on on windows using Visual Studio.
Now I want to build the same add-on on windows but targeting Linux.

1. Is it possible to compile a node c++ add-on on windows for Linux?
2. What compiler should I install on windows?
3. Would it be possible using node-gyp?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mscdex  
View profile  
 More options Oct 28 2012, 9:57 am
From: mscdex <msc...@gmail.com>
Date: Sun, 28 Oct 2012 06:57:10 -0700 (PDT)
Local: Sun, Oct 28 2012 9:57 am
Subject: Re: build a node addon on windows for linux
On Oct 28, 9:31 am, NodeNinja <aeon6f...@gmail.com> wrote:

> I successfully built a node add-on on windows using Visual Studio.
> Now I want to build the same add-on on windows but targeting Linux.

It's probably going to be easier to just create a linux VM for
compiling/testing purposes.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
NodeNinja  
View profile  
 More options Oct 28 2012, 1:15 pm
From: NodeNinja <aeon6f...@gmail.com>
Date: Sun, 28 Oct 2012 10:15:25 -0700 (PDT)
Local: Sun, Oct 28 2012 1:15 pm
Subject: Re: build a node addon on windows for linux

> It's probably going to be easier to just create a linux VM for
> compiling/testing purposes.

I had seen a few binding.gyp scripts with lines like these

'conditions': [
 ['OS=="linux"',

['OS=="mac"',

 ['OS=="win"',

]

and was wondering if there was anyway to target multiple platforms?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mscdex  
View profile  
 More options Oct 28 2012, 1:37 pm
From: mscdex <msc...@gmail.com>
Date: Sun, 28 Oct 2012 10:37:37 -0700 (PDT)
Local: Sun, Oct 28 2012 1:37 pm
Subject: Re: build a node addon on windows for linux
On Oct 28, 1:15 pm, NodeNinja <aeon6f...@gmail.com> wrote:

> and was wondering if there was anyway to target multiple platforms?

Sure, you can target multiple platforms in your binding.gyp easily
using conditionals like that. However I thought you were originally
asking how to compile a Linux executable on Windows.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
NodeNinja  
View profile  
 More options Oct 28 2012, 11:30 pm
From: NodeNinja <aeon6f...@gmail.com>
Date: Sun, 28 Oct 2012 20:30:03 -0700 (PDT)
Local: Sun, Oct 28 2012 11:30 pm
Subject: Re: build a node addon on windows for linux

On Sunday, October 28, 2012 11:07:48 PM UTC+5:30, mscdex wrote:

> On Oct 28, 1:15 pm, NodeNinja <aeon6f...@gmail.com> wrote:
> > and was wondering if there was anyway to target multiple platforms?

> Sure, you can target multiple platforms in your binding.gyp easily
> using conditionals like that. However I thought you were originally
> asking how to compile a Linux executable on Windows.

My intention in to build the addon on one system preferably having Windows
OS and then use that addon on Windows and Linux.
If I do something like this in binding.gyp
'conditions': [
 ['OS=="linux"',

['OS=="mac"',

 ['OS=="win"',

]
and then building the addon on windows?

1. Will three versions of the addon be generated?
2. Can I then run the addon on Windows and Linux?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ben Noordhuis  
View profile  
 More options Oct 29 2012, 8:08 am
From: Ben Noordhuis <i...@bnoordhuis.nl>
Date: Mon, 29 Oct 2012 13:07:47 +0100
Local: Mon, Oct 29 2012 8:07 am
Subject: Re: [nodejs] Re: build a node addon on windows for linux

No.  You need to run the node-gyp configure/build cycle once for each
platform that you target.  Here is how you approximately would script
that on a UNIX system:

  for OS in linux mac win; do
    GYP_DEFINES="-DOS=$OS" CC=gcc-$OS CXX=g++-$OS node-gyp rebuild --arch=ia32
    cp build/Release/module.node build/Release/module-$OS.node
  done

CC and CXX need to point to the cross-compilers for the platform that
you're compiling for.  If your module is C++ only, you can skip the CC
variable.

> 2. Can I then run the addon on Windows and Linux?

Provided you get everything to compile, yes. :-)

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
NodeNinja  
View profile  
 More options Oct 29 2012, 11:47 pm
From: NodeNinja <aeon6f...@gmail.com>
Date: Mon, 29 Oct 2012 20:47:12 -0700 (PDT)
Local: Mon, Oct 29 2012 11:47 pm
Subject: Re: [nodejs] Re: build a node addon on windows for linux

> No.  You need to run the node-gyp configure/build cycle once for each
> platform that you target.  Here is how you approximately would script
> that on a UNIX system:

> That was great news Ben,

Since I am doing this on a Windows system What cross compiler would you
recommend to target Unix/Linux,  gcc or MinGW?

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mscdex  
View profile  
 More options Oct 30 2012, 12:39 am
From: mscdex <msc...@gmail.com>
Date: Mon, 29 Oct 2012 21:39:40 -0700 (PDT)
Local: Tues, Oct 30 2012 12:39 am
Subject: Re: build a node addon on windows for linux
On Oct 29, 11:47 pm, NodeNinja <aeon6f...@gmail.com> wrote:

> Since I am doing this on a Windows system What cross compiler would you
> recommend to target Unix/Linux,  gcc or MinGW?

I recommend setting up and using a local Linux virtual machine if you
do not have access to a Linux system elsewhere.

You might be able to get away with using a cross-compiler under
cygwin, but just mentioning that makes me cringe.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
NodeNinja  
View profile  
 More options Nov 1 2012, 12:01 am
From: NodeNinja <aeon6f...@gmail.com>
Date: Wed, 31 Oct 2012 21:01:43 -0700 (PDT)
Local: Thurs, Nov 1 2012 12:01 am
Subject: Re: build a node addon on windows for linux

> I recommend setting up and using a local Linux virtual machine if you
> do not have access to a Linux system elsewhere.

> You might be able to get away with using a cross-compiler under
> cygwin, but just mentioning that makes me cringe.

Your advice is sound mscdex...
I couldn't find much info on the net for cross compiling on windows
possibly install linux on a vm is a good way to start!

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Kunkee  
View profile  
 More options Nov 2 2012, 2:00 am
From: Jonathan Kunkee <jonathan.kun...@gmail.com>
Date: Thu, 1 Nov 2012 23:00:00 -0700 (PDT)
Subject: Re: build a node addon on windows for linux

> You might be able to get away with using a cross-compiler under
>> cygwin, but just mentioning that makes me cringe.

> Your advice is sound mscdex...
> I couldn't find much info on the net for cross compiling on windows
> possibly install linux on a vm is a good way to start!

 Yeah...that is theoretically possible, but good luck getting libc to
match, let alone your other bindings, architectures, etc.

NodeNinja:

Note that having a module that will hapilly 'npm install' on all three OSes
does NOT require pre-building them. The Gyp scripting you saw does exactly
that: it detects which OS it's building on and follows different
instructions for each. Testing all three, on the other hand...I second
mscdex' vote for using a virtual machine to test in a native environment. :)

If you're looking at an embedded system, you *might* want to cross-compile
the module down to a binary on a different machine, at which point you have
stepped into a different arena from simply building something that will
compile and run successfully across platforms. (I'd stick it out for native
compilation; YMMV.)

Good luck!
--Jon


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
NodeNinja  
View profile  
 More options Nov 3 2012, 2:09 am
From: NodeNinja <aeon6f...@gmail.com>
Date: Fri, 2 Nov 2012 23:09:39 -0700 (PDT)
Local: Sat, Nov 3 2012 2:09 am
Subject: Re: build a node addon on windows for linux

NodeNinja:

> Note that having a module that will hapilly 'npm install' on all three
> OSes does NOT require pre-building them. The Gyp scripting you saw does
> exactly that: it detects which OS it's building on and follows different
> instructions for each. Testing all three, on the other hand...I second
> mscdex' vote for using a virtual machine to test in a native environment. :)

> Good luck!
> --Jon

Excellent Info Jonathan, the part that modules don't necessarily need to be
pre built with the node-gyp system almost skipped me.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »