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

Build failed if nginx build with pcre from sources #63

Open
timansky opened this issue Sep 5, 2024 · 8 comments
Open

Build failed if nginx build with pcre from sources #63

timansky opened this issue Sep 5, 2024 · 8 comments

Comments

@timansky
Copy link

timansky commented Sep 5, 2024

Describe the bug

I'm trying to build module from source with nginx with pcre2 from sources.
Build is failing because it is trying to find pcre2.h inside nginx directory

[100%] Generating opentelemetry/proto/common/v1/common.pb.cc, opentelemetry/proto/resource/v1/resource.pb.cc, opentelemetry/proto/trace/v1/trace.pb.cc, opentelemetry/proto/collector/trace/v1/trace_service.pb.cc, opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.cc
[100%] Building CXX object CMakeFiles/ngx_otel_module.dir/src/http_module.cpp.o
In file included from /workdir/deb-nginx/.build/nginx/objs/../src/core/ngx_core.h:74,
                 from /workdir/deb-nginx/.build/modules/otel/otel/src/http_module.cpp:3:
/workdir/deb-nginx/.build/nginx/objs/../src/core/ngx_regex.h:19:10: fatal error: pcre2.h: No such file or directory
   19 | #include <pcre2.h>
      |          ^~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/ngx_otel_module.dir/build.make:98: CMakeFiles/ngx_otel_module.dir/src/http_module.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:971: CMakeFiles/ngx_otel_module.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

To reproduce

Steps to reproduce the behavior:

  1. Configure nginx with option --with-pcre=${PATH_TO_PCRE2_SRC}
  2. make module
  3. See error
@timansky
Copy link
Author

timansky commented Sep 5, 2024

Also this happens with all custom libs (zlib ssl ...)

@timansky
Copy link
Author

timansky commented Sep 6, 2024

SSL fixes with adding variable -DOPENSSL_ROOT_DIR=${SSL_SRC_PATH}

@p-pautov
Copy link
Contributor

p-pautov commented Sep 6, 2024

Something like this -DCMAKE_CXX_FLAGS=-I${PATH_TO_PCRE2_SRC}/src could fix PCRE error.

Could you elaborate a bit on why do you need custom libs?

@timansky
Copy link
Author

timansky commented Sep 6, 2024

zlib is fixed by specifying -DZLIB_ROOT=${ZLIB_SRC_PATH}

@timansky
Copy link
Author

timansky commented Sep 6, 2024

-DCMAKE_CXX_FLAGS=-I${PATH_TO_PCRE2_SRC}/src

Already tried with no success.
Also tried:

-DCMAKE_PREFIX_PATH=${PCRE2_SRC}/src
-DPCRE2_ROOT=${PCRE2_SRC}/src
-DPCRE2_LIBRARY=${PCRE2_SRC}/src
-DCMAKE_INCLUDE_PATH=${PCRE2_SRC}/src

@willthames
Copy link

I have this in my build file for pcre2:

sed -i '/target_include/a \ \ \ \ /usr/local/openresty/pcre2/include' CMakeLists.txt

@timansky
Copy link
Author

manually fixing CMakeLists.txt helped

@p-pautov
Copy link
Contributor

Apparently, both -DCMAKE_C_FLAGS=-I${PATH_TO_PCRE2}/src and -DCMAKE_CXX_FLAGS=-I${PATH_TO_PCRE2}/src are required to build without CMakeLists.txt modification.

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

3 participants