# Compiling with RTools40

**URL:** <https://swi-prolog.discourse.group/t/compiling-with-rtools40/3962>\
**Category:** General\
**Created:** [May 16, 2021, 9:30am UTC](https://swi-prolog.discourse.group/t/compiling-with-rtools40/3962 "2021-05-16T09:30:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [May 16, 2021, 9:30am UTC](https://swi-prolog.discourse.group/t/compiling-with-rtools40/3962/1 "2021-05-16T09:30:27Z")

</div>

RTools40 is a minimalistic msys2 mingw compiler for building R and R packages under Windows. I tried to compile current swipl with RTools, like this:

- Download and install RTools, see here [RTools: Toolchains for building R and R packages from source on Windows](https://cran.r-project.org/bin/windows/Rtools/)
- The pacman repository of RTools does not seem to have git included, so I unpacked the current swipl-devel into some RTools folder using “git clone etc.” from a normal msys2 installation from [msys2.org](http://msys2.org).
- same for git submodule update --init
- back again in RTools
- `pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-gmp`
- `cd swipl-devel`
- `mkdir build`
- `cd build`
- `cmake -DMINGW_ROOT=/mingw64 -DWIN32DLLS="" -DCMAKE_INSTALL_PREFIX:PATH=/usr/local -DSWIPL_PACKAGES=OFF -G "MSYS Makefiles" ..`
- I guess some of the packages can be made to work if supported by RTools.
- `make`
- `make install`
- `swipl`
- `consult('c:/rtools40/usr/local/demo/likes.pl').`
- `likes(sam, X).`
- `X` then unifies with all kind of computer programmer’s food.

Best wishes,

Matthias

---

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [May 18, 2021, 1:27pm UTC](https://swi-prolog.discourse.group/t/compiling-with-rtools40/3962/2 "2021-05-18T13:27:03Z")

</div>

A formidable number of 37 issues is found after `check_installation.` 🙂

But this was a SWIPL\_PACKAGES=OFF-installation.

(update: 36, GMP works)

```
$ swipl
Welcome to SWI-Prolog (64 bits, version 8.3.24)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

check_installation.
% Checking your SWI-Prolog kit for common issues ...
%
% Version: ............. 8.3.24
% Address bits: ........ 64
% Architecture: ........ x64-win64
% Installed at: ........ c:/rtools40/usr/local
% Cores: ............... 4
%
% Checking tcmalloc ............................ not present
Warning: See http://www.swi-prolog.org/build/issues/tcmalloc.html
% Checking gmp ................................. not present
Warning: See http://www.swi-prolog.org/build/issues/gmp.html
Warning: library(archive) ...................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/archive.html
Warning: library(cgi) .......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/cgi.html
Warning: library(crypt) ........................ NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/crypt.html
Warning: library(bdb) .......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/bdb.html
Warning: library(double_metaphone) ............. NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/double_metaphone.html
Warning: library(filesex) ...................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/filesex.html
Warning: library(http/http_stream) ............. NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/http/http_stream.html
Warning: library(http/json) .................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/http/json.html
Warning: library(http/jquery) .................. NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/http/jquery.html
Warning: library(isub) ......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/isub.html
Warning: library(jpl) .......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/jpl.html
Warning: library(memfile) ...................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/memfile.html
Warning: library(odbc) ......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/odbc.html
Warning: library(pce) .......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/xpce.html
Warning: library(pcre) ......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/pcre.html
Warning: library(pdt_console) .................. NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/pdt_console.html
Warning: library(porter_stem) .................. NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/porter_stem.html
Warning: library(process) ...................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/process.html
Warning: library(protobufs) .................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/protobufs.html
% Loading library(readutil) .................... ok
Warning: library(semweb/rdf_db) ................ NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/semweb/rdf_db.html
Warning: library(semweb/rdf_ntriples) .......... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/semweb/rdf_ntriples.html
Warning: library(semweb/turtle) ................ NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/semweb/turtle.html
Warning: library(sgml) ......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/sgml.html
Warning: library(sha) .......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/sha.html
Warning: library(snowball) ..................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/snowball.html
Warning: library(socket) ....................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/socket.html
Warning: library(ssl) .......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/ssl.html
Warning: library(crypto) ....................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/crypto.html
Warning: library(table) ........................ NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/table.html
Warning: library(time) ......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/time.html
Warning: library(unicode) ...................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/unicode.html
Warning: library(uri) .......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/uri.html
Warning: library(uuid) ......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/uuid.html
Warning: library(zlib) ......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/zlib.html
Warning: library(yaml) ......................... NOT FOUND
Warning: See http://www.swi-prolog.org/build/issues/yaml.html
Warning: Found 37 issues.
true.
```

---

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [February 2, 2022, 11:07pm UTC](https://swi-prolog.discourse.group/t/compiling-with-rtools40/3962/3 "2022-02-02T23:07:53Z")

</div>

Same for 32-bit version:

- `pacman -S mingw-w64-i686-cmake mingw-w64-i686-gmp`
- `cd swipl-devel`
- `mkdir build`
- `cd build`
- `cmake -DMINGW_ROOT=/mingw32 -DWIN32DLLS="" -DCMAKE_INSTALL_PREFIX:PATH=/usr/local -DSWIPL_PACKAGES=OFF -G "MSYS Makefiles" ..`
- `make`
- `src/swipl`
- ?- `check_installation.`
