CosmoStat / Glimpse

Sparsity based weak lensing mass-mapping tool
Other
6 stars 5 forks source link

Run Travis on OS X #13

Closed giordano closed 3 years ago

giordano commented 5 years ago

This enables testing the program on OS X. Right now the OS X job fails because of #9.

EiffL commented 5 years ago

Thanks for this @giordano , does this depend on your commits to the sparse2d library to buiild successfully?

giordano commented 5 years ago

Exactly, the build on macOS is blocked by errors in Sparse2d fixed by https://github.com/CosmoStat/Sparse2D/pull/21 and https://github.com/CosmoStat/Sparse2D/pull/19. In a test branch including both fixes I managed to successfully build Sparse2D on macOS with both Clang and GCC: https://travis-ci.org/giordano/Sparse2D/builds/505889406.

I don't know if anything else needs to be fixed in Glimpse as currently I'm blocked by Sparse2D.

giordano commented 5 years ago

I managed to locally build Glimpse on GNU/Linux with Clang, using local repositories of nicaea and Sparse2D.

Good news: no change in Glimpse is required. "Bad" news: Clang throws an error when compiling nicaea, I fixed it in https://github.com/CosmoStat/nicaea/pull/8, however I've noted that Glimpse isn't based on master of nicaea but rather on a previous branch which has quite some differences compared to current master and for reasons beyond my understanding Glimpse fails to build if using current nicaea's master branch.

I have a branch of nicaea which is based on https://github.com/CosmoStat/nicaea/commit/f7850e5009d0341226d4c1f38b116f316d8a0516 and includes the fix in https://github.com/CosmoStat/nicaea/pull/8 (and this what I've used for my local build o Glimpse). I don't know what you'd like to do, if you want to update Glimpse to be able to compile with latest master or use a branch based on https://github.com/CosmoStat/nicaea/commit/f7850e5009d0341226d4c1f38b116f316d8a0516.

giordano commented 5 years ago

for reasons beyond my understanding Glimpse fails to build if using current nicaea's master branch.

Well, actually nicaea's master doesn't build on Travis with GCC on GNU/Linux, so at least it's not only me, it's just broken: https://travis-ci.org/CosmoStat/nicaea/builds/470403462 (I get the same error when trying to install the library at the end of the building process)

sfarrens commented 5 years ago

All relevant Sparse2D PRs have been successfully merged.

giordano commented 5 years ago

Note that cmake is still fetching tag v2.1.0 of Sparse2D, so tests are still failin here. Glimpse should either fetch the latest commit or a new version of Sparse2D is released and it can fetch the latest tag.

sfarrens commented 5 years ago

Please update the release tag to v2.1.2 in your PR.

giordano commented 5 years ago

Ok, Clang on macOS is failing as expected because of https://github.com/CosmoStat/nicaea/pull/8 (but it's unclear what to do with it, as Glimpse is using an old commit), but I can't understand what's the problem with GCC on macOS, it seems it can't link Boost?

sfarrens commented 5 years ago

I will have to test this locally, but I won't have time until next week.

giordano commented 5 years ago

I'm able to reproduce the issue on my system. It turned out that the problem is that the boost package installed by default by brew has been compiled with Clang and can be linked only by Clang with objects compiled by, guess what, Clang. The same problem happens with CCfits.

The solution is to do (see, e.g., https://stackoverflow.com/a/29425594/2442087)

brew install boost --cc=gcc-7
brew install brewsci/science/ccfits --cc=gcc-7

I confirm that this fixes the problem on my computer, where in the end I'm able to successfully build Glimpse.

Now I'm struggling with preparing a script that Travis likes.

sfarrens commented 5 years ago

I have run some tests for building Boost with gcc on Travis.

https://github.com/sfarrens/Glimpse/blob/pr-13/.travis.yml

As far as I am aware there is no available bottle for Boost built with gcc on Homebrew. Therefore, I tried building it from source. This, however, gives the following error

No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
The build has been terminated

which I assume it just a timeout due to the excessive building time for Boost. So, while you are free to keep working on this, I would suggest dropping the gcc build and leaving just the clang build, which would provide at least some support for macOS development.

giordano commented 5 years ago

It's easy to workaround the 10 minutes timeout limit without receiving messages, just add a command to print something every ~<10 minutes.

I already tried using homebrew to build Boost with GCC, but it takes way too long, more than the 50 minutes allocated to free projects. I managed to build it with Spack, but still have some problems to convince CMake to find it.

So, while you are free to keep working on this, I would suggest dropping the gcc build and leaving just the clang build, which would provide at least some support for macOS development.

I'll probably do this in the end. While using GCC on macOS uncovered a small issue (#9), it seems to be too cumbersome to maintain a reliable CI for it. Today I'm off from work, I'll be back on this next week.

giordano commented 5 years ago

Ok, I gave up building with GCC on macOS, but I've added support for AppleClang, the default compiler that comes with the system. Both vanilla Clang and AppleClang now are failing because of https://github.com/CosmoStat/nicaea/pull/8, but after fixing that I can successfully build Glimpse on my computer with AppleClang.

EiffL commented 4 years ago

ok so apologies again for having completely missed that PR..... I spent like an entire day wrestling with OSX, through travis builds because I don't have a Mac >.<

The only difference I see with master now, is that you also have vanilla LLVM in addition to Apple's Clang, is that useful for Mac users? Maybe @sfarrens also has thoughts on that