[Bug]: Build system smells
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Active
- Domain
- build-system, tooling
Research direction
Start by auditing configure, INSTALL.Unix.md, and src/couch_quickjs/rebar.config.script, then compare the CFLAGS guidance in the linked GNU Make manual and the related #6107 discussion. The checklist spans dependency detection, cross-compilation, Makefile behavior, compiler output, and rebar migration; done requires deciding scope and validating the build across the supported systems.
Written by the indexing model from the issue text.
Description
Version
3.5.2
Describe the problem you're encountering
Most of these can be considered minor issues, but
-
Several documentation sources mention a
pkg-configdependency. I am under a heavy suspicion that this is a false dependency and thatpkg-configis not used anywhere. If it is used anywhere, it is most certainly used wrong (otherwise cross compilation of couchdb would work). -
https://github.com/apache/couchdb/blob/78395184b02cdc9573c3536ec72721fb353d5442/configure#L337-L343
This is not how you check for dependencies. This doesn't work well with cross compilation and with systems that deal with includes in a "more creative way" like Nix. Since we have it, why don't we use
pkg-config?pkg-config --exists mozjs-${SM_VSN}This of course requires further testing. couchdb seems to support a lot of systems, some of them might not have pkg-config working. More than one dependency detection mechanism might be needed, but
pkg-configshould be the first method tried. -
Do not hardcode
-j<N>in a Makefile You do not know how many cores does the build machine have. It it must be done, at least use-j$(nproc)(which also doesn't belong in a Makefile). -
CFLAGSoverriding is done wrong.As I've mentioned in #6107, this is issue is often seen in hand-written Makefiles. Please see the following chapter of the GNU Make manual on how
CFLAGSoverriding should be done: https://ftp.gnu.org/old-gnu/Manuals/make-3.80/html_node/make_125.html#SEC129 It is a minor issue though. -
rebar doesn't echo the build command when builing C/C++
This leads to cleaner output, but it is worse to debug when the compilation fails. There's a reason why Make echos the build commands.
configure asks for rebar and rebar3. I know little about erlang, but it seems like rebar3 is a successor of rebar. If that's the case, it would make sense to fully transition to rebar3 if possible.
couchdb doesn't have much C code, but I've found errors in a notable portion of its build process. Languate interop can be difficult to get right. I would advise the following:
-
Drop all C code which isn't necessary for couchdb. If the C code can be replaced by erlang, do it.
I'd imagine that since couchdb doesn't have much C code, most of it is there for a purpose. But it's useful to reevaluate it just to be sure.
-
Check whether official erlang documentation, rebar or some third party source of documentation could be used for guidance on erlang to C/C++ interop. If for example rebar or some other erlang build tool provides a high-level facility for interop, consider switching to it.
I assume the C/C++ code is used for interop. If not, disregard this advice.
- Dominant language
- Erlang
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 1d 23m
- Merged PRs (30d)
- 30
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/couchdb
-
Fix: Warning: 'catch ...' is deprecated; please use 'try ... catch ... end' insteadPossibly taken @devx-arjun claimed this 5 days ago. Openbeginner-friendly build chore patches-welcome
Difficulty 4/5 3-5 days Newbie friendliness 45/100
apache/couchdb#6144 · 4 comments ·
Maintainers usually reply within 1 day
-
bug needs-triage
Difficulty 4/5 3-5 days Newbie friendliness 48/100
apache/couchdb#6132 · 3 comments ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 45/100
apache/couchdb#6120 · 4 comments ·
Maintainers usually reply within 1 day
-
enhancement needs-triage
Difficulty 3/5 1-2 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
-
bug needs-triage
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
Similar issues
-
follow-up main-defect wave-A
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
carrick-sh/carrick#249 ·
Maintainers usually reply within 1 day
-
Fix Makefile build graph: add data-file prerequisites and missing .PHONY entries so make -j is safeOpen
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Use GHA setup gradle actionPossibly taken @bric3 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Homebrew/homebrew-core#317477 · 2 comments ·
Maintainers usually reply within 1 day
-
chore ci
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Tollcraft/soroban-cost-linter#891 ·
Maintainers usually reply within 1 day