Skip to content

Fix build without crypto support - #2390

Merged
jan-cerny merged 1 commit into
OpenSCAP:mainfrom
Eljees:agent/build-crapi-without-crypto
Jul 28, 2026
Merged

Fix build without crypto support#2390
jan-cerny merged 1 commit into
OpenSCAP:mainfrom
Eljees:agent/build-crapi-without-crypto

Conversation

@Eljees

@Eljees Eljees commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

  • always build and link the CRAPI object on platforms with mmap support
  • compile only the no-op crapi.c implementation when no digest backend is available
  • keep the full CRAPI source set when Gcrypt or NSS is enabled

This lets non-crypto builds provide crapi_init without compiling digest code that requires a crypto backend.

Fixes #2310.

Testing

Reproduced the failure on the unmodified commit: building the oscap target without Gcrypt fails to link with undefined reference to 'crapi_init'.

The patched tree builds successfully with:

cmake -DCMAKE_DISABLE_FIND_PACKAGE_GCrypt=TRUE \
  -DENABLE_OSCAP_UTIL_DOCKER=OFF \
  -DENABLE_TESTS=OFF ..
cmake --build . -j2

This builds libopenscap, libopenscap_sce, and the oscap CLI.

@sonarqubecloud

Copy link
Copy Markdown

@jan-cerny jan-cerny self-assigned this Jul 28, 2026

@jan-cerny jan-cerny left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

builds successfully using the provided command

@jan-cerny jan-cerny added this to the 1.4.5 milestone Jul 28, 2026
@jan-cerny
jan-cerny merged commit f004271 into OpenSCAP:main Jul 28, 2026
19 checks passed
@Eljees

Eljees commented Jul 28, 2026 via email

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

undefined reference to `crapi_init' when building without crypto

2 participants