waveygang / wfmash

base-accurate DNA sequence alignments using WFA and mashmap2
MIT License
172 stars 15 forks source link

Problem installing wfmash with conda on mac #232

Open rsharris opened 3 months ago

rsharris commented 3 months ago

This is similar in nature to issue #147 .

I try to install via bioconda, like this:

$ conda create -n wfmash.env
$ conda activate wfmash.env
$ conda install -c bioconda wfmash

but it fails, with

PackagesNotFoundError: The following packages are not available from current channels:
  - wfmash
Current channels:
  - https://conda.anaconda.org/bioconda/osx-64
  - https://conda.anaconda.org/bioconda/noarch
  - https://repo.anaconda.com/pkgs/main/osx-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/osx-64
  - https://repo.anaconda.com/pkgs/r/noarch

I've been able to install other packages in the past, e.g. winnowmap.

I'm doing this on a mac and my conda is anconda. Is one of those two facts causing the problem? I note that a search for wfmash at anaconda.org does give one hit. That hit only lists "linux-64" under platforms. (This in contrast to a hit for winnowmap that lists "linux-64" and "osx-64"). I presume this means this bioconda recipe doesn't support mac OS.

Am I correct? If so, it might be helpful to indicate that in the Bioconda section of this repo's front page.

bkille commented 3 months ago

I can't speak as to why, but looking at the conda recipe, it is as you suspected: the OSX build of wfmash is "skipped".

Side note: If you're ever curious about bioconda builds, you can look at the recipes in the bioconda recipe repository. A convenient way to get to the recipe file is to go to the Bioconda webpage for the package (wfmash here), then go to the meta.yaml link.

rsharris commented 3 months ago

Thanks, @bkille , especially for the side note.

Looks like conda doesn't have libgcc-ng or libstdcxx-ng for mac, which are dependencies. So that would be the primary reason.

Those appear to be gcc runtime stuff. Presumably a mac build would use clang and whatever runtime is appropriate for that.

Anyway, thanks for verifying the conda shortcoming, so I can stop banging my head into that particular wall. I can now revisit banging the other side of my head into trying to build from source ;) .

ekg commented 3 months ago

@rsharris in principle a clang build should work. There shouldn't be any compiler intrinsics or strange stuff but the build config might be annoying. It would also be interesting to compare clang and gcc performance.

rsharris commented 3 months ago

Thanks, @ekg , I'll continue to try the install. I think I need to make sure my cmake suite is up-to-date first. And install pkg-config which I don't currently have on the machine I'm trying this on.

By the way, my main motivation is to see whether wfmash would be a suitable replacement for lastz.

rsharris commented 3 months ago

@ekg @bkille I've managed to build wfmash on macOS using clang. I haven't tried running any alignments yet, but at least it shows me the usage list.

I had to make a couple mods to source files. I'm posting those here so that others trying to build for macOS won't have to rediscover them.

First, I am using cmake -H. -Bbuild -D CMAKE_BUILD_TYPE=Generic && cmake --build build -- -j 3 as was suggested in the "notes for distribution".

(1) src/common/wflign/deps/atomic_image.cpp uses d-suffixes on float constants — e.g. 0.5d. Clang rejected this. I'm not familiar with that syntax and as best I can tell it is a gnu extension, not part of standard C (I could be wrong). There were four instances, and I replaced them with, e.g. ((double) 0.5).

(2) src/interface/parse_args.hpp makes a call to get_current_dir_name(). Clang, or whatever includes are being used, didn't know about this. I found some description online that said this was specific to gcc and/or linux. A description at gnu.org indicates it is essentially equivalent to getcwd(NULL,0), so I changed it to that.

(3) I encountered this failure: ld: library not found for -lrt. From what I found online, librt doesn't exist for macOS (and isn't needed), and might also be archaic on many *nix systems. There are two Makefiles in the hierarchy that mention -lrt, but those both look to be mac-safe since they wrap it an are-we-on-linux text. But it also appears in the list at lines 62..72 of CMakeLists.txt. I deleted it from that list.

So, after something like 15 build attempts (not an exaggeration) I think I've got it built, and will proceed to look for some some tests to verify that it has built correctly.