How to install cabal packages with extra libraries under Windows? - windows

I'm trying to install monadiccp with the "RuntimeGecode" flag so that it includes the Gecode libraries:
cabal install monadiccp --flags="RuntimeGecode Debug" --extra-lib-dirs="D:\Programme\Gecode\lib;d:\programme\Gecode\bin" --extra-include-dirs=D:\Programme\Gecode\include\
But that doesn't work, it fails with:
ld.exe: cannot find -lgecodesupport
ld.exe: cannot find -lgecodeset
And so on... See the -v3 log output.
What am I doing wrong? The libraries don't seem any special, so are there some extra steps I need to do in Windows?
Update: The binaries downloadable from gecode.org are compiled with Visual Studio and aren't compatible with gcc (see this answer for the root problem). As suggested by Stephen, I'll try to build Gecode with MinGW/MSYS from source now.

Related

Differences between Apple LLVM and LLVM

I have Apple's command line tools version 9.1 installed and am working through an LLVM tutorial. I need to use some libraries like llvm/ADT and llvm/IR but get an error when I run the code.
main.cpp:1:10: fatal error: 'llvm/ADT/APFloat.h' file not found
#include "llvm/ADT/APFloat.h"
^~~~~~~~~~~~~~~~~~~~
1 error generated.
I also don't seem to have tools such as the assembler. Are these things not usable with Apple's version? And can I install LLVM without conflicting with Apple's version?
Apple's fork misses most of the library,headers and command-line tools in the llvm trunk.
I suggest you compile a new llvm copy from trunk.
Conflicting depends on how you configure everything. You can:
Install your new copy to global location, where your $PATH configuration is responsible for choosing which version to use.
Install as a separate Xcode Toolchain.
Here is a build script I've been using:
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DLLVM_APPEND_VC_REV=on -DLLVM_ENABLE_EH=on -DLLVM_ENABLE_RTTI=on -DLLVM_CREATE_XCODE_TOOLCHAIN=on -DCMAKE_INSTALL_PREFIX=~/Library/Developer/ ../LLVM
Running ninja install will install to global location, otherwise run ninja install-xcode-toolchain to install as a separate toolchain
In your case I suggest installing to global location to avoid the trouble of messing with CFLAGS/LDFLAGS/Header Search Path. Then remove the installation manually after you are done with the tutorial
EDIT: You might also want to check out the official build guide https://llvm.org/docs/CMake.html
For your use case, in-tree building is also a feasible option(Providing you are familiar with write cmake configs)
Actually, there is no need to build the LLVM yourself. You can get prebuilt version for your platform here: http://releases.llvm.org
In your case it would be something like this:
cd /opt
wget http://releases.llvm.org/5.0.0/clang+llvm-5.0.0-x86_64-apple-darwin.tar.xz
tar xvf clang+llvm-5.0.0-x86_64-apple-darwin.tar.xz
mv clang+llvm-5.0.0-x86_64-apple-darwin llvm-5.0.0
After that you will have everything under /opt/llvm-5.0.0, e.g.:
/opt/llvm-5.0.0/bin/clang
/opt/llvm-5.0.0/bin/llvm-config
/opt/llvm-5.0.0/lib/libc++.a
etc.
P.S. I use /opt just as an example, feel free to pick any other directory that fits you best.

Installing GTK3 on Haskell Platform 7.10.2a for Windows

Has anyone succeeded in installing gtk2hs on Windows? I am using Haskell Platform 7.10.2a on Windows 10, both 64-bit, and tried running "cabal install gtk3", but it failed on the gio package with error message:
gcc.exe: error: unrecognized option '-pthread'
(Edit extra note: next line of error message below)
compiling dist\build\System\GIO\File\FileAttribute_hsc_make.c failed (exit code 1)
It appears that the gcc in the mingw subfolder in the Haskell Platform package is a little outdated. Is there any way to update this subfolder? The only clue I found on the Internet is the link below, which does not seem to offer any solution:
https://ghc.haskell.org/trac/ghc/ticket/10726
(Edit: version of gcc seems unrelated. '-pthread' switch appears to be invalid for gcc when run under Windows, it's only valid in Linux, see this link, but I have no idea why GHC/GTK3 is using -pthread and no idea how to change this to -mthread http://mingw-users.1079350.n2.nabble.com/pthread-vs-mthreads-td7114500.html)
Before running cabal, I installed GTK+ 3.18.0.1 on Windows using MSYS2.
I have installed gtk2hs on Linux easily with no issues at all.
Update: Also got GTK3 (bundle from below) running a Windows 10 64 bit device.
The additional step I had to accomplish was to include the libintl.def and
libintl.dll.a from an older bundle into the lib folder. I obtained those two files from a GTK2.x bundle, i.e. https://download.gnome.org/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip.mirrorlist, otherwise cabal was complaining about the missing C library intl. To sum up:
1) Obtain a GTK3 x64 bundle from the link http://www.tarnyko.net/dl/gtk.htm.
2) Obtain the missing files libintl.def and libintl.dll.a from an older
bundle, i.e. GTK2 (link from above) and include them in the lib folder.
3) Install glib first, run cabal install glib. Ensure that you have administrator privileges and GTK3/bin is on your PATH variable. Additionally,
you can set LIB and INCLUDE pointing to the GTK/lib and GTK/include folder respectively (might not be necessary).
4) Run cabal install gtk3 finally. You may use the flag --global.
(Tested on Windows 10, 64-Bit, Haskell Platform 8.x)
Installation steps for Windows 7, 64-Bit: (Original Post)
I figured it out how to install GTK3 on Windows7 (64 bit) when running
Haskell Platform 7.10.3. Therefor, I had to accomplish following steps:
Download the gtk3 64-bit bundle from http://www.tarnyko.net/dl/gtk.htm (personally I have used the 3.6 version of it)
Download the gtk3 binding https://hackage.haskell.org/package/gtk3 (0.14.5)
Install the dependencies separately. This encompasses the libraries gio, glib and pango (not cairo in my case). (cabal install package-name)
Adjust the gtk3.cabal file. I have removed following lines (all are within 5 lines):
if os(darwin)
cpp-options: -D__attribute__(A)=
-DWIN32 (just that one flag)
extra-libraries: kernel32
Adjust the gtk.h file (comes with the gtk3 bundle, include\gtk-3.0\gtk) I have defined following macros BEFORE the include operation of #include :
define GDK_VERSION_3_0 (G_ENCODE_VERSION (3, 0))
define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_0
define GDK_VERSION_MAX_ALLOWED GDK_VERSION_3_6
define GDK_DISABLE_DEPRECATION_WARNINGS
Add the path of the MinGW and gtk3 folders bin, include, lib to the PATH variable.
Run cabal install gtk3.cabal
Following tricks also helped me (command line parameters):
--gcc-options="C=LANG"
--with-gcc="path to gcc.exe"
--global
To be honest, this was more luck than knowledge. Took me several hours
to find a workaround. I had the same troubles with the gtk2 bindings for haskell. (Installing gtk2hs failure)

