I’m trying to build ROOT for Windows using MinGW compiler. After some tries, I finally got it compiled.
Everyrhing happened under Windows 7 Ultimate with Visual Studio 2010 installed. That’s how I did this:
-
I installed latest Cygwin (standard installation+make package) and full MinGW stuff(gcc 4.6.2)
-
I downloaded ROOT sources from svn(I used 5.32/03 version)
-
I configured ROOT sources for win32 build from cygwin terminal. To do that, I needed to set up
the correct VS system variables. I simply executed vcvarsall.bat file from windows command line, checked
which system variables it adds/modifies and wrote simple script cygwin_setvcvars.sh to do that from cygwin. Script is called bysource cygwin_setvcvars.sh
from cygwin terminal. After that, I was able to run configure script:
./configure win32 --minimal --build=release
-
The next step is to modify scripts for compiling to make them call gcc instead of cl. I changed the
following files:build/win/cl.sh build/win/ld.sh build/win/makelib.sh
-
I had to add 2 header files to include directory from Windows SDK include directory. These files are
sehmap.h ( to ./include and . ) dbghelp.h ( to ./include )
-
I had to change cint/cint/Module.mk file in order to use gcc implementation of STL instead of
Microsoft’s one. I changed line 123 of that file from
CINTS2 += $(MODDIRSD)/vc10strm.cxx
to
CINTS2 := $(filter-out $(MODDIRSD)/libstrm.%,$(CINTS2))
CINTS2 += $(MODDIRSD)/gcc4strm.cxx
and also copied TAtomicCountGcc.h from ./core/thread/inc to ./include
7. I had to modify sources a bit:
In file cint/cint/src/newlink.cxx, line 81, from
[code]extern[/code]
to
[code]#ifndef G__MINGW_COMPILATION
extern
#endif[/code]
In file G__ci.h, line 379, from
[code]#if defined(G__WIN32) && !defined(__CINT__)[/code]
to
#if defined(G__WIN32) && !defined(__CINT__) && !defined(G__MINGW_COMPILATION)
In file include/TCollectionProxyInfo.h, line 27, from
[code]#if defined(_WIN32)[/code]
to
[code]#if defined(_WIN32) && !defined(G__MINGW_COMPILATION)[/code]
In file w32pragma.h, line 64, from
[code]#define WINVER 0x0400[/code]
to
[code] #define WINVER 0x0501[/code]
In file core/textinput/src/textinput/TerminalDisplayWin.cpp, at line 20, added
[code]#include<stdio.h>[/code]
In file core/textinput/src/textinput/StreamReaderWin.cpp, at line 21, added
[code]#include <ctype.h>[/code]
In file core/base/inc/DllImport.h, line 22, from
[code]# if defined(WIN32)[/code]
to
[code]# if defined(WIN32) && !defined(G__MINGW_COMPILATION)[/code]
In file graf2d/win32gdk/src/TGWin32Gl.cxx, at line 34, added
[code]#ifdef G__MINGW_COMPILATION
#include <GL/glext.h>
#endif[/code]
In file graf2d/win32gdk/src/TGWin32ProxyDefs.h, line 38, from
static enum { kDebugProfile = -123, kDebugTrace = -1234 };
to
#ifndef G__MINGW_COMPILATION
static
#endif
enum { kDebugProfile = -123, kDebugTrace = -1234 };
In file graf2d/win32gdk/gdk/src/gdk/win32/gdkprivate-win32.h, line 433, from
#ifdef __GNUC__
to
#if defined( __GNUC__ ) && ! defined( G__MINGW_COMPILATION )
In file core/winnt/src/TWinNTSystem.cxx, line 3060, from
Printf("Which: %s = %s", infile, name);
to
Printf("Which: %s = %s", (const char*)infile, name);
Also in that file I had to modify inline assembler from MSVC style to gcc style.
-
I had to modify makefiles:
graf2d/freetype/src/win/freetype.mak core/pcre/src/win32/Makefile.msc graf2d/win32gdk/gdk/src/gdk/win32/makefile.msc graf2d/win32gdk/gdk/src/gdk/makefile.msc
and add a script copy_objs.sh to . -
for some reason, while running makefile, some files have incorrect access rights, so I first run make,
stopped it just after it finished copying files and started actual compilation, and then applied
chmod a+r
to files in include/Fit and include/Math
- Finally, I ran
make
from cygwin terminal. It finished successfully, the full log is in file make.log.
- After that, I set ROOTSYS system variable, ran
to see what’s happening during installation and copied printed commands to install.sh script. Then I ranmake -n install
./install.sh
After all actions I’ve just described, I tried to run ROOT, both from cygwin and windows. The ROOT logo window is shown in both cases. If started from command line, then ROOT intro appears:
[code] *******************************************
-
*
-
W E L C O M E to R O O T *
-
*
- Version 5.32/03 9 May 2012 *
-
*
- You are welcome to visit our Web site *
-
http://root.cern.ch *
-
*
ROOT 5.32/03 (Dec 24 2012, 19:26:31@44167, Dec 24 2012, 19:31:06 on win32)
CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.[/code]
But the “[0]” command line doesn’t appear. If I type commands (I tried simply “?”), nothing happens. If I start ROOT from windows, nothing appears after logo window, but the process root.exe is running (according to task manager), and some dlls are loaded(if I try to delete bin directory, messages of type “*.dll cannot be deleted baecuse it’s used by root.exe” appear).
The question is what is wrong with what I did? I don’t know much about how ROOT functions, but during
compilations I saw some utilities called, such as rmkdepend, rootcint_tmp and so on. Maybe they are functioning incorrectly because compilation is done with gcc? I’d be very thankful for every advice. Thanks a lot.
P.S. 7-zip archive with all the files I changed/added and compilation log is attached.
v5-32-03-cygwin-changes.zip (206 KB)