Help compiling NS-3 with MinGW

255 views
Skip to first unread message

Aaron Kelley

unread,
Apr 28, 2011, 6:05:57 PM4/28/11
to ns-3-users
Hi all,

I know MinGW is not officially supported for ns-3, but I've read
reports that it works (at least partially) so I wanted to give it a
shot and see if it works for my purposes before I resort to using a
Linux VM or something to run ns-3.

Unfortunately, I am not able to get it to even start compiling with
MinGW and was wondering if anyone has any insights.

If I run a straight compile (just a plain "waf"), it tries to compile
using Microsoft's MSVC and fails (though it does get pretty far in the
build process).

Here, it is mentioned that you need to configure waf to choose MinGW's
g++:
http://www.nsnam.org/wiki/index.php/User_FAQ#How_to_configure_mingw

When I run the command:
waf configure --check-cxx-compiler=g++

I get this output:

Checking for program CL : C:\Program Files
(x86)\Microsoft Visual Studio 10.0\VC\BIN\x86_amd64\CL.exe
Checking for program CL : C:\Program Files
(x86)\Microsoft Visual Studio 10.0\VC\BIN\CL.exe
Checking for program CL : C:\Program Files
(x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\CL.exe
Checking for program CL : C:\Program Files
(x86)\Microsoft Visual Studio 10.0\VC\BIN\x86_amd64\CL.exe
Checking for program CL : C:\Program Files
(x86)\Microsoft Visual Studio 10.0\VC\BIN\CL.exe
Checking for program CL : C:\Program Files
(x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\CL.exe
Checking for program CL : C:\Program Files
(x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\CL.exe
Checking for program LINK : C:\Program Files
(x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\LINK.exe
Checking for program LIB : C:\Program Files
(x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\LIB.exe
Checking for program MT : C:\Program Files
(x86)\Microsoft SDKs\Windows\v7.0A\bin\x64\MT.exe
Checking for program RC : C:\Program Files
(x86)\Microsoft SDKs\Windows\v7.0A\bin\x64\RC.exe
Checking for msvc : ok
Checking for program g++ or c++ : ['C:\\Program Files (x86)\
\Microsoft Visual Studio 10.0\\VC\\BIN\\amd64\\CL.exe']
wscript:218: error: could not configure a cxx compiler!

I don't get why it looks like it chose CL.exe on the last line there,
when it was looking for g++. Yes, g++ is on the PATH and it works if
I execute it by itself.

For clarification purposes, I am using NS-3 version 3.10.

Any insights appreciated. Thanks!

Chris Dennett

unread,
Apr 29, 2011, 2:48:43 PM4/29/11
to ns-3-...@googlegroups.com
You need to use waf configure --check-cxx-compiler=g++ for configuring. If you have any other problems, I find that renaming the Visual Studio directories works well. It still likes to try and find them, even when they aren't in the path. Ahh, Windows.


--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.


Aaron Kelley

unread,
Apr 30, 2011, 8:03:25 PM4/30/11
to ns-3-users
Thanks for your reply.

I was able to get it to use g++ instead of MSVC by hiding Visual
Studio like you suggested. (Seems more like an issue with waf or the
waf configuration than a Windows problem to me...)

Anyway, it still failed to build with MinGW/g++ so I guess I am off to
using a Linux machine for this.

On Apr 29, 2:48 pm, Chris Dennett <dessima...@gmail.com> wrote:
> You need to use waf configure --check-cxx-compiler=g++ for configuring. If
> you have any other problems, I find that renaming the Visual Studio
> directories works well. It still likes to try and find them, even when they
> aren't in the path. Ahh, Windows.
>

Chris Dennett

unread,
May 1, 2011, 11:50:21 PM5/1/11
to ns-3-...@googlegroups.com
I actually have ns-3 compiling via MinGW successfully on Windows though :) Have done for about 2 years. Granted, it's a bit iffy, but it does work.

юра у

unread,
Jan 8, 2013, 3:47:06 AM1/8/13
to ns-3-...@googlegroups.com
You must clear path to Visual Studio
set path=
set path=c:\mingw\bin
waf configure --check-cxx-compiler=g++ 
.......
'configure' finished successfully (5.845s)

If there is no path to VC, all works fine
Reply all
Reply to author
Forward
0 new messages