opentelemetry-cpp-contrib
opentelemetry-cpp-contrib copied to clipboard
build.gradle fix for Apache 2.4 in otel-webserver-module
Hi
I was working with the webserver-module and compiling it to test it and found a problem.
#0 53.23 > Task :configureApache24 FAILED #0 53.23 checking for chosen layout... Apache #0 53.23 checking for working mkdir -p... yes #0 53.23 checking for grep that handles long lines and -e... /bin/grep #0 53.23 checking for egrep... /bin/grep -E #0 53.23 checking build system type... x86_64-unknown-linux-gnu #0 53.23 checking host system type... x86_64-unknown-linux-gnu #0 53.23 checking target system type... x86_64-unknown-linux-gnu #0 53.23 configure: #0 53.23 configure: Configuring Apache Portable Runtime library... #0 53.23 configure: #0 53.23 configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/. #0 53.33 #0 53.33 FAILURE: Build failed with an exception. #0 53.33 #0 53.33 * What went wrong: #0 53.33 Execution failed for task ':configureApache24'. #0 53.33 > Process 'command './configure'' finished with non-zero exit value 1 #0 53.33 #0 53.33 * Try: #0 53.33 Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. #0 53.33 #0 53.33 * Get more help at https://help.gradle.org #0 53.33 #0 53.33 Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0. #0 53.33 Use '--warning-mode all' to show the individual deprecation warnings. #0 53.33 See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings #0 53.33 #0 53.33 BUILD FAILED in 49s #0 53.33 4 actionable tasks: 4 executed
The current build.gradle file can't compile Apache 2.4 in the webserver container. The APR dependencies are not copied.
I was able to fix it by just including "inputs.dir bundleAprSources" at the beginning of the task configureApache24. Maybe this can be added to the current graddle file.
Thanks @david-perez-martin for raising this. Which version of container has this issue? centos6/ centos7 / ubuntu20.04 ? What was the exact command you gave?
Hi @DebajitDas Is the default profile (centos6). I used the "docker-compose build" command.
I modified the Dockerfile to stop when the Apache24 was compiling, to ssh into the container, and fix the gradle script. After fixing the container I executed again the "docker compose -t webserver ." and "docker build -t webserver ." to finish the process.
Hey @david-perez-martin. Was the gradle running properly without the modification to Dockerfile?
Hi @kpratyus The gradle fails always because the APR lib is not copied before compiling Apache2.4
If you check the gradle file, for Apache2.2 the APR lib is copied just before compiling, I guess that in your test you're using this version instead of Apache2.4, and works for you.
Is that possible?
@david-perez-martin We have added the CI and all the builds are successful for centos6, centos7 and ubuntu20.04 (https://github.com/open-telemetry/opentelemetry-cpp-contrib/actions/runs/2567650521). Ideally, the same APR files is used for configuring, therefore, configureApache24 should work because its previous task configureApache22 has already copied the APR to the right directory. Still wondering how this issue got caught?
Could you please list down the exact steps to reproduce this issue? We would love to try it locally.
I followed the instructions here: https://opentelemetry.io/blog/2022/instrument-apache-httpd-server/#installing-opentelemetry-module-in-target-system
git clone https://github.com/open-telemetry/opentelemetry-cpp-contrib
cd opentelemetry-cpp-contrib/instrumentation/otel-webserver-module
This is the error I get when I run docker-compose --profile centos7 build
:
=> ERROR [29/34] RUN cp -r /dependencies /otel-webserver-module/ && cp -r /build-dependencies /otel-webserver-module/ && cd otel-webserver-module 3.8s
------
> [29/34] RUN cp -r /dependencies /otel-webserver-module/ && cp -r /build-dependencies /otel-webserver-module/ && cd otel-webserver-module && ./gradlew assembleWebServerModule:
: No such file or directory
------
executor failed running [/bin/sh -c cp -r /dependencies /otel-webserver-module/ && cp -r /build-dependencies /otel-webserver-module/ && cd otel-webserver-module && ./gradlew assembleWebServerModule]: exit code: 127
ERROR: Service 'webserver_centos7' failed to build : Build failed
On another note, since these take about an hour to build, can opentelemetry-webserver-sdk-x64-linux.tgz
be uploaded to the GitHub releases to save time building these?
@pnvnd Thanks for raising this concern. Let me look at this and will get back on the build. Yes, we have a plan to make a release this month and package would be available there. Currently, On every merge to main, we are building on centos7 and the package can be downloaded from https://github.com/open-telemetry/opentelemetry-cpp-contrib/actions/runs/2711112662#artifacts
Hope this helps.
Hi @pnvnd, I have tried locally but I am able to build successfully. However, I have submitted a potential issue in dockerfile. Also, our CI builds are successful. However, you can use https://github.com/open-telemetry/opentelemetry-cpp-contrib/actions/workflows/webserver.yml?query=event%3Apush+branch%3Amain to download any recent builds in main.
Hi
For me failed with profile default I guess. I tried again with centos7 profile and worked fine.
BTW: For WSL users is very important to modify .wslconfig file and add this property to allow centos compilation. kernelCommandLine = vsyscall=emulate