Compiling root with mingw32

Hallo,

An issue with compiling: I developed an application using root classes under Linux, where is no problem. Now I want to port the application to windows. There, I got the following problem:
First, I downloaded the binaries of root from the download page. Then I tried to compile the whole application with mingw32-g++ / mingw32-make associated with the root libraries. Well, the linker told me the references can not be found. I noticed I have to compile root again. But there are only two options to do that (cygwin+mingw and vc++). I build root on the windows machine with help of root-builder and then vc++. For every library, a .dll, a .exp and a .lib file is generated. But I still can not use these libraries, because mingw32-g++ told me " libXXX.dll: file not recognized: File truncated" when linking. This is because probably that I tried to link objects compiled with different compilers. When I tried the linking with cygwin version, I can’t compile the program outside cygwin any more. This program used also gsl libraries. According to GSL people, they compiled gsl binaries with mingw32, and the libraries should be compilable by any complier. It was indeed compilable by either mingw32 and vc++. The effort to compile root with mingw32 was not successful, it failed even with configure step. Now can someone help me? Is there a binary version, whose library I can use with mingw32? Or how can I compile the root with native mingw32 (not cygwin version)?
Thanks a lot!

Simon Lu

Hi,

we don’t support wingw32, please use MSVC. Even the $0 Express version works.

Cheers, Axel.

Dear Axel,

To cite a statement from the ROOT web-site:

Note that the performance of cygwin/gcc binaries is currently very poor; we only provide this build as an unsupported toy.

Thus, wouldn’t it make more sense to replace the cygwin version of ROOT altogether with a MinGW version?

The “R” developers have also abandoned cygwin long time ago due to stability problems and compile R with MinGW. To make sure that R can be stably compiled they have even created their own subset of MinGW, called Rtools, see:
murdoch-sutherland.com/Rtools/
Since R needs not only C/C++ to compile but also Fortran, the Rtools should contain everything which is needed to compile ROOT for MinGW.

Compiling ROOT using the Rtools would not only have the advantage that Windows users would finally get a stable and fast alternative to ROOT compiled with VC++, but would also solve the severe problem that I have due to incompatibilities between R and ROOT on Vista/Windows 7.

Thus it would be great if ROOT binaries could be made available which were compiled with Rtools.

Best regards
Christian

[quote=“cstrato”]Dear Axel,

To cite a statement from the ROOT web-site:

Note that the performance of cygwin/gcc binaries is currently very poor; we only provide this build as an unsupported toy.

Thus, wouldn’t it make more sense to replace the cygwin version of ROOT altogether with a MinGW version?

The “R” developers have also abandoned cygwin long time ago due to stability problems and compile R with MinGW. To make sure that R can be stably compiled they have even created their own subset of MinGW, called Rtools, see:
murdoch-sutherland.com/Rtools/
Since R needs not only C/C++ to compile but also Fortran, the Rtools should contain everything which is needed to compile ROOT for MinGW.

Compiling ROOT using the Rtools would not only have the advantage that Windows users would finally get a stable and fast alternative to ROOT compiled with VC++, but would also solve the severe problem that I have due to incompatibilities between R and ROOT on Vista/Windows 7.

Thus it would be great if ROOT binaries could be made available which were compiled with Rtools.

Best regards
Christian[/quote]

Two quick comments:

  1. g++ has been greatly improved in Cygwin in the last couple years and the new release of cygwin (1.7.x) performs much more stably than the older 1.5.x series.

  2. Since most physicists work with a posix environment, the cygwin/g++ build has many advantages over VC++ (or even mingW).

So I’m not arguing for not adding a MingW build to Root, but I think the cygwin/g++ build needs more support, not less.

Cheers,
Charles

Dear Charles,

Maybe a comment to your second point:
Although most R users (and R developers) work with a posix environment, too (!!!) the R developers have created their own Rtools based on MinGW for certain reasons. Please note that (just like ROOT) R supports many platforms, e.g. Linux (debian, redhat, suse, ubuntu), MacOS X, Sun Solaris, see:
cran.r-project.org/
Thus I do not see any reason to use cygwin on Windows instead of Rtools.

Best regards
Christian

Hi Christian,

[quote=“cstrato”]Maybe a comment to your second point:
Although most R users (and R developers) work with a posix environment, too (!!!) the R developers have created their own Rtools based on MinGW for certain reasons. Please note that (just like ROOT) R supports many platforms, e.g. Linux (debian, redhat, suse, ubuntu), MacOS X, Sun Solaris, see:
cran.r-project.org/
Thus I do not see any reason to use cygwin on Windows instead of Rtools.
[/quote]

