Tue, 12/20/2022 - 11:38
Forums:
I have been using docker to build the webassembly draw tool. I recently merged the latest code looks like it's reporting an error.
#36 1321.2 Scanning dependencies of target DRAWEXE
#36 1321.3 [100%] Building CXX object src/DRAWEXE/CMakeFiles/DRAWEXE.dir/DRAWEXE.cxx.o
#36 1321.3 em++: warning: linker flag ignored during compilation: '--bind' [-Wunused-command-line-argument]
#36 1322.5 em++: warning: argument unused during compilation: '-lembind' [-Wunused-command-line-argument]
#36 1322.5 [100%] Linking CXX executable ../../lin32/clang/bin/DRAWEXE.js
#36 1325.8 wasm-ld: error: unable to find library -lfreetype
#36 1325.8 em++: error: '/emsdk/upstream/bin/wasm-ld -o ../../lin32/clang/bin/DRAWEXE.js-7.7.wasm CMakeFiles/DRAWEXE.dir/DRAWEXE.cxx.o -L/opt/3rdparty/tcl-wasm32/lib -L/opt/3rdparty/draco-1.4.1-wasm/lib ../../lin32/clang/lib/libTKTopTest.a ../../lin32/clang/lib/libTKDCAF.a ../../lin32/clang/lib/libTKXSDRAW.a ../../lin32/clang/lib/libTKXDEDRAW.a ../../lin32/clang/lib/libTKOpenGlesTest.a ../../lin32/clang/lib/libTKViewerTest.a ../../lin32/clang/lib/libTKDraw.a ../../lin32/clang/lib/libTKMeshVS.a ../../lin32/clang/lib/libTKXDECascade.a ../../lin32/clang/lib/libTKTObj.a ../../lin32/clang/lib/libTKBinTObj.a ../../lin32/clang/lib/libTKXmlTObj.a ../../lin32/clang/lib/libTKXDESTEP.a ../../lin32/clang/lib/libTKSTEP.a ../../lin32/clang/lib/libTKSTEPAttr.a ../../lin32/clang/lib/libTKSTEP209.a ../../lin32/clang/lib/libTKSTEPBase.a ../../lin32/clang/lib/libTKXDEIGES.a ../../lin32/clang/lib/libTKIGES.a ../../lin32/clang/lib/libTKXSBase.a ../../lin32/clang/lib/libTKVRML.a ../../lin32/clang/lib/libTKSTL.a ../../lin32/clang/lib/libTKRWMesh.a ../../lin32/clang/lib/libTKXDE.a ../../lin32/clang/lib/libTKBinXCAF.a ../../lin32/clang/lib/libTKXmlXCAF.a ../../lin32/clang/lib/libTKBin.a ../../lin32/clang/lib/libTKXml.a ../../lin32/clang/lib/libTKXmlL.a ../../lin32/clang/lib/libTKBinL.a ../../lin32/clang/lib/libTKOpenGles.a ../../lin32/clang/lib/libTKXCAF.a ../../lin32/clang/lib/libTKVCAF.a ../../lin32/clang/lib/libTKStd.a ../../lin32/clang/lib/libTKCAF.a ../../lin32/clang/lib/libTKV3d.a ../../lin32/clang/lib/libTKHLR.a ../../lin32/clang/lib/libTKMesh.a ../../lin32/clang/lib/libTKService.a ../../lin32/clang/lib/libTKOffset.a ../../lin32/clang/lib/libTKFillet.a ../../lin32/clang/lib/libTKFeat.a ../../lin32/clang/lib/libTKBool.a ../../lin32/clang/lib/libTKBO.a ../../lin32/clang/lib/libTKShHealing.a ../../lin32/clang/lib/libTKPrim.a ../../lin32/clang/lib/libTKTopAlgo.a ../../lin32/clang/lib/libTKGeomAlgo.a ../../lin32/clang/lib/libTKBRep.a ../../lin32/clang/lib/libTKGeomBase.a ../../lin32/clang/lib/libTKG3d.a ../../lin32/clang/lib/libTKG2d.a ../../lin32/clang/lib/libTKMath.a ../../lin32/clang/lib/libTKStdL.a ../../lin32/clang/lib/libTKLCAF.a ../../lin32/clang/lib/libTKCDF.a ../../lin32/clang/lib/libTKernel.a ../../lin32/clang/lib/libTKJLCDraw.a /opt/3rdparty/tcl-wasm32/lib/libtcl8.6.a -lfreetype /opt/3rdparty/draco-1.4.1-wasm/lib/libdraco.a -L/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten --whole-archive -lembind-rtti --no-whole-archive -lGL-webgl2 -lal -lhtml5 -lstubs -lnoexit -lc -ldlmalloc -lcompiler_rt -lc++-except -lc++abi-except -lunwind-except -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -mllvm -wasm-enable-eh -mllvm -exception-model=wasm --allow-undefined-file=/tmp/tmp5sb9_yz4.undefined --strip-debug --export-if-defined=main --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export=stackSave --export=stackRestore --export=stackAlloc --export=__wasm_call_ctors --export=__errno_location --export=malloc --export=free --export=setThrew --export=emscripten_main_thread_process_queued_calls --export=__dl_seterr --export=saveSetjmp --export=htons --export=memalign --export=ntohs --export=htonl --export-table -z stack-size=5242880 --initial-memory=16777216 --entry=main --max-memory=2147483648 --global-base=1024' failed (returned 1)
#36 1325.8 make[2]: *** [src/DRAWEXE/CMakeFiles/DRAWEXE.dir/build.make:147: lin32/clang/bin/DRAWEXE.js-7.7.0] Error 1
#36 1325.8 make[1]: *** [CMakeFiles/Makefile2:3052: src/DRAWEXE/CMakeFiles/DRAWEXE.dir/all] Error 2
#36 1325.9 make: *** [Makefile:130: all] Error 2
#36 1325.9 emmake: error: 'make -j8' failed (returned 2)
------
executor failed running [/bin/sh -c emmake make -j8]: exit code: 1
After I checked each commit, the problem should be here.
https://git.dev.opencascade.org/gitweb/?p=occt.git;a=commit;h=cb77bfc4f0181e4a8ab503933bd83510fc345eb1
My dockerfile:
FROM emscripten/emsdk:3.1.3 AS build-stage
ENV http_proxy "http://192.168.129.1:10809"
ENV HTTP_PROXY "http://192.168.129.1:10809"
ENV https_proxy "http://192.168.129.1:10809"
ENV HTTPS_PROXY "http://192.168.129.1:10809"
ENV THIRDPARTY_DIR /opt/3rdparty
RUN apt-get clean && apt-get update
RUN apt-get -y install build-essential \
git wget vim \
cmake automake libtool autoconf
# Build RapidJson
WORKDIR $THIRDPARTY_DIR
RUN git clone --depth 1 --branch v1.1.0 https://github.com/Tencent/rapidjson.git rapidjson-1.1.0
# Build Freetype
WORKDIR $THIRDPARTY_DIR
RUN wget https://download.savannah.gnu.org/releases/freetype/freetype-2.7.1.tar.gz
RUN tar -zxvf freetype-2.7.1.tar.gz >> installed_freetype271_files.txt
WORKDIR $THIRDPARTY_DIR/freetype-2.7.1
RUN sh autogen.sh
WORKDIR $THIRDPARTY_DIR/freetype-2.7.1/build
RUN cmake -G "Unix Makefiles" \
-DCMAKE_TOOLCHAIN_FILE:FILEPATH="/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" \
-DCMAKE_INSTALL_PREFIX=$THIRDPARTY_DIR/freetype-2.7.1-wasm ..
RUN make -j4 && make install
# Build Draco
WORKDIR $THIRDPARTY_DIR
RUN git clone --depth 1 --branch 1.4.1 https://github.com/google/draco.git draco-1.4.1
RUN cd draco-1.4.1 && \
git checkout 1.4.1 -b build
WORKDIR $THIRDPARTY_DIR/draco-1.4.1/build
ENV EMSCRIPTEN /emsdk/upstream/emscripten
RUN cmake -G "Unix Makefiles" \
-DCMAKE_TOOLCHAIN_FILE:FILEPATH="/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" \
-DCMAKE_INSTALL_PREFIX=$THIRDPARTY_DIR/draco-1.4.1-wasm \
-DCMAKE_BUILD_TYPE:STRING="Release" \
-DDRACO_WASM:BOOL=ON \
-DBUILD_LIBRARY_TYPE:STRING="Static" \
-DDRACO_JS_GLUE:BOOL=OFF ..
RUN make -j4 && make install
# Build tcl
WORKDIR $THIRDPARTY_DIR
RUN git clone --depth 1 https://github.com/gkv311/tcl.git
WORKDIR tcl
ADD occ_tcl_build_wasm.sh .
RUN /bin/bash occ_tcl_build_wasm.sh
# Build occt
WORKDIR /opt/opencascade
ADD adm /opt/opencascade/adm
ADD tools /opt/opencascade/tools
ADD src /opt/opencascade/src
ADD CMakeLists.txt /opt/opencascade
WORKDIR /opt/opencascade/build
RUN emcmake cmake \
-DINSTALL_DIR=/opt/occt \
-DBUILD_MODULE_Draw:BOOL=ON \
-DBUILD_LIBRARY_TYPE="Static" \
-DBUILD_DOC_Overview:BOOL=FALSE \
-DCMAKE_BUILD_TYPE=release \
-DUSE_FREETYPE:BOOL=ON \
-D3RDPARTY_FREETYPE_DIR:PATH=$THIRDPARTY_DIR/freetype-2.7.1-wasm \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2=$THIRDPARTY_DIR/freetype-2.7.1-wasm/include \
-D3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build=$THIRDPARTY_DIR/freetype-2.7.1-wasm/include/freetype2 \
-D3RDPARTY_FREETYPE_LIBRARY_DIR=$THIRDPARTY_DIR/freetype-2.7.1-wasm/lib \
-DUSE_RAPIDJSON:BOOL=ON \
-D3RDPARTY_RAPIDJSON_DIR:PATH=$THIRDPARTY_DIR/rapidjson-1.1.0 \
-D3RDPARTY_RAPIDJSON_INCLUDE_DIR:PATH=$THIRDPARTY_DIR/rapidjson-1.1.0/include \
-DUSE_DRACO:BOOL=ON \
-D3RDPARTY_DRACO_DIR:PATH=$THIRDPARTY_DIR/draco-1.4.1-wasm \
-D3RDPARTY_DRACO_INCLUDE_DIR:FILEPATH=$THIRDPARTY_DIR/draco-1.4.1-wasm/include \
-D3RDPARTY_DRACO_LIBRARY_DIR:PATH=$THIRDPARTY_DIR/draco-1.4.1-wasm/lib \
-DUSE_TK:BOOL=OFF \
-D3RDPARTY_TCL_DIR:PATH=$THIRDPARTY_DIR/tcl-wasm32 \
-D3RDPARTY_TCL_INCLUDE_DIR:PATH=$THIRDPARTY_DIR/tcl-wasm32/include \
-D3RDPARTY_TCL_LIBRARY_DIR:PATH=$THIRDPARTY_DIR/tcl-wasm32/lib \
-D3RDPARTY_TCL_LIBRARY:FILEPATH=$THIRDPARTY_DIR/tcl-wasm32/lib/libtcl8.6.a \
-DUSE_GLES2:BOOL=OFF \
..
RUN emmake make -j8
# Output wasm file
FROM scratch AS export-stage
COPY --from=build-stage /opt/opencascade/build/lin32/clang/bin /output