Hacker News new | ask | show | jobs
by superbatfish 3120 days ago
The conda package manager and it's subproject conda-build are fantastic tools to solve this problem. I write scientific software (primarily a mix of C++ and Python), and I use conda for literally every dependency I need, including pure C or C++ dependencies. Most of them are already available via the conda-forge project, and the ones that aren't are easily integrated by writing my own recipes to package with conda-build.
2 comments

I write in a mix of python and C++ as well. As such, I've also gradually moved towards using conda. What's your dev workflow for the code that's not a dependency like? Specially if the code you're developing is C++. Do you make a conda package of it as you're developing? I've found that too much of a hassle to rebuild. I usually just use CMake with the conda environment dir as the CMAKE_INSTALL_PREFIX.
Yeah, that's what I do also. conda-build makes it easier to use your code downstream, but doesn't obviate the need for build scripts in general.

However, if you're using conda, you might be able to at least simplify your build scripts, even though you can't eliminate them.

If you are okay with requiring your users to have conda, then you can exploit that fact to simplify your CMakeLists.txt in some ways. For instance, find_library, etc.. can be replaced with hard-coded links to ${CONDA_PREFIX}/lib/...

(I'm not saying that's necessarily "best practice" for all projects, but it's a nice option to consider, especially in the early phases of development.)

Ah, that's an interesting shortcut.
I've found generally it's fine for most things but issues come from when the scientific libraries are built with/without certain options. The lack of OpenMP for FFTW is annoying, for example.
Yes, that's of course a potential issue with any distribution. The good news is that's relatively easy to tweak their recipe to build your own version.

  $ conda install conda-build # prerequisite...

  $ https://github.com/conda-forge/fftw-feedstock && cd fftw-feedstock
  $ emacs recipe/build.sh # Add --enable-openmp

  $ conda build recipe
  $ anaconda upload -u mychannel ${CONDA_PREFIX}/conda-bld/*-64/fftw-*.tar.bz2
Now you can install your custom-built version of fftw and easily share it with your friends by telling them the name of your channel on anaconda.org.