It took two weeks to upgrade the development environment of openframwork as a whole。
Almost debugged all the compilation logic of emsdk、openframwork and apothecary, and finally ran the 3DPrimitivesExample instance。
My final environment is:
OS: ubuntu 20.04 64
emscripten: 3.19
openframework: of_v20220513_linux64gcc6_release
apothecary: apothecary-nightly
The debugging process is not described in detail here, just pay attention to the following key information, and finally the successful compilation can be guaranteed。
1.config.emscripten.default.mk
Modify the parameters of emcc and add the -r flag
as follows:
needed to force emcc linker not to make an execuatable
CUR_CC = $(CC)
CC := $(CUR_CC) -r
Here I need to thank Mr. Hero (sorry, forgot your name,I can’t find where to see your post), which provides a solution to the impact of emsdk on compiling openframeworks because of the change.
2.freetype.sh
I changed the involved c++11 compilation to c++17, most of the apothecary project components can be compiled, but there will be problems when linking.
Finally, after debugging, the most influential is freetype.sh, and the emcc compilation instruction is added with -r, as follows:
elif [ "$TYPE" == "emscripten" ]; then
#patch -p0 -u < $FORMULA_DIR/emscripten.patch
local BUILD_TO_DIR=$BUILD_DIR/freetype/build/$TYPE
./configure --prefix=$BUILD_TO_DIR --with-harfbuzz=no --enable-static=yes --enable-shared=no --with-zlib=no --with-png=no
echo "++++++++++++++++++: $BUILD_TO_DIR \n"
make clean
echo "++++++++++++++++++: ${PARALLEL_MAKE} \n"
make -j${PARALLEL_MAKE}
cp $BUILD_DIR/freetype/objs/apinames .
emconfigure ./configure --prefix=$BUILD_TO_DIR --with-harfbuzz=no --enable-static=yes --enable-shared=no --with-zlib=no --with-png=no
emmake make clean
cp apinames $BUILD_DIR/freetype/objs/
emmake make -j${PARALLEL_MAKE}
emmake make install
# exit
emcc -r objs/*.o -o build/$TYPE/lib/libfreetype.bc
echo "-----------"
echo "$BUILD_DIR"
fi
Finally, copy the link library under out to the libs directory of openframeworks, and the compilation link will be successful.
I won’t go into detail about other process issues, if you have any questions or are interested, you can contact me.
Thanks again to the author of this code:
needed to force emcc linker not to make an execuatable
CUR_CC = $(CC)
CC := $(CUR_CC) -r