Docker images for compiling static Rust binaries using musl-libc and musl-gcc, with static versions of useful C libraries. Supports openssl and diesel crates.
Apache License 2.0
1.54k
stars
193
forks
source link
Build yara static lib with a musl-gcc for rust project #153
it return me error "configure: error: pthread API support is required". Details output
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... no
checking whether pthreads work with -pthreads... no
checking whether pthreads work with -mthreads... no
checking for the pthreads library -lpthread... no
checking whether pthreads work with --thread-safe... no
checking whether pthreads work with -mt... no
checking for pthread-config... no
Dockerfile
FROM ekidd/rust-musl-builder
USER root
ENV JANSSON_VERSION 2.14
ENV YARA_VERSION 4.3.1
RUN apt-get update
RUN cd /tmp \
&& curl -LO https://github.com/akheron/jansson/releases/download/v2.14/jansson-${JANSSON_VERSION}.tar.gz \
&& tar -zxf jansson-${JANSSON_VERSION}.tar.gz \
&& cd /tmp/jansson-$JANSSON_VERSION \
&& CC="musl-gcc" CFLAGS="-fPIC" ./configure --prefix=/usr/local/musl --host=x86_64-linux-musl --disable-shared \
&& make \
&& make check \
&& make install \
&& cd /tmp \
&& rm -r jansson-$JANSSON_VERSION
RUN cd /tmp \
&& curl -LO https://github.com/VirusTotal/yara/archive/refs/tags/v${YARA_VERSION}.tar.gz \
&& tar -zxf v${YARA_VERSION}.tar.gz
WORKDIR /tmp/yara-$YARA_VERSION
RUN apt-get install -y --no-install-recommends libmagic-dev \
automake \
libtool \
autoconf
RUN ./bootstrap.sh \
&& CC="musl-gcc" \
CFLAGS="-I/usr/local/musl/include -I/usr/include/linux -I/usr/include/x86_64-linux-musl" \
LDFLAGS="-L/usr/local/musl/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-musl" \
./configure \
--with-crypto \
--enable-magic \
--enable-cuckoo \
--enable-dotnet \
&& sudo make depend \
&& sudo make -j$(nproc) \
&& sudo make install \
&& rm -r /tmp/yara-$YARA_VERSION
I tried add path pthread header to CFLAGS and add path pthread static lib to LDFLAGS but it did not help
About CFLAGS:
/usr/local/musl/include - path to jansson headers
/usr/include/linux - path to libmagic headers
/usr/include/x86_64-linux-musl - path to pthread header (it did not help 🥲)
About LDFLAGS:
/usr/local/musl/lib - path to jansson static lib
/usr/lib/x86_64-linux-gnu - path to libmagic static lib
/usr/lib/x86_64-linux-musl - path to pthread static lib (it also did not help 😭)
I am trying to build yara static lib with a musl-gcc for my rust project. But when it is running
it return me error "configure: error: pthread API support is required". Details output
Dockerfile
I tried add path pthread header to CFLAGS and add path pthread static lib to LDFLAGS but it did not help
About CFLAGS: /usr/local/musl/include - path to jansson headers /usr/include/linux - path to libmagic headers /usr/include/x86_64-linux-musl - path to pthread header (it did not help 🥲)
About LDFLAGS: /usr/local/musl/lib - path to jansson static lib /usr/lib/x86_64-linux-gnu - path to libmagic static lib /usr/lib/x86_64-linux-musl - path to pthread static lib (it also did not help 😭)
docker build command: docker build . -f ./Dockerfile -t yara-build-image:latest
Maybe who knows how to fix this problem and build yara static lib