If we’re not careful, this will become quite off-topic, but…

Not having soft-links (to name but one) is a serious limitation and clearly not a posix environment. And since we’re talking about Root, it doesn’t really make much sense to talk about Rtools here (since it is for building R).

Again, I’m not suggesting that one shouldn’t have a mingW Root build (although the root team only has so much (wo)man power, so I do understand their point of view). But using out-of-date information to try and trash Cygwin doesn’t seem, to me at least, to be helpful for your cause.

Cheers,
Charles

Dear Charles,

My point is that it DOES make sense to talk about Rtools, since in my opinion it can be used to compile ROOT, too.

For your information I am attaching “Rtools.txt” from Rtools210.exe which I have installed, but which is not the newest version. It shows that Rtools has packages from both Cygwin and MinGW. Thus it does contain e.g. ls.exe and ln.exe.

To make it clear, I do not say ROOT should be compiled with MinGW but that it should be compiled with Rtools, since:
1, you get the best of both worlds, Cygwin and MinGW
2, it is a proven and stable environment for Windows.

Best regards
Christian
Rtools.txt (3.4 KB)

Hi Christian,

[quote=“cstrato”]My point is that it DOES make sense to talk about Rtools, since in my opinion it can be used to compile ROOT, too.

For your information I am attaching “Rtools.txt” from Rtools210.exe which I have installed, but which is not the newest version. It shows that Rtools has packages from both Cygwin and MinGW. Thus it does contain e.g. ls.exe and ln.exe.
[/quote]

A few points here (mostly for others):

  1. Cygwin executables will only work if you include cygwin1.dll. If you compile with cygwin’s gcc compiler, you need cygwin1.dll to run the program.

  2. If you use ln.exe to create softlinks, only programs that link against cygwin1.dll will understand them.

  3. You are free to include any cygwin software you want, but you (basically) can’t include the compiled code without the source code.

  4. Including only fragments of cygwin probably isn’t the best idea as it leaves you in a particuarly fragmented state and can leave you in a situation where it is hard to get help (see cygwin.com/acronyms/#3PP)

Having both cygwin and mingw pieces makes me (personally) less happy, not more happy.

Now I’m a little confused what you mean by “compiled with Rtools” since I believe you’re still talking about compiling with g++ in any case. In any case, how is this hybrid environment better than just say a proper cygwin environment?

I’m not saying that Rtools doesn’t have it’s uses, but it doesn’t seem like direction I would think that the Root team would like to go (of course, the only affiliation to the Root team that I have is that I’ve been bothering them for several years, so my opinion isn’t worth very much here).

Cheers,
Charles

Dear Charles,

When you read “Rtools.txt” (which I had attached) you will see that (i) you can have a full Cygwin installation, and (ii) the gcc compilers and binutils are taken from MinGW. Rtools was created for people who do not want to install a complete Linux-like environment for Windows only to be able to compile R or R-packages.

While ROOT is completely written in C++, including its own help and GUI (which I consider a huge advantage), and thus could be ported to Windows using VC++, the compilation of R is much more complex, since it consists not only of C code but also of fortran code, LaTex for help files, tcl/tk as rudimentary GUI, and also needs Perl. Thus porting R to Windows was a huge problem and for this reason the R developers were to my knowledge not able to use VC to build the C part of R.

As far as I know at that time Cygwin was not stable enough, so the R developers decided to create a “minimalist” compilation environment on Windows based on MinGW and Cygwin. Over the years it turned out that this “hybrid environment” saved them a lot of troubles and thus seems to be indeed “better than just say a proper cygwin environment”.

I assume that normal ROOT users (just like the R users) on Windows do not want to install a complete Linux-like environment on their machines only to be able to compile ROOT or their own ROOT code.

Best regards
Christian

Hi,

let’s see whether I can re-ignite this discussion and open it up even more: are you aware of rootbuilder.codeplex.com/ which uses its own mostly-MingW build environment plus MSVC as the compiler? :slight_smile:

Cheers, Axel.

Dear Axel,

Yes, someone has mentioned rootbuilder in an older topic, where I wanted to compile ROOT with option /MT. However, it does only use MinGW’s make tools and sh to build ROOT for MSVC. It does not use any MinGW compiler. Thus it is the opposite of Rtools, which use Cygwin sh but the MinGW compilers

Best regards
Christian