apache / skywalking

APM, Application Performance Monitoring System
https://skywalking.apache.org/
Apache License 2.0
23.86k stars 6.52k forks source link

[Bug] make command stopped at Unable to find libclang in alpine #10439

Closed jameslee007 closed 1 year ago

jameslee007 commented 1 year ago

Search before asking

Apache SkyWalking Component

OAP server (apache/skywalking)

What happened

Hi Team,

I am trying to install the Skywalking php agent in an alpine image php:8.2.0-fpm-alpine. I have the doc and installed the requirements. but when i try to use the make command, i am getting below error.

--- stderr thread 'main' panicked at 'Unable to find libclang: "thelibclangshared library at /usr/lib/libclang.so.15.0.7 could not be opened: Dynamic loading not supported"', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.63.0/./lib.rs:2338:31 note: run withRUST_BACKTRACE=1environment variable to display a backtrace

Please do help me. Below is the out put of my clang package installed.

`78f26a393636:/var/www/html/skywalking-php# apk list -i | grep clang

clang15-libclang-15.0.7-r0 x86_64 {clang15} (Apache-2.0) [installed] clang14-libclang-14.0.6-r1 x86_64 {clang14} (Apache-2.0) clang15-doc-15.0.7-r0 x86_64 {clang15} (Apache-2.0) py3-clang15-15.0.7-r0 x86_64 {clang15} (Apache-2.0) clang15-libs-15.0.7-r0 x86_64 {clang15} (Apache-2.0) [installed] clang15-dev-15.0.7-r0 x86_64 {clang15} (Apache-2.0) [installed] clang15-static-15.0.7-r0 x86_64 {clang15} (Apache-2.0) clang14-libs-14.0.6-r1 x86_64 {clang14} (Apache-2.0) clang15-analyzer-15.0.7-r0 x86_64 {clang15} (Apache-2.0) clang14-dev-14.0.6-r1 x86_64 {clang14} (Apache-2.0) clang15-extra-tools-15.0.7-r0 x86_64 {clang15} (Apache-2.0) [installed] clang15-bash-completion-15.0.7-r0 x86_64 {clang15} (Apache-2.0) clang14-static-14.0.6-r1 x86_64 {clang14} (Apache-2.0) clang15-15.0.7-r0 x86_64 {clang15} (Apache-2.0) [installed] clang14-14.0.6-r1 x86_64 {clang14} (Apache-2.0) 78f26a393636:/var/www/html/skywalking-php# `

What you expected to happen

The php agent is to install in my docker alpine container.

How to reproduce

pecl install skywalking_agent

OR

git clone --recursive https://github.com/apache/skywalking-php.git cd skywalking-php

phpize ./configure make #### HERE I AM GETTING THE ERROR make install

Anything else

I have unistalled the old rust 1.64 and installed new rust 1.67 using curl –proto ‘=https’ –tlsv1.2 -sSf https://sh.rustup.rs | sh command. I upgraded the rust because when i try to install skywalking_phpagent it complains for using the older version of rust.

Just sharing a note on what i tried.

Are you willing to submit PR?

Code of Conduct

wu-sheng commented 1 year ago

@jameslee007 You picked the wrong component. OAP is SkyWalking backend.

jmjoy commented 1 year ago

Maybe enable bindgen static feature can solve the issue, I will submit a new PR to optionally enable it.

jameslee007 commented 1 year ago

@jameslee007 You picked the wrong component. OAP is SkyWalking backend.

oh sorry. Thank you for helping me in this.

jameslee007 commented 1 year ago

Maybe enable bindgen static feature can solve the issue, I will submit a new PR to optionally enable it.

Thank you

jameslee007 commented 1 year ago

@jmjoy Can you please help me towards (any docs or links) what will be correct way to install skywalking PHP agent in alpine based image?

jmjoy commented 1 year ago

https://github.com/KyleMayes/clang-sys#environment-variables

You can use LIBCLANG_STATIC_PATH.

The correct way is to add environment variable RUSTFLAGS="-C target-feature=-crt-static", ref to https://zhuanlan.zhihu.com/p/138109387.

jmjoy commented 1 year ago

I will update the document to mention about alpine.

jameslee007 commented 1 year ago

I will update the document to mention about alpine.

Thank you @jmjoy

jameslee007 commented 1 year ago

https://github.com/KyleMayes/clang-sys#environment-variables

~You can use LIBCLANG_STATIC_PATH.~

The correct way is to add environment variable RUSTFLAGS="-C target-feature=-crt-static", ref to https://zhuanlan.zhihu.com/p/138109387.

This Worked. Thanks a lot.