Skip to content

Commit

Permalink
Fix dockerfile compilation error (TuGraph-family#795)
Browse files Browse the repository at this point in the history
* fix dockerfile

* remove openblas

* revert
  • Loading branch information
ljcui authored Nov 30, 2024
1 parent cd03adf commit ceb0ec2
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 59 deletions.
24 changes: 3 additions & 21 deletions ci/images/tugraph-compile-centos7-Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -340,34 +340,16 @@ RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/tabulate-3
&& tar zxf tabulate-3a5830.tar.gz && cp -rf tabulate/include/tabulate /usr/local/include \
&& rm -rf /tabulate*

RUN sed -i '3 s/-lgomp/-l:libgomp.a/' /usr/local/lib64/libgomp.spec

# install epel
RUN yum install -y epel-release && yum makecache

# install openblas
RUN yum install -y openblas-devel

# install swig
RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/swig-4.0.2.tar.gz \
&& tar -xzvf swig-4.0.2.tar.gz && cd swig-4.0.2 && ./configure \
&& make && make install && cd .. \
&& rm -rf swig-4.0.2 swig-4.0.2.tar.gz

# install faiss
RUN wget -O /tmp/openblas-faiss.tar.gz https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/openblas-faiss.tar.gz \
&& tar -xzvf /tmp/openblas-faiss.tar.gz -C /tmp && cd /tmp/openblas-faiss/OpenBLAS && make ${JFLAG} && make install \
&& cd /tmp/openblas-faiss/faiss && cmake -B build -DCMAKE_BUILD_TYPE=Release -DFAISS_ENABLE_GPU=OFF -DFAISS_OPT_LEVEL=avx2 -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_INSTALL_LIBDIR=lib -DOpenMP_CXX_FLAGS="-fopenmp" -DOpenMP_CXX_LIB_NAMES="gomp" -DOpenMP_gomp_LIBRARY="/usr/lib64/libgomp.so.1" -DBLAS_LIBRARIES=/opt/OpenBLAS/lib/libopenblas.so . && make -C build ${JFLAG} && make -C build install \
&& rm -rf /tmp/openblas-faiss /tmp/openblas-faiss.tar.gz && ldconfig

# install vsag
RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/vsag-0.11.5.tar.gz -O /tmp/vsag.tar.gz && \
cd /tmp && mkdir vsag && tar -xzf vsag.tar.gz --strip-components=1 -C vsag && cd vsag && \
yum install -y libgfortran5.x86_64 && ln -s /usr/lib64/libgfortran.so.5.0.0 /usr/local/lib/libgfortran.so && ldconfig && \
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_INTEL_MKL=OFF -DDISABLE_AVX2_FORCE=ON -DDISABLE_AVX512_FORCE=ON .. && \
make -j10 && make install && \
make ${JFLAG} && make install && \
cd / && rm -rf /tmp/vsag*

RUN sed -i '3 s/-lgomp/-l:libgomp.a/' /usr/local/lib64/libgomp.spec

ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk \
LD_LIBRARY_PATH=/usr/local/lib64/lgraph:/usr/local/lib64:/usr/local/lib:/usr/lib/jvm/java-11-openjdk/lib/server:$LD_LIBRARY_PATH \
PYTHONPATH=/usr/local/lib64/lgraph:/usr/local/lib64:$PYTHONPATH \
Expand Down
43 changes: 22 additions & 21 deletions ci/images/tugraph-compile-centos8-Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ FROM reg.docker.alibaba-inc.com/fma/centos:8.4.2105
ARG JFLAG=-j8
ARG PYPI="-i https://pypi.antfin-inc.com/simple/ --trusted-host pypi.antfin-inc.com"

RUN rm -rf /etc/yum.repos.d \
&& curl -O https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/yum.repos.d.tar.gz \
&& tar -xf yum.repos.d.tar.gz && mv yum.repos.d /etc/yum.repos.d && rm yum.repos.d.tar.gz
RUN sed -e "s|^mirrorlist=|#mirrorlist=|g" \
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos-vault/8.4.2105|g" \
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=http://mirrors.tuna.tsinghua.edu.cn/centos-vault/8.4.2105|g" \
-i.bak \
/etc/yum.repos.d/CentOS-*.repo && yum clean all && yum makecache

RUN yum update -y && yum install -y \
git \
Expand Down Expand Up @@ -243,6 +245,19 @@ RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/rocksdb-v7
&& tar zxf rocksdb-v7.8.3.tar.gz && cd rocksdb-7.8.3 && cmake -DCMAKE_BUILD_TYPE=Release -DPORTABLE=ON -DFORCE_SSE42=ON -DWITH_JEMALLOC=ON \
&& make ${JFLAG} && make install && rm -rf /rocksdb*

# set maven mirror
RUN mkdir -p ~/.m2 \
&& echo '<settings>' > ~/.m2/settings.xml \
&& echo ' <mirrors>' >> ~/.m2/settings.xml \
&& echo ' <mirror>' >> ~/.m2/settings.xml \
&& echo ' <id>alimaven</id>' >> ~/.m2/settings.xml \
&& echo ' <mirrorOf>central</mirrorOf>' >> ~/.m2/settings.xml \
&& echo ' <url>https://maven.aliyun.com/nexus/content/groups/public/</url>' >> ~/.m2/settings.xml \
&& echo ' </mirror>' >> ~/.m2/settings.xml \
&& echo ' </mirrors>' >> ~/.m2/settings.xml \
&& echo '</settings>' >> ~/.m2/settings.xml \
&& cat ~/.m2/settings.xml

# install antlr4-4.13.0
# if it is not accessible, replace it with the link below
# https://github.com/antlr/antlr4/archive/refs/tags/4.13.0.tar.gz
Expand Down Expand Up @@ -328,30 +343,16 @@ RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/tabulate-3
&& tar zxf tabulate-3a5830.tar.gz && cp -rf tabulate/include/tabulate /usr/local/include \
&& rm -rf /tabulate*

RUN sed -i '3 s/-lgomp/-l:libgomp.a/' /usr/local/lib64/libgomp.spec

RUN yum install -y epel-release pcre-devel yum-utils

# install swig
RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/swig-4.0.2.tar.gz \
&& tar -xzvf swig-4.0.2.tar.gz && cd swig-4.0.2 && ./configure \
&& make && make install && cd .. \
&& rm -rf swig-4.0.2 swig-4.0.2.tar.gz

# install faiss
RUN wget -O /tmp/openblas-faiss.tar.gz https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/openblas-faiss.tar.gz \
&& tar -xzvf /tmp/openblas-faiss.tar.gz -C /tmp && cd /tmp/openblas-faiss/OpenBLAS && make && make install \
&& cd /tmp/openblas-faiss/faiss && cmake -B build -DCMAKE_BUILD_TYPE=Release -DFAISS_ENABLE_GPU=OFF -DFAISS_OPT_LEVEL=avx2 -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_INSTALL_LIBDIR=lib -DOpenMP_CXX_FLAGS="-fopenmp" -DOpenMP_CXX_LIB_NAMES="gomp" -DOpenMP_gomp_LIBRARY="/usr/lib64/libgomp.so.1" -DBLAS_LIBRARIES=/opt/OpenBLAS/lib/libopenblas.so . && make -C build && make -C build install \
&& rm -rf /tmp/openblas-faiss /tmp/openblas-faiss.tar.gz && ldconfig

# install vsag
RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/vsag-0.11.5.tar.gz -O /tmp/vsag.tar.gz && \
cd /tmp && mkdir vsag && tar -xzf vsag.tar.gz --strip-components=1 -C vsag && cd vsag && \
yum install -y libgfortran5.x86_64 && ln -s /usr/lib64/libgfortran.so.5.0.0 /usr/local/lib/libgfortran.so && ldconfig && \
yum install -y libgfortran.x86_64 && ln -s /usr/lib64/libgfortran.so.5.0.0 /usr/local/lib/libgfortran.so && ldconfig && \
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_INTEL_MKL=OFF -DDISABLE_AVX2_FORCE=ON -DDISABLE_AVX512_FORCE=ON .. && \
make -j10 && make install && \
make ${JFLAG} && make install && \
cd / && rm -rf /tmp/vsag*

RUN sed -i '3 s/-lgomp/-l:libgomp.a/' /usr/local/lib64/libgomp.spec

ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk \
LD_LIBRARY_PATH=/usr/local/lib64/lgraph:/usr/lib64:/usr/local/lib64:/usr/local/lib:/usr/lib/jvm/java-11-openjdk/lib/server:$LD_LIBRARY_PATH \
PYTHONPATH=/usr/local/lib64/lgraph:/usr/local/lib64:$PYTHONPATH \
Expand Down
29 changes: 24 additions & 5 deletions ci/images/tugraph-compile-ubuntu18.04-Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/leveldb-v1
&& ln -s /usr/local/lib/libleveldb.so.1.20 /usr/local/lib/libleveldb.so \
&& rm -rf /leveldb*

# install node.js && pnpm
# install node.js
# if it is not accessible, replace it with the link below
# https://registry.npmmirror.com/-/binary/node/v16.6.0/node-v16.20.0-linux-x64.tar.gz
RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/node-v16.20.0-linux-x64.tar.gz \
Expand All @@ -138,11 +138,8 @@ RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/node-v16.2
&& npm config set registry https://registry.npmmirror.com \
&& rm -rf /node-v16.20.0-linux-x64.tar.gz \
&& npm install --global yarn \
&& npm install --global pnpm \
&& ln -s /node-v16.20.0-linux-x64/lib/node_modules/yarn/bin/yarn /usr/local/bin/yarn \
&& ln -s /node-v16.20.0-linux-x64/bin/pnpm /usr/local/bin/pnpm \
&& yarn config set registry https://registry.npmmirror.com \
&& pnpm config set registry https://registry.npmmirror.com
&& yarn config set registry https://registry.npmmirror.com

# install lcov
# if it is not accessible, replace it with the link below
Expand Down Expand Up @@ -244,6 +241,19 @@ RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/rocksdb-v7
&& tar zxf rocksdb-v7.8.3.tar.gz && cd rocksdb-7.8.3 && cmake -DCMAKE_BUILD_TYPE=Release -DPORTABLE=ON -DFORCE_SSE42=ON -DWITH_JEMALLOC=ON \
&& make ${JFLAG} && make install && rm -rf /rocksdb*

# set maven mirror
RUN mkdir -p ~/.m2 \
&& echo '<settings>' > ~/.m2/settings.xml \
&& echo ' <mirrors>' >> ~/.m2/settings.xml \
&& echo ' <mirror>' >> ~/.m2/settings.xml \
&& echo ' <id>alimaven</id>' >> ~/.m2/settings.xml \
&& echo ' <mirrorOf>central</mirrorOf>' >> ~/.m2/settings.xml \
&& echo ' <url>https://maven.aliyun.com/nexus/content/groups/public/</url>' >> ~/.m2/settings.xml \
&& echo ' </mirror>' >> ~/.m2/settings.xml \
&& echo ' </mirrors>' >> ~/.m2/settings.xml \
&& echo '</settings>' >> ~/.m2/settings.xml \
&& cat ~/.m2/settings.xml

# install antlr4-4.13.0
# if it is not accessible, replace it with the link below
# https://github.com/antlr/antlr4/archive/refs/tags/4.13.0.tar.gz
Expand Down Expand Up @@ -329,6 +339,15 @@ RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/tabulate-3
&& tar zxf tabulate-3a5830.tar.gz && cp -rf tabulate/include/tabulate /usr/local/include \
&& rm -rf /tabulate*

# install vsag
RUN apt-get install -y gfortran && ln -s /usr/lib/x86_64-linux-gnu/libgfortran.so.4 /usr/local/lib/libgfortran.so

RUN wget https://tugraph-web.oss-cn-beijing.aliyuncs.com/tugraph/deps/vsag-0.11.5.tar.gz -O /tmp/vsag.tar.gz && \
cd /tmp && mkdir vsag && tar -xzf vsag.tar.gz --strip-components=1 -C vsag && cd vsag && \
mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_LIBDIR=lib64 -DENABLE_INTEL_MKL=OFF -DDISABLE_AVX2_FORCE=ON -DDISABLE_AVX512_FORCE=ON .. && \
make -j10 && make install && \
cd / && rm -rf /tmp/vsag*

RUN sed -i '3 s/-lgomp/-l:libgomp.a/' /usr/local/lib64/libgomp.spec

ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 \
Expand Down
6 changes: 0 additions & 6 deletions src/BuildLGraphApi.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ target_include_directories(${TARGET_LGRAPH} PUBLIC
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(${TARGET_LGRAPH} PUBLIC
vsag
/opt/OpenBLAS/lib/libopenblas.a
libfaiss_avx2.a
libgomp.a
-static-libstdc++
-static-libgcc
Expand All @@ -129,8 +127,6 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_link_libraries(${TARGET_LGRAPH} PUBLIC
vsag
/opt/OpenBLAS/lib/libopenblas.a
libfaiss_avx2.a
${Boost_LIBRARIES}
omp
pthread
Expand All @@ -140,8 +136,6 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
else ()
target_link_libraries(${TARGET_LGRAPH} PUBLIC
vsag
/opt/OpenBLAS/lib/libopenblas.a
libfaiss_avx2.a
rt
omp
pthread
Expand Down
4 changes: 0 additions & 4 deletions src/BuildLGraphServer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ if (NOT (CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
geax_isogql
bolt
vsag
/opt/OpenBLAS/lib/libopenblas.a
libfaiss_avx2.a
# begin static linking
-Wl,-Bstatic
cpprest
Expand Down Expand Up @@ -134,6 +132,4 @@ target_link_libraries(${TARGET_SERVER}
${TARGET_SERVER_LIB}
librocksdb.a
vsag
/opt/OpenBLAS/lib/libopenblas.a
libfaiss_avx2.a
)
2 changes: 0 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ install(FILES
DESTINATION etc)
install(FILES
/usr/local/lib64/libvsag.so
/lib64/libgfortran.so.5
/lib64/libgfortran.so.5.0.0
DESTINATION lib64/lgraph)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../include
DESTINATION ./)
Expand Down

0 comments on commit ceb0ec2

Please sign in to comment.