build: unify static/dynamic linking for conda/package manager compatibility#668
Conversation
04649a1 to
21cffeb
Compare
1. Add pkg-config auto-detection for libhwy, libisal, libdeflate. When installed via package managers (conda, brew, apt), their include/lib paths are automatically picked up without needing to pass INCLUDE_DIRS/LIBRARY_DIRS manually. 2. Unify linking: on Linux, keep -static when all .a archives exist (default). When some .a are missing (conda/apt shared-only), fallback to .a + -l dynamic. macOS unchanged. With this change, bioconda build.sh can simply call: make CXX=$CXX -j$CPU_COUNT make install PREFIX=$PREFIX Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
21cffeb to
39e3295
Compare
Remove bundled igzip_lib.h and libdeflate.h from src/. Use only angle-bracket includes that resolve via pkg-config or -I flags: - <isa-l/igzip_lib.h> (was __has_include fallback to bundled) - <libdeflate.h> (was __has_include fallback to bundled) - <hwy/foreach_target.h> (was quote include) - <hwy/highway.h> (was quote include) Libraries must now be installed system-wide or discoverable via pkg-config / INCLUDE_DIRS before building. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Install isa-l and highway to /usr/local so pkg-config finds them automatically. No more manual INCLUDE_DIRS/LIBRARY_DIRS in make. Also bump isa-l to 2.31.1. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@sfchen Hi, this PR is motivated by the bioconda packaging effort for fastp 1.2.0 (see bioconda/bioconda-recipes#63676 and #63664). ProblemThe current Makefile uses What this PR does
Behavior matrix
With this change, the bioconda recipe simplifies to: c src/readpool.cpp -o obj/readpool.o -std=c++11 -pthread -g -O3 -MD -MP -I. -I./inc -O3 -std=c++14 No vendored sources, no patches, no workarounds. |
apt's libdeflate-dev only provides shared lib. Build from source with -DLIBDEFLATE_BUILD_STATIC_LIB=ON so all three deps (isa-l, libdeflate, highway) are statically linked on Linux. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
-staticvs macOS.afallback) with a single unified approach.astatic archives exist inLIBRARY_DIRS, link statically (unchanged behavior)-ldynamic linking (new)Motivation
The current Linux Makefile uses
-staticwhich requires a static glibc. This breaks builds in package managers like conda/bioconda where only shared system libraries are available (see bioconda/bioconda-recipes#63664).Behavior
.alibs installedmake LIBRARY_DIRS=/path/to/static/libs-staticneeds static glibc)Test plan
LD_FLAGSoverride)🤖 Generated with Claude Code