Re: [gecode] Building DLL on windows

38 views
Skip to first unread message

Mikael Zayenz Lagerkvist

unread,
Jul 14, 2022, 3:48:42 PM7/14/22
to gec...@googlegroups.com
Hi,

Unfortunately, I have no experience compiling Gecode on Windows so I'm
unable to help you. Just checking, have you read the instructions in
section 2.6 in MPG [1] on compilation?

Any other users with tips on running Gecode on Windows?

Cheers,
Mikael

[1] https://www.gecode.org/doc-latest/MPG.pdf

On Thu, Jul 14, 2022 at 1:00 PM Craig Walker <craig.j...@gmail.com> wrote:
>
> Hi
>
> Sorry for the very basic questions, but is there a trick to compiling on the dlls on windows for 6.2.0
>
> I have tried various configure settings but no luck
>
> I was able to compile using MSYS2 MinGW but only the '.a' files
>
> any help would be much appreciated
>
> Thanks in advance
> Craig
>
> Ps i can add the configure settings I have tried and the errors I have encountered if that's any help
>
> --
> You received this message because you are subscribed to the Google Groups "Gecode" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to gecode+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/gecode/868ef4a5-74bb-4fe2-8e2b-f258b7a8ff6fn%40googlegroups.com.



--
Mikael Zayenz Lagerkvist

Craig Walker

unread,
Jul 15, 2022, 3:42:01 AM7/15/22
to Gecode
Hi

Sorry, i removed this original to this post, as i got it compiling after much trial and error.

My end goal is to compile it in 32bit (see my earlier post from May) long story :-)

I had read the instructions, but i think it was more my lack of skill in c++ and setting up a build environment that held me back

--------------------------------

my latest error on my quest for 32 bit is below though if anyone  has any ideas it would be greatly appreciated

$ make
make[1]: Entering directory '/cygdrive/d/gecodeSource/gecode-release-6.2.0'
make[1]: 'gecode/kernel/var-type.hpp' is up to date.
make[1]: 'gecode/kernel/var-imp.hpp' is up to date.
cl -arch:SSE2 -MD -GS- -wd4355 -O2 -EHsc -nologo -bigobj -DNDEBUG -LD gecode/support/exception.obj gecode/support/allocator.obj gecode/support/heap.obj gecode/support/thread/thread.obj gecode/support/thread/windows.obj gecode/support/thread/pthreads.obj gecode/support/hw-rnd.obj  \
        -FeGecodeSupport-6-2-0-r-x86.dll -link -DEBUG -OPT:REF -OPT:ICF -MANIFEST -INCREMENTAL:NO
msvcprt.lib(MSVCP140.dll) : fatal error LNK1112: module machine type 'x86' conflicts with target machine type 'x64'
make[1]: *** [Makefile:1585: GecodeSupport-6-2-0-r-x86.dll] Error 2
make[1]: Leaving directory '/cygdrive/d/gecodeSource/gecode-release-6.2.0'
make: *** [Makefile:1264: compilelib] Error 2

i am using cygwin64

and in the startup bat i have added
call "c:\program files (x86)\microsoft visual studio\2017\enterprise\vc\auxiliary\build\vcvarsall.bat" x86

Thanks for any input
Craig

Filip Konvička

unread,
Jul 15, 2022, 10:51:21 AM7/15/22
to gec...@googlegroups.com
Hi,

I haven't tried this with MSYS2 for a long time.  I custom-build Gecode to exclude the Qt dependency and to use the same toolchain as the main app.
It looks like you're using the VC compiler (cl.exe), so perhaps what I do would work for you as well.

- I use Cygwin (to build, get the current version of cygwin, make sure to include bash, diff, patch, make, perl, perhaps also svn, git; re-run the installer to add more as you stumble on missing tools).
- Run Visual Studio command line as Administrator ("Run As Administrator") - x86 Native Tools in your case
- In this command prompt (adjust for your version of VS)
  - cd C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
  - vcvarsall.bat x86
