rakhimov / scram

Probabilistic Risk Analysis Tool (fault tree analysis, event tree analysis, etc.)
https://scram-pra.org
GNU General Public License v3.0
139 stars 56 forks source link

Qt 5 doesn't offically provides gcc-7.1 or higher version on windows #273

Closed metorm closed 6 years ago

metorm commented 6 years ago

Shall I compile QT from source to compile scram?

rakhimov commented 6 years ago

I recommend mingw-w64. Follow the instructions are on README, or take a look how appveyor CI is setup.

On the other hand, are you trying to build with MSVC?

rakhimov commented 6 years ago

Oops, sorry, I see you need gcc-7 -- not MSVC, so mingw-w64 should be the best way to go.

metorm commented 6 years ago

Sorry, but the steps provided in Readme is not enough for me.

If I compile scram using the MinGW-w64 provided with Qt installation directly, cmake would complain about gcc is too old.

I tried used newer MinGW-w64 (7.3.0 version) and link the products to Qt libraries (precompiled by Qt team using gcc 5.3.0), the program fails to start. The error information was like Unable to find an entry point named [xxx unhandled exception xxx] in libscram.dll

Compiling Qt using gcc-7.3.0 is obviously hard work and takes a long time, so I really want to know if this is necessary.

metorm commented 6 years ago

@rakhimov

rakhimov commented 6 years ago

Hmm... I am not sure what ABI pandora box would open mixing the official Qt binaries with mingw-w64.

mingw-w64 already provides gcc-7.3 and qt-5 compiled with it. Take a look at the latest successful CI build on Windows: https://ci.appveyor.com/project/rakhimov/scram/branch/develop

Just a guess. Did you properly specify the generator for CMake?

metorm commented 6 years ago

Well, I downloaded the mingw-w64 package from https://sourceforge.net/projects/mingw-w64/, which doesn't come with a package manager, so I manually set CMake variables using cmake-gui and Qt creator ...

I have read the build log you posted, it seems that the building environment is msys2? I'll try msys2 and post the result here. However, I need XP compatibility, so msys2 may not be the best choice ...

rakhimov commented 6 years ago

However, I need XP compatibility, so msys2 may not be the best choice ...

Doesn't the official SCRAM binary from SourceForge work on XP?

metorm commented 6 years ago

You mean the binaries from https://sourceforge.net/projects/iscram/? Those are 64-bit binaries, while most XP users are using 32-bit XP.

rakhimov commented 6 years ago

I have never tried building 32-bit binaries with mingw-w64 since my minimum expectation has been Windows 7 64 bit.

metorm commented 6 years ago

Well, there is indeed such a demand ...

Anyway, I have just managed to build a 32-bit version of the program, using the MSYS2 32bit platform. There is a trouble in src/Initializer.cc. Since the class includes a giant recursive template function Initializer::DefineExternFunction. Compiling 32-bit debug version produced so huge object file that as.exe throws "too many sections & file too big" error. I have to split the class into 2 files to evade the error.

I have created a PR #274 about this.

rakhimov commented 6 years ago

@metorm I successfully compiled 32bit version for Windows on Appveyor. https://ci.appveyor.com/project/rakhimov/scram/build/%232109/artifacts Please check it out if it works for you. I may start uploading 32 bit versions for release.

metorm commented 6 years ago

I've tried your installer on Windows 10 x64 and Windows XP x86. It turns out that everything with Win10 was OK. On WinXP, on the other hand, the installer works but the program failed to load.

I have studied this problem in recent days. My conclusion is that Qt 5.6+ calls some APIs which doesn't exist on WinXP, so it is necessary to downgrade the entire project to fit Qt 5.5. Actually, I have already done this in my fork. I'll try to maintain my fork as an XP-available version.

Thank you for your efforts anyway!

rakhimov commented 6 years ago

@metorm But, non-GUI part works on XP, right?

metorm commented 6 years ago

Yes, scram.exe is working properly.