How to solve `Building CXX object src/CMakeFiles/qpidcommon.dir/qpid/sys/posix/Condition.cpp.o` while compiling qpid-cpp within Docker Alpine?
Qpid-cpp has been compiled in a Ubuntu docker image and the current size is 1.86GB:
REPOSITORY TAG IMAGE ID CREATED SIZE ubuntu-qpid-cpp latest 7e60a5eabee1 44 hours ago 1.86 GB
To compile qpid-cpp within docker alpine to reduce the disk size of the image
Some packages that are available in Ubuntu are omitted or different in Alpine, e.g.:
RUN apt-get update -y && \ apt-get install -y wget && \ apt-get install -y build-essential python ruby && \ apt-get install -y cmake libblkid-dev e2fslibs-dev libboost-all-dev libaudit-dev
In order to find the substitution packages the Dockerfile was built and when an error occurred the required package that is available in Alpine was added.
RUN apk update && \ apk add wget python ruby cmake build-base boost-dev util-linux-dev
Although most errors were solved, the following issue occurs while compile qpid-cpp within alpine:
[ 17%] Building CXX object src/CMakeFiles/qpidcommon.dir/qpid/sys/posix/Condition.cpp.o In file included from /qpid-cpp/bld/qpid-cpp-1.36.0/src/qpid/sys/posix/Condition.h:31:0, from /qpid-cpp/bld/qpid-cpp-1.36.0/src/qpid/sys/posix/Condition.cpp:22: /usr/include/sys/errno.h:1:2: error: #warning redirecting incorrect #include <sys/errno.h> to <errno.h> [-Werror=cpp] #warning redirecting incorrect #include <sys/errno.h> to <errno.h> ^~~~~~~ cc1plus: all warnings being treated as errors make: *** [src/CMakeFiles/qpidcommon.dir/build.make:2727: src/CMakeFiles/qpidcommon.dir/qpid/sys/posix/Condition.cpp.o] Error 1 make: *** [CMakeFiles/Makefile2:1494: src/CMakeFiles/qpidcommon.dir/all] Error 2 make: *** [Makefile:161: all] Error 2 The command '/bin/sh -c cd qpid-cpp/bld/qpid-cpp-1.36.0 && make all && make install' returned a non-zero code: 2
How to solve the compilation issue
Building CXX object src/CMakeFiles/qpidcommon.dir/qpid/sys/posix/Condition.cpp.o while compiling qpid-cpp within Docker Alpine?
One Solution collect form web for “How to solve `Building CXX object src/CMakeFiles/qpidcommon.dir/qpid/sys/posix/Condition.cpp.o` while compiling qpid-cpp within Docker Alpine?”
I tried this with Ubuntu and Alpine docker images, and I get the same problem on Alpine. It appears that
qpid won’t build on Alpine Linux.
Be aware that the
Ubuntu:16.04 image is 130 MB, 750 MB with dependencies installed. Compared to Alpine’s 5 MB, and 476 MB with dependencies.
So those 1.86 GB are mostly made up of build dependencies and qpid itself. You won’t be able to escape that with any other image. Maybe you could purge some of the build dependencies after building to decrease the final size.