(vcvarsall also accepts the SDK version if you need to target a particular version of the SDK for your app)
  - run cygwin (perhaps c:\cygwin\cygwin) from the same command prompt
  - in cygwin CD to your gecode root (e.g. cd /cygdrive/c/BUILD/gecode-6.2.0)
  - export "CXXFLAGS=/FS /std:c++20 /permissive"
  - chmod a+rwx *
  - ./configure --disable-examples --disable-qt --disable-gist --disable-gmp --disable-mpfr --prefix=`pwd`/x86rel
  - make -j8 install
  - chmod a+rwx -R x*

You may adjust the CXXFLAGS to the ISO C++ standard of your choice (c++17 or c++14 would probably work fine).  "/permissive" is needed when targeting Windows SDK 8.1 (and maybe other SDKs too, I haven't tried). "/FS" is needed so that multi-core compilation does not fail.  The "chmod"s are needed so that you can access the built files from outside Cygwin.

Of course you may opt to not "--disable" components that you wish to use.  Using gmp, mpfr, and Qt (needed for Gist) brings additional dependencies and license implications.

Hopefully this helps :)

Cheers,
Filip

pá 15. 7. 2022 v 9:42 odesílatel Craig Walker <craig.j...@gmail.com> napsal:

Filip Konvička

unread,
Jul 15, 2022, 11:46:07 AM7/15/22
to gec...@googlegroups.com
P.S. - 6.3.0 builds successfully for x86 on my machine with

export "CXXFLAGS=/FS"
./configure --disable-flatzinc --disable-examples --disable-qt --disable-gist --disable-gmp --disable-mpfr --prefix=`pwd`/x86rel
make

The FlatZinc part does not compile for some reason...
flatzinc.cpp
C:\BUILD\gecode-release-6.3.0\gecode/flatzinc/branch.hpp(38): error C2668: 'Gecode::VarBranch<Gecode::IntVar>::VarBranch': ambiguous call to overloaded function
C:\BUILD\gecode-release-6.3.0\gecode/kernel/branch/var.hpp(111): note: could be 'Gecode::VarBranch<Gecode::IntVar>::VarBranch(Gecode::VarBranch<Gecode::IntVar> &&)'
C:\BUILD\gecode-release-6.3.0\gecode/kernel/branch/var.hpp(111): note: or       'Gecode::VarBranch<Gecode::IntVar>::VarBranch(const Gecode::VarBranch<Gecode::IntVar> &)'
C:\BUILD\gecode-release-6.3.0\gecode/kernel/branch/var.hpp(80): note: or       'Gecode::VarBranch<Gecode::IntVar>::VarBranch(Gecode::Rnd)'
C:\BUILD\gecode-release-6.3.0\gecode/kernel/branch/var.hpp(78): note: or       'Gecode::VarBranch<Gecode::IntVar>::VarBranch(Gecode::BranchTbl)'
C:\BUILD\gecode-release-6.3.0\gecode/flatzinc/branch.hpp(38): note: while trying to match the argument list '(double)'

But in case you don't need that, you're fine.  In case you need it, we can try to fix this issue (should not be hard).

Cheers,
Filip


pá 15. 7. 2022 v 16:51 odesílatel Filip Konvička <filip.k...@gmail.com> napsal:

Filip Konvička

unread,
Jul 15, 2022, 11:56:23 AM7/15/22
to gec...@googlegroups.com
Craig,

And a final note, if you encountered the following:
LNK1112: module machine type 'x86' conflicts with target machine type 'x64'
...then your configuration might be correct, but you did not run "make clean" after re-configuring, so the "make" you're running is picking up the already-generated .objs for x64 from previous attempts, which the x86 linker does not accept.

Cheers,
Filip


pá 15. 7. 2022 v 17:45 odesílatel Filip Konvička <filip.k...@gmail.com> napsal:

Craig Walker

unread,
Jul 15, 2022, 4:47:39 PM7/15/22
to Gecode
Hi Filip

Massive thanks, I finally got it working, you was right on the clean build too.

In the end I got Cygwin working and compiled 32 bit for 6.2.0.

I have given it some light testing in our app and get the same results as 5.0 and all our unit tests still pass, so all good so far

for me it did not compile Gist by default, not sure if that's expected but I don't need it anyway. if I get adventurous I will try compile it with a few of the other components switched off to see what its not using.

Thanks again
Craig 

Reply all
Reply to author
Forward
0 new messages