Reputation: 38985
When I tried to add the the python dependencies curl-cffi>=0.5.9
in alpine 3.18, shows error like this:
#12 59.10 gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC
#12 59.10 -Ilibbrotli -Ilibbrotli/include -I/root/visa/.venv/include
#12 59.10 -I/usr/local/include/python3.10 -c build/temp.linux-x86_64-cpython-310/_brotli.c
#12 59.10 -o
#12 59.10 build/temp.linux-x86_64-cpython-310/build/temp.linux-x86_64-cpython-310/_brotli.
#12 59.10 o
#12 59.10 gcc -shared
#12 59.10 build/temp.linux-x86_64-cpython-310/build/temp.linux-x86_64-cpython-310/_brotli.
#12 59.10 o -L/usr/local/lib -Lbuild/temp.linux-x86_64-cpython-310 -llibbrotli -lstdc++
#12 59.10 -llibbrotli -o build/lib.linux-x86_64-cpython-310/brotli/_brotli.abi3.so
#12 59.10 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-mus
#12 59.10 l/bin/ld: cannot find -lstdc++: No such file or directory
#12 59.10 collect2: error: ld returned 1 exit status
#12 59.10 error: command '/usr/bin/gcc' failed with exit code 1
#12 59.10 add curl-cffi failed:
#12 59.10 Traceback (most recent call last):
#12 59.10 File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
#12 59.10 result = self.fn(*self.args, **self.kwargs)
#12 59.10 File
#12 59.10 "/usr/local/lib/python3.10/site-packages/pdm/installers/synchronizers.py", line
#12 59.10 286, in install_candidate
#12 59.10 self.manager.install(can)
#12 59.10 File "/usr/local/lib/python3.10/site-packages/pdm/installers/manager.py", line
#12 59.10 33, in install
#12 59.10 installer(str(prepared.build()), self.environment, prepared.direct_url())
#12 59.10 File "/usr/local/lib/python3.10/site-packages/pdm/models/candidates.py", line
#12 59.10 414, in build
#12 59.10 self.wheel = Path(builder.build(build_dir,
#12 59.10 metadata_directory=self._metadata_dir))
#12 59.10 File "/usr/local/lib/python3.10/site-packages/pdm/builders/wheel.py", line 28,
#12 59.10 in build
#12 59.10 filename = self._hook.build_wheel(out_dir, config_settings,
#12 59.10 metadata_directory)
#12 59.10 File "/usr/local/lib/python3.10/site-packages/pyproject_hooks/_impl.py", line
#12 59.10 209, in build_wheel
#12 59.10 return self._call_hook('build_wheel', {
#12 59.10 File "/usr/local/lib/python3.10/site-packages/pyproject_hooks/_impl.py", line
#12 59.10 311, in _call_hook
#12 59.10 self._subprocess_runner(
#12 59.10 File "/usr/local/lib/python3.10/site-packages/pdm/builders/base.py", line 261,
#12 59.10 in subprocess_runner
#12 59.10 return log_subprocessor(cmd, cwd, extra_environ=env)
#12 59.10 File "/usr/local/lib/python3.10/site-packages/pdm/builders/base.py", line 107,
#12 59.10 in log_subprocessor
#12 59.10 raise build_error(e) from None
#12 59.10 pdm.exceptions.BuildError: Build backend raised error: Showing the last 10 lines
#12 59.10 of the build output:
#12 59.10 | curl_easy_perform
#12 59.10 gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC
#12 59.10 -Icurl_cffi/include -Icurl_cffi/ffi -I/root/visa/.venv/include
#12 59.10 -I/usr/local/include/python3.10 -c curl_cffi/ffi/shim.c -o
#12 59.10 build/temp.linux-x86_64-cpython-310/curl_cffi/ffi/shim.o
#12 59.10 curl_cffi/ffi/shim.c: In function '_curl_easy_setopt':
#12 59.10 curl_cffi/ffi/shim.c:9:16: warning: unused variable 'opt_value'
I have searched from internet and tried to add libstdc++
into alpine, but still could not fixed this problem. This is the docker file look like:
FROM python:3.10-alpine3.18
MAINTAINER jiangxiaoqiang ([email protected])
ENV LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8 \
TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone \
&& mkdir -p /root/visa \
&& apk update \
&& apk add gcc wget curl vim musl-dev libstdc++ curl-dev
RUN pip install pdm
ADD . /root/visa/
WORKDIR /root/visa/
RUN pdm install
ENTRYPOINT exec /root/visa/scripts/startup-app.sh
Am I missing something? what should I do to fixed this issue? This dockerfile works fine with my local macbook pro with M1 chip but could not work on the cloud server. I also tried to add libffi-dev
:
RUN apk add libffi-dev
Upvotes: 0
Views: 846
Reputation: 38985
Finally I found install g++ will fix this issue:
RUN apk add g++
this is the new command:
apk add gcc wget curl vim musl-dev libstdc++ curl-dev libffi-dev g++
Upvotes: 0