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

Unable to compile on Alpine linux #28

Closed
b-i-t-n opened this issue Jul 5, 2017 · 5 comments
Closed

Unable to compile on Alpine linux #28

b-i-t-n opened this issue Jul 5, 2017 · 5 comments

Comments

@b-i-t-n
Copy link

b-i-t-n commented Jul 5, 2017

I am building XMRig in a Alpine Docker container.
I have had a quick look around on how to fix this but I am not a c++ dev.

It could be because Alpine linux does not use glibc so in most cases it is treated like linux but should be treated like osx or freebsd.

[ 77%] Building CXX object CMakeFiles/xmrig.dir/src/Cpu_unix.cpp.o
In file included from /usr/include/pthread.h:30:0,
                 from /xmrig/src/Cpu_unix.cpp:25:
/xmrig/src/Cpu_unix.cpp: In static member function 'static void Cpu::setAffinity(int, uint64_t)':
/xmrig/src/Cpu_unix.cpp:46:5: error: 'memset' was not declared in this scope
     CPU_ZERO(&set);
     ^
make[2]: *** [CMakeFiles/xmrig.dir/build.make:591: CMakeFiles/xmrig.dir/src/Cpu_unix.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:69: CMakeFiles/xmrig.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
@xmrig
Copy link
Owner

xmrig commented Jul 5, 2017

Can you provide some instructions how setup developer environment, install compiler, cmake, libuv on Alpine Linux. It can speed up process because I was never work with that Linux.
Thank you.

@b-i-t-n
Copy link
Author

b-i-t-n commented Jul 5, 2017

What I have done to install xmrig on Alpine linux manually

# apk add openssl-dev curl-dev git cmake libuv-dev build-base
# git clone https://github.com/xmrig/xmrig
# cd xmrig
# mkdir build
# cmake -DCMAKE_BUILD_TYPE=Release .
# make

To use the Dockerfile copy or download the following and run docker build --rm . in the same folder.
https://raw.githubusercontent.com/b-i-t-n/alpine-xmrig/master/Dockerfile

FROM  alpine:latest
RUN   adduser -S -D -H -h /xmrig miner
RUN   apk --no-cache upgrade && \
      apk --no-cache add \
        openssl-dev \
        curl-dev \
        git \
        cmake \
        libuv-dev \
        build-base && \
      git clone https://github.com/xmrig/xmrig && \
      cd xmrig && \
      mkdir build && \
      cmake -DCMAKE_BUILD_TYPE=Release . && \
      make && \
      apk del \
        build-base \
        cmake \
        git
USER miner
WORKDIR    /xmrig
ENTRYPOINT ["./xmrig"]

@b-i-t-n
Copy link
Author

b-i-t-n commented Jul 5, 2017

I probably do not need some of the packages as you do not support TLS or HTTP.

@xmrig
Copy link
Owner

xmrig commented Jul 5, 2017

Yes openssl-dev and curl-dev not required. Okay I will check it later.
Thank you.

xmrig added a commit that referenced this issue Jul 7, 2017
@xmrig
Copy link
Owner

xmrig commented Jul 7, 2017

I fixed it, just one include was missing.

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

2 participants