Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mingw build #263

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
configure
config.log
config.status
Makefile
Expand All @@ -7,6 +6,8 @@ easel
*.o
*.dSYM
*.stamp
*.exe
!binaries/*.exe
src/*_example
src/*_example?
src/*_utest
Expand Down Expand Up @@ -47,3 +48,4 @@ src/makehmmerdb
src/nhmmer
src/nhmmscan
src/phmmer
mman-win32/
125 changes: 125 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,128 @@
# Port of HMMER to Windows using MinGW

This project is a port of HMMR source code to the [MInGW](https://www.mingw-w64.org) compiler.

With the exception of `hmmpgmd` and `hmmpgmd_shard` the Windows native executables pass all tests.

If prefer not to do your own build the resulting executables are in the [binaries](/binaries) directory.

The source code in this project was created from [hmmr](https://github.com/jones-gareth/hmmer/tree/mingw-build)
and [easel](https://github.com/jones-gareth/easel/tree/mingw-build) forks of the develop branches of HMMR.

## Build Recipe

The following recipie describes how to build native executables for windows using
[MSYS2](https://www.msys2.org/) and [MInGW](https://www.mingw-w64.org/). At the time
of writing the compiler was `gcc version 11.2.0 (Rev1, Built by MSYS2 project)`

**Prerequisites**

Prior to building install MSYS2, For example use [chocolately](https://chocolatey.org/)
(`choco.exe install msys2`), or an
[installer](https://repo.msys2.org/distrib/x86_64/)

In the MSYS2 shell install these packages (picking all groups)

```console
pacman -S base-devel gcc vim cmake
pacman -S mingw-w64-x86_64-toolchain
pacman -S diffutils
```

There is no mman library for windows, but a wrapper is available for MinGW.
Download it from [github](https://github.com/alitrack/mman-win32) and build
in MSYS2 (here installing it to c:\local).

```console
./configure --prefix=c:/local
mingw32-make.exe
mingw32-make.exe install
```

**Download code**

```console
git clone https://github.com/jones-gareth/hmmer
cd hmmer
git clone https://github.com/jones-gareth/easel
```

**Configure HMMR**

If `configure` is not present it will need to be generated on a LINUX system using `autoconf`.

Run configure (here installing to c:\local and looking for mman header files and library in c:\local):

```console
CPPFLAGS="-Ic:/local/include" LDFLAGS=" -static -Lc:/local/lib" CFLAGS="-g -O0" ./configure --prefix=c:/local
```
Check that configure has picked up the mman library.

```console
HMMER configuration:
compiler: gcc -g -O0 -pthread
host: x86_64-w64-mingw32
linker: -static -Lc:/local/lib
libraries: -lmman -lpthread
DP implementation: sse
```

**Make, test and install**

```console
mingw32-make.exe clean
mingw32-make.exe dev # build everything- there should be no warnings
rm -rf src/impl
cp -r src/impl_sse src/impl # No symlinks on windows, so this needs to be copied
mingw32-make.exe check # Run the tests. 2 will fail
mingw32-make.exe install # install if you're happy with test results
```

### Porting notes

The presence of carriage returns (`\r`) in `config.sub` or `config.guess` will cause `autoconf` to fail.
Git operations may result in the insertion of `\r` depending on the `core.autocrlf` setting.

Windows (and MinGW) do not support POSIX signals or sockets. Lack of socket support
mean that the client server daemon
commands `hmmpgmd` and `hmmpgmd_shard` do not function (the executables are compiled, but they
won't work.)

Use of shell commands in C system calls is not properly supported. For example, code like

```C
popen("cat esltmpfile 2>/dev/null");
system("gzip -c eslfile 2>/dev/null > eslfile.gz");
```

Will compile but not generally run (at least not in any portable fashion).
I disabled unit tests that use this type of code.

1. Case 5 in esl_buffer_utest::main
2. esl_buffer_utest::utestOpenPipe
3. The gzip output case in esl_buffer_utest::utestSetOffset
4. esl_buffer_utest::utest_halfnewline (requires signals)

The temporary files created by `esl_tmpfile` will persist on the filesystem in TEMP.
In Windows it is not possible to delete a file that is in use.
jones-gareth marked this conversation as resolved.
Show resolved Hide resolved

### Failed tests

All tests except `hmmpgmd_ga` and `hmmpgmd_shard_ga` should pass.
Since the `hmmpgmd` and `hmmpgmd_shard` commands are broken that is expected.

```console
exercise 297 [ hmmpgmd_ga] ... FAILED [command failed]
exercise 299 [ hmmpgmd_shard_ga] ... FAILED [command failed]

2 of 307 exercises at level <= 2 FAILED.
```

The tests use the perl and python executables installed in the MSYS2 shell.

Test code at a level > 2 has not been ported and may not run correctly (because of windows text mode,
the test scripts frequently need changes even when the commands function correctly).

## HMMER - biological sequence analysis using profile HMMs

[![](https://travis-ci.org/EddyRivasLab/hmmer.svg?branch=develop)](https://travis-ci.org/EddyRivasLab/hmmer)
Expand Down
Binary file added binaries/hmmalign.exe
Binary file not shown.
Binary file added binaries/hmmbuild.exe
Binary file not shown.
Binary file added binaries/hmmconvert.exe
Binary file not shown.
Binary file added binaries/hmmemit.exe
Binary file not shown.
Binary file added binaries/hmmfetch.exe
Binary file not shown.
Binary file added binaries/hmmlogo.exe
Binary file not shown.
Binary file added binaries/hmmpress.exe
Binary file not shown.
Binary file added binaries/hmmscan.exe
Binary file not shown.
Binary file added binaries/hmmsearch.exe
Binary file not shown.
Binary file added binaries/hmmsim.exe
Binary file not shown.
Binary file added binaries/hmmstat.exe
Binary file not shown.