mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 17:26:28 +00:00
Get bcc project building again.
Signed-off-by: Krister Johansen <krister.johansen@oracle.com>
This commit is contained in:
parent
50904b9f9d
commit
194fef33cf
@ -1,4 +1,4 @@
|
|||||||
FROM alpine:3.5
|
FROM alpine:3.7
|
||||||
RUN apk update && apk upgrade -a && \
|
RUN apk update && apk upgrade -a && \
|
||||||
apk add --no-cache \
|
apk add --no-cache \
|
||||||
argp-standalone \
|
argp-standalone \
|
||||||
@ -8,6 +8,7 @@ RUN apk update && apk upgrade -a && \
|
|||||||
build-base \
|
build-base \
|
||||||
clang \
|
clang \
|
||||||
clang-dev \
|
clang-dev \
|
||||||
|
clang-static \
|
||||||
cmake \
|
cmake \
|
||||||
curl \
|
curl \
|
||||||
flex-dev \
|
flex-dev \
|
||||||
@ -25,6 +26,11 @@ RUN apk update && apk upgrade -a && \
|
|||||||
python \
|
python \
|
||||||
zlib-dev \
|
zlib-dev \
|
||||||
&& true
|
&& true
|
||||||
|
|
||||||
|
RUN ln -s /usr/lib/cmake/llvm5/ /usr/lib/cmake/llvm; \
|
||||||
|
ln -s /usr/include/llvm5/llvm-c/ /usr/include/llvm-c; \
|
||||||
|
ln -s /usr/include/llvm5/llvm/ /usr/include/llvm
|
||||||
|
|
||||||
WORKDIR /build
|
WORKDIR /build
|
||||||
COPY . ./
|
COPY . ./
|
||||||
COPY Dockerfile /
|
COPY Dockerfile /
|
||||||
@ -37,8 +43,8 @@ RUN cat elfutils-$ELFUTILS_VERSION.tar.bz2 | tar xjf - && \
|
|||||||
patch -p1 < ../100-musl-compat.patch && \
|
patch -p1 < ../100-musl-compat.patch && \
|
||||||
patch -p0 < ../decl.patch && \
|
patch -p0 < ../decl.patch && \
|
||||||
patch -p0 < ../intl.patch
|
patch -p0 < ../intl.patch
|
||||||
ENV BCC_COMMIT=d4fc95d92ec9bace9bd607dfd1833e9e06457486
|
ENV BCC_COMMIT=6972806729da00ecda0235abac61d66c8fad7fad
|
||||||
RUN git clone https://github.com/iovisor/bcc.git && cd bcc && git checkout $BCC_COMMIT
|
RUN git clone https://github.com/iovisor/bcc.git && cd bcc && git checkout $BCC_COMMIT
|
||||||
RUN cd bcc && patch -p0 < ../bcc-gnuism.patch
|
RUN cd bcc && patch -p0 < ../bcc-gnuism.patch && patch -p0 < ../bcc-lua.patch
|
||||||
ENV LJSYSCALL_COMMIT=0b266e8f4f751ae894299d24a2d40d16c6cf856f
|
ENV LJSYSCALL_COMMIT=e587f8c55aad3955dddab3a4fa6c1968037b5c6e
|
||||||
RUN git clone https://github.com/justincormack/ljsyscall.git && cd ljsyscall && git checkout $LJSYSCALL_COMMIT
|
RUN git clone https://github.com/justincormack/ljsyscall.git && cd ljsyscall && git checkout $LJSYSCALL_COMMIT
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
.PHONY: tag push
|
.PHONY: tag push
|
||||||
|
|
||||||
BASE=alpine:3.5
|
BASE=alpine:3.7
|
||||||
IMAGE=alpine-build-ebpf
|
IMAGE=alpine-build-ebpf
|
||||||
|
|
||||||
default: push
|
default: push
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
--- src/cc/usdt.h-orig
|
--- src/cc/usdt.h-orig
|
||||||
+++ src/cc/usdt.h
|
+++ src/cc/usdt.h
|
||||||
@@ -86,6 +86,24 @@
|
@@ -125,6 +125,24 @@ public:
|
||||||
ArgumentParser(const char *arg) : arg_(arg), cur_pos_(0) {}
|
ArgumentParser_powerpc64(const char *arg) : ArgumentParser(arg) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
+#undef REG_A
|
+#undef REG_A
|
||||||
+#undef REG_B
|
+#undef REG_B
|
||||||
+#undef REG_C
|
+#undef REG_C
|
||||||
@ -23,5 +23,6 @@
|
|||||||
+#undef REG_RIP
|
+#undef REG_RIP
|
||||||
+
|
+
|
||||||
class ArgumentParser_x64 : public ArgumentParser {
|
class ArgumentParser_x64 : public ArgumentParser {
|
||||||
|
private:
|
||||||
enum Register {
|
enum Register {
|
||||||
REG_A,
|
|
||||||
|
43
projects/ebpf/ebpf.build/bcc-lua.patch
Normal file
43
projects/ebpf/ebpf.build/bcc-lua.patch
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
--- src/cc/CMakeLists.txt
|
||||||
|
+++ src/cc/CMakeLists.txt
|
||||||
|
@@ -52,7 +52,7 @@ target_link_libraries(bcc-loader-static elf)
|
||||||
|
add_library(bcc-static STATIC
|
||||||
|
${bcc_common_sources} ${bcc_table_sources} ${bcc_util_sources})
|
||||||
|
set_target_properties(bcc-static PROPERTIES OUTPUT_NAME bcc)
|
||||||
|
-set(bcc-lua-static
|
||||||
|
+add_library(bcc-lua-static STATIC
|
||||||
|
${bcc_common_sources} ${bcc_table_sources} ${bcc_sym_sources} ${bcc_util_sources})
|
||||||
|
|
||||||
|
include(clang_libs)
|
||||||
|
@@ -64,9 +64,9 @@ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${llvm_lib_exclude_f
|
||||||
|
set(bcc_common_libs_for_a b_frontend clang_frontend bpf-static
|
||||||
|
-Wl,--whole-archive ${clang_libs} ${llvm_libs} -Wl,--no-whole-archive
|
||||||
|
${LIBELF_LIBRARIES})
|
||||||
|
-set(bcc_common_libs_for_s ${bcc_common_libs_for_a})
|
||||||
|
-set(bcc_common_libs_for_lua b_frontend clang_frontend bpf-static
|
||||||
|
+set(bcc_common_libs_for_s b_frontend clang_frontend bpf-static
|
||||||
|
${clang_libs} ${llvm_libs} ${LIBELF_LIBRARIES})
|
||||||
|
+set(bcc_common_libs_for_lua ${bcc_common_libs_for_s})
|
||||||
|
|
||||||
|
if(ENABLE_CPP_API)
|
||||||
|
add_subdirectory(api)
|
||||||
|
@@ -87,7 +87,7 @@ add_subdirectory(frontends)
|
||||||
|
# Link against LLVM libraries
|
||||||
|
target_link_libraries(bcc-shared ${bcc_common_libs_for_s})
|
||||||
|
target_link_libraries(bcc-static ${bcc_common_libs_for_a} bcc-loader-static)
|
||||||
|
-set(bcc-lua-static ${bcc-lua-static} ${bcc_common_libs_for_lua})
|
||||||
|
+target_link_libraries(bcc-lua-static ${bcc_common_libs_for_lua})
|
||||||
|
|
||||||
|
install(TARGETS bcc-shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
|
install(FILES ${bcc_table_headers} DESTINATION include/bcc)
|
||||||
|
--- src/lua/CMakeLists.txt
|
||||||
|
+++ src/lua/CMakeLists.txt
|
||||||
|
@@ -23,7 +23,7 @@ if (LUAJIT_LIBRARIES AND LUAJIT)
|
||||||
|
add_executable(bcc-lua src/main.c bcc.o)
|
||||||
|
set_target_properties(bcc-lua PROPERTIES LINKER_LANGUAGE C)
|
||||||
|
target_link_libraries(bcc-lua ${LUAJIT_LIBRARIES})
|
||||||
|
- target_link_libraries(bcc-lua ${bcc-lua-static})
|
||||||
|
+ target_link_libraries(bcc-lua -Wl,--whole-archive bcc-lua-static -Wl,--no-whole-archive)
|
||||||
|
if (NOT COMPILER_NOPIE_FLAG EQUAL "")
|
||||||
|
target_link_libraries(bcc-lua ${COMPILER_NOPIE_FLAG})
|
||||||
|
endif()
|
@ -1,17 +1,54 @@
|
|||||||
# Tag: cc5bf4d39442741eaeffad79bbd9ae049a9253fa
|
#FROM mobylinux/alpine-build-ebpf@sha256:da37d99a8baad18e68c44d3807c86977767ed90ce03133b508842eea3b786d3a
|
||||||
FROM mobylinux/alpine-build-ebpf@sha256:da37d99a8baad18e68c44d3807c86977767ed90ce03133b508842eea3b786d3a
|
ARG IMAGE
|
||||||
|
FROM ${IMAGE} as ksrc
|
||||||
|
FROM alpine-build-ebpf:build as build
|
||||||
|
|
||||||
ADD kernel-headers.tar /
|
COPY --from=ksrc /kernel-headers.tar /build
|
||||||
ADD kernel-dev.tar /
|
RUN tar xf /build/kernel-headers.tar
|
||||||
ADD kernel-modules.tar /
|
|
||||||
|
COPY --from=ksrc /kernel-dev.tar /build
|
||||||
|
RUN tar xf /build/kernel-dev.tar
|
||||||
|
|
||||||
|
COPY --from=ksrc /kernel.tar /build
|
||||||
|
RUN tar xf /build/kernel.tar
|
||||||
|
|
||||||
|
RUN cd /build
|
||||||
RUN cd elfutils-$ELFUTILS_VERSION && \
|
RUN cd elfutils-$ELFUTILS_VERSION && \
|
||||||
|
aclocal && \
|
||||||
automake && \
|
automake && \
|
||||||
./configure --prefix=/usr CFLAGS=-Wno-strict-aliasing && \
|
./configure --prefix=/usr CFLAGS=-Wno-strict-aliasing && \
|
||||||
make -C libelf && make -C libelf install
|
make -C libelf && make -C libelf install
|
||||||
RUN mkdir -p bcc/build && cd bcc/build && \
|
RUN mkdir -p bcc/build && cd bcc/build && \
|
||||||
cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DLUAJIT_INCLUDE_DIR=/usr/include/luajit-2.1 && \
|
cmake .. -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_C_FLAGS="-I/build/usr/include" -DCMAKE_CXX_FLAGS="-I/build/usr/include" -DCMAKE_INSTALL_PREFIX=/usr -DLUAJIT_INCLUDE_DIR=/usr/include/luajit-2.1 && \
|
||||||
make && \
|
make && \
|
||||||
make install
|
make install
|
||||||
RUN mkdir -p /usr/local/share/lua/5.1/ && cd ljsyscall && cp -a *.lua syscall /usr/local/share/lua/5.1/
|
RUN mkdir -p /usr/local/share/lua/5.1/ && cd ljsyscall && cp -a *.lua syscall /usr/local/share/lua/5.1/
|
||||||
|
|
||||||
ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib64
|
ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib64
|
||||||
|
|
||||||
|
FROM alpine:3.7 as mirror
|
||||||
|
RUN mkdir -p /out/etc/apk && cp -r /etc/apk/* /out/etc/apk/
|
||||||
|
RUN apk update && apk upgrade -a && \
|
||||||
|
apk add --no-cache --initdb -p /out \
|
||||||
|
busybox \
|
||||||
|
luajit \
|
||||||
|
python \
|
||||||
|
strace \
|
||||||
|
zlib \
|
||||||
|
&& true
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
ENTRYPOINT []
|
||||||
|
CMD []
|
||||||
|
WORKDIR /
|
||||||
|
COPY --from=mirror /out /
|
||||||
|
COPY --from=build /build/usr/src /usr/src/
|
||||||
|
COPY --from=build /build/usr/include /usr/include/
|
||||||
|
COPY --from=build /usr/lib/libelf* /usr/lib/
|
||||||
|
COPY --from=build /usr/lib/libstdc* /usr/lib/
|
||||||
|
COPY --from=build /usr/lib/libintl* /usr/lib/
|
||||||
|
COPY --from=build /usr/lib64 /usr/lib/
|
||||||
|
COPY --from=build /usr/lib/python2.7/site-packages /usr/lib/python2.7/site-packages/
|
||||||
|
COPY --from=build /usr/share/bcc /usr/share/bcc/
|
||||||
|
COPY --from=build /usr/bin/bcc-lua /usr/bin/
|
||||||
|
COPY --from=build /usr/local/share/lua /usr/local/share/lua/
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
KERNEL_FILES=-C ../alpine/kernel/x86_64 kernel-headers.tar kernel-dev.tar kernel-modules.tar
|
KERNEL_IMAGE=iad.ocir.io/odx-fn/linuxkit/kernel:4.14.48-ee964ca1fb8641370812be8ef4592b2708d3551b-amd64
|
||||||
|
|
||||||
default: ebpf.tag
|
default: ebpf.tag
|
||||||
|
|
||||||
ebpf.tag: Dockerfile
|
ebpf.tag: Dockerfile
|
||||||
BUILD=$$( tar cf - $^ $(KERNEL_FILES) | docker build -q - ) && [ -n "$$BUILD" ] && echo "Built $$BUILD" && \
|
BUILD=$$( docker build -q --build-arg IMAGE=$(KERNEL_IMAGE) . ) && [ -n "$$BUILD" ] && echo "Built $$BUILD" && \
|
||||||
echo $$BUILD > $@
|
echo $$BUILD > $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
Loading…
Reference in New Issue
Block a user