Which unix compatibility toolchain to use with cabal install on windows?

trying to install BlogLiterately on win7/64.
installed HP 2014.2/64
cabal update
cabal install cabal-install
renamed C:\Program Files\Haskell Platform\2014.2.0.0\lib\extralibs\bin\cabal.exe
to *.old
cabal update
cabal install BlogLiterately fails cuz needs unix toolchain to install new version of network
tried installing mingw, but gave up cuz the package manager that pops up only lists packages with suffix 32, i want 64, can't tell from http://www.mingw.org/ if it supports 64 bit.
tried installing cygwin64, added C:\cygwin64\bin to the end of PATH, didn't work, see on internet that people think cygwin doesn't work for ghc so well anymore, even though the original error said cygwin would work
found http://msys2.github.io/, installed it, followed instructions to update with pacman on that page, used Win64 Shell
got error that HsOpenSSL is missing c libs eay32 ssl32, googling says to install http://slproweb.com/products/Win32OpenSSL.html then cabal install HsOpenSSL --extra-include-dirs="c:/OpenSSL-Win64/include" --extra-lib-dirs="c:/OpenSSL-Win64" -- this works, but can't find any official looking docs saying i need Win32OpenSSL -- why can't cabal install this for me?
now cabal install BlogLiterately fails cuz ghc.exe: unable to load package 'hs-bibutils-5.5'
the error:
ghc.exe: warning: _stricmp from msvcrt is linked instead of __imp__stricmp
ghc.exe: warning: _stricmp from msvcrt is linked instead of __imp__stricmp
ghc.exe: warning: _atoi64 from msvcrt is linked instead of __imp__atoi64
ghc.exe: warning: toupper from msvcrt is linked instead of __imp_toupper
ghc.exe: warning: _strnicmp from msvcrt is linked instead of __imp__strnicmp
ghc.exe: C:\Users\nlab\AppData\Roaming\cabal\x86_64-windows-ghc-7.8.3\hs-bibutils-5.5\HShs-bibutils-5.5.o: unknown symbol `strdup'
cabal install hs-bibutils --reinstall --force-reinstalls succeeds, but i get the same error when retrying the BlogLiterately install. i tried moving /c/Program Files/Haskell Platform/2014.2.0.0/mingw/bin to the front of the PATH and again reinstalling hs-bibutils, same result.
what is the right way to do this?!?! which unix toolchain are we supposed to use, and how are we supposed to configure it? why isn't it enough that HP includes mingw's binaries? gah.
For posterity, new versions of the Haskell Platform for windows (since 8.0.1) allow network to build properly if the cabal file is augmented with a few extra settings as described on the platform website: https://www.haskell.org/platform/
Modify your cabal config file (you can verify the location by running "cabal user-config init") to contain the following lines:
extra-prog-path: C:\Program Files\Haskell Platform\8.0.1\msys\usr\bin
extra-lib-dirs: C:\Program Files\Haskell Platform\8.0.1\mingw\lib
extra-include-dirs: C:\Program Files\Haskell Platform\8.

GMP on visual studio c++

I'm new for the c++ programming. I installed OpenSSL for my visual studio. I would like to install GMP for visual studio. How should I do that? There is no file such as gmp.exe. I dont know how to install this. Any help would be appreciated.
It isn't that hard to install GMP on windows.
First, download the GMP tar file. You have to install cygwin on windows with gcc, make and m4.
You can then run linux command using cygwin. Decompress the tar file, then (RECOMMEND to check out the INSTALL file).
Do ./configure, if you need anything special like running c++ gmp code, you have to add flags.
Do./configure --help to check it out.
Then run make, make check, and finally run make install.
You will have to add the path back to your project properties. Enjoy !

XCode: Where is GCC installed?

I've installed XCode v3.1.3 and am having difficulties using the rumored GCC that is installed along with it. -- I'm certainly able to use the XCode IDE to compile my programs but would like the flexibility of also using the command line...
Where's GCC?
Look in /Developer/usr/bin
The most likely explanation is that when you installed the Developer tools you unchecked "UNIX Development Support", so the command line tools were never installed. Delete your /Developer/ directory and do a clean install of the tools; make sure to select "configure" during the installation process and ensure that the appropriate items are checked.
In /usr/bin you should find gcc-4.0 and gcc-4.2 and then there will be a symbolic link gcc which points to one of these (usually gcc-4.2).
As always, you can find out where any available command in your PATH is located using which, e.g.
$ which gcc

Resources