Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the requirement to include the package libmodsecurity3 is insufficient. Missing files #11

Open
pszabop opened this issue Aug 28, 2024 · 3 comments

Comments

@pszabop
Copy link

pszabop commented Aug 28, 2024

Error message from Cargo

  --- stderr
  libmodsecurity cannot be found on the system: 
  pkg-config exited with status code 1
  > PKG_CONFIG_PATH= PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 pkg-config --libs --cflags modsecurity modsecurity >= 3.0.6

  The system library `modsecurity` required by crate `modsecurity-sys` was not found.
  The file `modsecurity.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
  PKG_CONFIG_PATH contains the following:
      - 

  HINT: you may need to install a package such as modsecurity, modsecurity-dev or modsecurity-devel.

  Vendoring is not supported at this time.

Dockerfile:

FROM rust:latest

RUN apt-get update && apt-get install -y \
    cmake zlib1g-dev lld

RUN apt-get update && apt-get install -y \
    libmodsecurity3 modsecurity-crs clang

Cargo.toml:

[package]
name = "test-modsec"
version = "1.0.0"
authors = ["redacted <redacted@example.com>"]
edition = "2021"

[profile.release]
incremental = true


[profile.dev]
incremental = true

[dependencies]
async-trait="0.1"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
bytes = "1"
modsecurity = { git = "https://github.com/rkrishn7/rust-modsecurity", version = "0.1.4"  }

output of dkpkg -L from the docker container:

root@052754b216a5:/app# dpkg -L libmodsecurity3
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/libexec
/usr/lib/x86_64-linux-gnu/libexec/modsec-rules-check
/usr/lib/x86_64-linux-gnu/libmodsecurity.so.3.0.9
/usr/share
/usr/share/doc
/usr/share/doc/libmodsecurity3
/usr/share/doc/libmodsecurity3/changelog.Debian.gz
/usr/share/doc/libmodsecurity3/changelog.gz
/usr/share/doc/libmodsecurity3/copyright
/usr/lib/x86_64-linux-gnu/libmodsecurity.so.3

@pszabop
Copy link
Author

pszabop commented Aug 28, 2024

the missing package appears to be libmodsecurity-dev

this line in Dockerfile appears to fix the problem

RUN apt-get update && apt-get install -y \
    libmodsecurity3 modsecurity-crs clang libmodsecurity-dev

You want a merge request for your README.md?

@rkrishn7
Copy link
Owner

Hey @pszabop, thanks for raising this!

For context, modsecurity-sys relies on pkg-config to probe the system for libmodsecurity and emit necessary linking flags. pkg-config retrieves information about packages from special metadata files (.pc files) which it is configured to search for on some default set of paths. If the associated .pc file is located somewhere else, this needs to be conveyed to pkg-config by setting the PKG_CONFIG_PATH environment variable.

We probably don't want to include any comment about needing a specific package like libmodsecurity-dev, since that differs across systems and some users may even be building from source. However, it could be useful to point out a condensed version of the above information regarding pkg-config in the README.

@pszabop
Copy link
Author

pszabop commented Aug 29, 2024

You could say:

libmodsecurity-dev satisfies the need for the .pc package file

on top of what you say above. That will help those not building from source.

The text you have above is basically what the error messages prints out. It took quite a bit of googling to figure out that the -dev package satisfies this requirement

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

No branches or pull requests

2 participants