apache / apache/couchdb

[Bug]: Hardcoded include paths

Open
#6,110 0 comments 0 reactions 0 assignees View on GitHub
bug needs-triage
Dominant language
Erlang
Stars
7k
Forks
1.1k
Avg merge
1d 16h
Merged PRs (30d)
9

Description

### Version

3.5.2

### Describe the problem you're encountering

Hardcoded include paths are used in several places in couchdb. couchdb is at least considerate enough to check both `/usr/include`, `/usr/local/include` and even `/opt/homebrew/include/` in the code I reviewed, but this is still insufficient when cross compiling or when building in strange environments like Nix.

The `/opt/homebrew/include/` include paths is especially telling. Adding a include path to the hardcoded list of library paths every time a supported target of couchdb needs it is bad.

For example [this file](https://github.com/apache/couchdb/blob/main/src/couch/rebar.config.script#L155) includes plenty of hardcoded library paths.

### Expected Behaviour

`pkg-config` should be used to get the appropriate paths. If pkg-config works well on all target environments supported by couchdb, it can fully replace the hardcoded lists, improving the readability and portability of the build system.

Even if pkg-config cannot be used on all supported couchdb systems, the advantages it provides justify it being added as one of the lookup methods (preferably the first) in my opinion. The lookup can fall back to hardcoded paths on systems where pkg-config isn't available.

Contributor guide

Open the contributing guide

Research direction

Start in src/couch/rebar.config.script around line 155, where hardcoded library paths are listed. Trace the other include-path locations and check how the build behaves during cross-compilation or in Nix-like environments. Done means pkg-config is used as the preferred lookup where supported, with fallback behavior for systems without it.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.