Closed Yodonicc closed 2 years ago
Please provide the output of configure
and any config.log
. Pthreads are automatically detected by autotools and require no special instructions.
Thanks for your guidance.Here are my building steps:
1.Configure zimg
source /usr/local/zhiying/emsdk/emsdk_env.sh
export PATH="/usr/local/lib:$PATH"
export PATH="/usr/local/zhiying/emsdk/upstream/bin:$PATH"
export PTHREAD_CFLAGS="-pthread"
export PTHREAD_LIBS="-lpthread"
export PTHREAD_CC=""
BUILD_DIR=/usr/local
CONF_FLAGS=( --prefix=$BUILD_DIR --disable-simd )
emconfigure ./configure "${CONF_FLAGS[@]}"
BTW, I use '--disable-simd' because of https://github.com/sekrit-twc/zimg/issues/164
And I got:
configure: ./configure --prefix=/usr/local --disable-simd checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /usr/bin/mkdir -p checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether make supports nested variables... (cached) yes checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu checking how to print strings... printf checking for style of include used by make... GNU checking for gcc... /usr/local/zhiying/emsdk/upstream/emscripten/emcc checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether /usr/local/zhiying/emsdk/upstream/emscripten/emcc accepts -g... yes checking for /usr/local/zhiying/emsdk/upstream/emscripten/emcc option to accept ISO C89... none needed checking dependency style of /usr/local/zhiying/emsdk/upstream/emscripten/emcc... gcc3 checking for a sed that does not truncate output... /usr/bin/sed checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for fgrep... /usr/bin/grep -F checking for ld used by /usr/local/zhiying/emsdk/upstream/emscripten/emcc... /usr/local/zhiying/emsdk/upstream/emscripten/emcc checking if the linker (/usr/local/zhiying/emsdk/upstream/emscripten/emcc) is GNU ld... yes checking for BSD- or MS-compatible name lister (nm)... /usr/local/zhiying/emsdk/upstream/bin/llvm-nm checking the name lister (/usr/local/zhiying/emsdk/upstream/bin/llvm-nm) interface... BSD nm checking whether ln -s works... yes checking the maximum length of command line arguments... 1572864 checking whether the shell understands some XSI constructs... yes checking whether the shell understands "+="... yes checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop checking for /usr/local/zhiying/emsdk/upstream/emscripten/emcc option to reload object files... -r checking for objdump... objdump checking how to recognize dependent libraries... pass_all checking for dlltool... no checking how to associate runtime and link libraries... printf %s\n checking for archiver @FILE support... @ checking for strip... strip checking for ranlib... /usr/local/zhiying/emsdk/upstream/emscripten/emranlib checking command to parse /usr/local/zhiying/emsdk/upstream/bin/llvm-nm output from /usr/local/zhiying/emsdk/upstream/emscripten/emcc object... ok checking for sysroot... no checking for mt... no checking if : is a manifest tool... no checking how to run the C preprocessor... /usr/local/zhiying/emsdk/upstream/emscripten/emcc -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for dlfcn.h... yes checking for objdir... .libs checking if /usr/local/zhiying/emsdk/upstream/emscripten/emcc supports -fno-rtti -fno-exceptions... yes checking for /usr/local/zhiying/emsdk/upstream/emscripten/emcc option to produce PIC... -fPIC -DPIC checking if /usr/local/zhiying/emsdk/upstream/emscripten/emcc PIC flag -fPIC -DPIC works... yes checking if /usr/local/zhiying/emsdk/upstream/emscripten/emcc static flag -static works... yes checking if /usr/local/zhiying/emsdk/upstream/emscripten/emcc supports -c -o file.o... yes checking if /usr/local/zhiying/emsdk/upstream/emscripten/emcc supports -c -o file.o... (cached) yes checking whether the /usr/local/zhiying/emsdk/upstream/emscripten/emcc linker (/usr/local/zhiying/emsdk/upstream/emscripten/emcc) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes checking whether we are using the GNU C++ compiler... yes checking whether /usr/local/zhiying/emsdk/upstream/emscripten/em++ accepts -g... yes checking dependency style of /usr/local/zhiying/emsdk/upstream/emscripten/em++... gcc3 checking how to run the C++ preprocessor... /usr/local/zhiying/emsdk/upstream/emscripten/em++ -E checking for ld used by /usr/local/zhiying/emsdk/upstream/emscripten/em++... /usr/local/zhiying/emsdk/upstream/emscripten/emcc checking if the linker (/usr/local/zhiying/emsdk/upstream/emscripten/emcc) is GNU ld... yes em++: error: no input files checking whether the /usr/local/zhiying/emsdk/upstream/emscripten/em++ linker (/usr/local/zhiying/emsdk/upstream/emscripten/emcc) supports shared libraries... yes checking for /usr/local/zhiying/emsdk/upstream/emscripten/em++ option to produce PIC... -fPIC -DPIC checking if /usr/local/zhiying/emsdk/upstream/emscripten/em++ PIC flag -fPIC -DPIC works... yes checking if /usr/local/zhiying/emsdk/upstream/emscripten/em++ static flag -static works... yes checking if /usr/local/zhiying/emsdk/upstream/emscripten/em++ supports -c -o file.o... yes checking if /usr/local/zhiying/emsdk/upstream/emscripten/em++ supports -c -o file.o... (cached) yes checking whether the /usr/local/zhiying/emsdk/upstream/emscripten/em++ linker (/usr/local/zhiying/emsdk/upstream/emscripten/emcc) supports shared libraries... yes checking dynamic linker characteristics... (cached) GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether C++ compiler accepts -std=c++14... yes checking whether C compiler accepts -fvisibility=hidden... yes checking for pthread_join using /usr/local/zhiying/emsdk/upstream/emscripten/emcc -pthread -lpthread... yes checking whether /usr/local/zhiying/emsdk/upstream/emscripten/emcc is Clang... yes checking whether Clang needs flag to prevent "argument unused" warning when linking with -pthread... no checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE checking whether more special flags are required for pthreads... no checking for PTHREAD_PRIO_INHERIT... yes checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating Makefile config.status: creating zimg.pc config.status: executing depfiles commands config.status: executing libtool commands
2.Make clean zimg
emmake make clean
and I got:
make: make clean make[1]: Entering directory `/usr/local/zhiying/dependencies/zimg' test -z "" || rm -f test -z "libzimg.la" || rm -f libzimg.la rm -f ./so_locations rm -rf .libs _libs rm -rf doc/example/.libs doc/example/_libs rm -rf src/testcommon/.libs src/testcommon/_libs rm -rf src/zimg/api/.libs src/zimg/api/_libs rm -rf src/zimg/colorspace/.libs src/zimg/colorspace/_libs rm -rf src/zimg/colorspace/arm/.libs src/zimg/colorspace/arm/_libs rm -rf src/zimg/colorspace/x86/.libs src/zimg/colorspace/x86/_libs rm -rf src/zimg/common/.libs src/zimg/common/_libs rm -rf src/zimg/common/arm/.libs src/zimg/common/arm/_libs rm -rf src/zimg/common/x86/.libs src/zimg/common/x86/_libs rm -rf src/zimg/depth/.libs src/zimg/depth/_libs rm -rf src/zimg/depth/arm/.libs src/zimg/depth/arm/_libs rm -rf src/zimg/depth/x86/.libs src/zimg/depth/x86/_libs rm -rf src/zimg/graph/.libs src/zimg/graph/_libs rm -rf src/zimg/resize/.libs src/zimg/resize/_libs rm -rf src/zimg/resize/arm/.libs src/zimg/resize/arm/_libs rm -rf src/zimg/resize/x86/.libs src/zimg/resize/x86/_libs rm -rf src/zimg/unresize/.libs src/zimg/unresize/_libs rm -rf src/zimg/unresize/x86/.libs src/zimg/unresize/x86/_libs rm -rf test/.libs test/_libs rm -rf test/extra/musl-libm/.libs test/extra/musl-libm/_libs cd test/extra/googletest/build && make clean /bin/sh: line 0: cd: test/extra/googletest/build: No such file or directory make[1]: [clean-local] Error 1 (ignored) test -z "libzimg_internal.la " || rm -f libzimg_internal.la
rm -f ./so_locations rm -f rm -f .o rm -f doc/example/.o rm -f src/testapp/.o rm -f src/testcommon/.o rm -f src/testcommon/.lo rm -f src/zimg/api/.o rm -f src/zimg/api/.lo rm -f src/zimg/colorspace/.o rm -f src/zimg/colorspace/.lo rm -f src/zimg/colorspace/arm/.o rm -f src/zimg/colorspace/arm/.lo rm -f src/zimg/colorspace/x86/.o rm -f src/zimg/colorspace/x86/.lo rm -f src/zimg/common/.o rm -f src/zimg/common/.lo rm -f src/zimg/common/arm/.o rm -f src/zimg/common/arm/.lo rm -f src/zimg/common/x86/.o rm -f src/zimg/common/x86/.lo rm -f src/zimg/depth/.o rm -f src/zimg/depth/.lo rm -f src/zimg/depth/arm/.o rm -f src/zimg/depth/arm/.lo rm -f src/zimg/depth/x86/.o rm -f src/zimg/depth/x86/.lo rm -f src/zimg/graph/.o rm -f src/zimg/graph/.lo rm -f src/zimg/resize/.o rm -f src/zimg/resize/.lo rm -f src/zimg/resize/arm/.o rm -f src/zimg/resize/arm/.lo rm -f src/zimg/resize/x86/.o rm -f src/zimg/resize/x86/.lo rm -f src/zimg/unresize/.o rm -f src/zimg/unresize/.lo rm -f src/zimg/unresize/x86/.o rm -f src/zimg/unresize/x86/.lo rm -f test/.o rm -f test/api/.o rm -f test/colorspace/.o rm -f test/colorspace/arm/.o rm -f test/colorspace/x86/.o rm -f test/depth/.o rm -f test/depth/arm/.o rm -f test/depth/x86/.o rm -f test/extra/musl-libm/.o rm -f test/extra/musl-libm/.lo rm -f test/extra/sha1/.o rm -f test/graph/.o rm -f test/resize/.o rm -f test/resize/arm/.o rm -f test/resize/x86/.o test -z "" || rm -f test -z "" || rm -f test -z "test-suite.log" || rm -f test-suite.log rm -f *.lo make[1]: Leaving directory /usr/local/zhiying/dependencies/zimg
3.Make zimg
emmake make
and I got:
make: make make[1]: Entering directory /usr/local/zhiying/dependencies/zimg CXX dummy.lo CXX src/zimg/api/libzimg_internal_la-zimg.lo CXX src/zimg/colorspace/libzimg_internal_la-colorspace.lo CXX src/zimg/colorspace/libzimg_internal_la-colorspace_param.lo CXX src/zimg/colorspace/libzimg_internal_la-gamma.lo CXX src/zimg/colorspace/libzimg_internal_la-graph.lo CXX src/zimg/colorspace/libzimg_internal_la-matrix3.lo CXX src/zimg/colorspace/libzimg_internal_la-operation.lo CXX src/zimg/colorspace/libzimg_internal_la-operation_impl.lo CXX src/zimg/common/libzimg_internal_la-cpuinfo.lo CXX src/zimg/common/libzimg_internal_la-libm_wrapper.lo CXX src/zimg/common/libzimg_internal_la-matrix.lo CXX src/zimg/depth/libzimg_internal_la-blue.lo CXX src/zimg/depth/libzimg_internal_la-depth_convert.lo CXX src/zimg/depth/libzimg_internal_la-depth.lo CXX src/zimg/depth/libzimg_internal_la-dither.lo CXX src/zimg/depth/libzimg_internal_la-quantize.lo CXX src/zimg/graph/libzimg_internal_la-basic_filter.lo CXX src/zimg/graph/libzimg_internal_la-filtergraph.lo CXX src/zimg/graph/libzimg_internal_la-graphbuilder.lo CXX src/zimg/graph/libzimg_internal_la-graphnode.lo CXX src/zimg/resize/libzimg_internal_la-filter.lo CXX src/zimg/resize/libzimg_internal_la-resize.lo CXX src/zimg/resize/libzimg_internal_la-resize_impl.lo CXX src/zimg/unresize/libzimg_internal_la-bilinear.lo CXX src/zimg/unresize/libzimg_internal_la-unresize.lo CXX src/zimg/unresize/libzimg_internal_la-unresize_impl.lo CXXLD libzimg_internal.la CXXLD libzimg.la em++: warning: linking a library with
-shared
will emit a static object file. This is a form of emulation to support existing build systems. If you want to build a runtime shared library use the SIDE_MODULE setting. [-Wemcc] em++: warning: generating an executable with an object extension (.so). If you meant to build an object file please use -c, -r, or -shared [-Wemcc] em++: warning: ignoring unsupported linker flag:-soname
[-Wlinkflags] make[1]: Leaving directory /usr/local/zhiying/dependencies/zimg
4.Make install zimg
emmake make install
and I got:
make: make install make[1]: Entering directory /usr/local/zhiying/dependencies/zimg make[2]: Entering directory /usr/local/zhiying/dependencies/zimg /usr/bin/mkdir -p /usr/local/lib /bin/sh ./libtool --mode=install /usr/bin/install -c libzimg.la /usr/local/lib libtool: install: /usr/bin/install -c .libs/libzimg.so.2.0.0 /usr/local/lib/libzimg.so.2.0.0 libtool: install: (cd /usr/local/lib && { ln -s -f libzimg.so.2.0.0 libzimg.so.2 || { rm -f libzimg.so.2 && ln -s libzimg.so.2.0.0 libzimg.so.2; }; }) libtool: install: (cd /usr/local/lib && { ln -s -f libzimg.so.2.0.0 libzimg.so || { rm -f libzimg.so && ln -s libzimg.so.2.0.0 libzimg.so; }; }) libtool: install: /usr/bin/install -c .libs/libzimg.lai /usr/local/lib/libzimg.la libtool: install: /usr/bin/install -c .libs/libzimg.a /usr/local/lib/libzimg.a libtool: install: chmod 644 /usr/local/lib/libzimg.a libtool: install: /usr/local/zhiying/emsdk/upstream/emscripten/emranlib /usr/local/lib/libzimg.a libtool: finish: PATH="/usr/local/zhiying/emsdk/upstream/emscripten/cache/sysroot/bin:/usr/local/zhiying/emsdk/upstream/bin:/usr/local/lib:/usr/local/zhiying/emsdk:/usr/local/zhiying/emsdk/upstream/emscripten:/usr/local/zhiying/emsdk/node/14.15.5_64bit/bin:/root/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/cuda-11.0/bin:/usr/local/ffmpeg/bin:/usr/local/cuda/bin:/root/.ft:/root/.local/bin:/usr/local/bin/:/root/bin:/sbin" ldconfig -n /usr/local/lib ldconfig: /usr/local/lib/libzimg.so is not an ELF file - it has the wrong magic bytes at the start.
ldconfig: /usr/local/lib/libzimg.so.2 is not an ELF file - it has the wrong magic bytes at the start.
ldconfig: /usr/local/lib/libzimg.so.2.0.0 is not an ELF file - it has the wrong magic bytes at the start.
Libraries have been installed in: /usr/local/lib
If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following:
/usr/bin/mkdir -p '/usr/local/share/doc/zimg'
/usr/bin/install -c -m 644 ChangeLog COPYING README.md '/usr/local/share/doc/zimg'
/usr/bin/mkdir -p '/usr/local/share/doc/zimg/example'
/usr/bin/install -c -m 644 doc/example/api_example.cpp doc/example/api_example_c.c doc/example/hdr_example.cpp doc/example/interlace_example.cpp doc/example/tile_example.cpp doc/example/Makefile '/usr/local/share/doc/zimg/example'
/usr/bin/mkdir -p '/usr/local/share/doc/zimg/example/misc'
/usr/bin/install -c -m 644 src/testcommon/aligned_malloc.h src/testcommon/argparse.cpp src/testcommon/argparse.h src/testcommon/mmap.cpp src/testcommon/mmap.h src/testcommon/win32_bitmap.cpp src/testcommon/win32_bitmap.h '/usr/local/share/doc/zimg/example/misc'
/usr/bin/mkdir -p '/usr/local/include'
/usr/bin/install -c -m 644 src/zimg/api/zimg.h src/zimg/api/zimg++.hpp '/usr/local/include'
/usr/bin/mkdir -p '/usr/local/lib/pkgconfig'
/usr/bin/install -c -m 644 zimg.pc '/usr/local/lib/pkgconfig'
make[2]: Leaving directory /usr/local/zhiying/dependencies/zimg' make[1]: Leaving directory
/usr/local/zhiying/dependencies/zimg'
That's all I do with zimg. But when built FFmpeg with emcc and set "-s USE_PTHREADS=1", I still got "--shared-memory is disallowed by libzimg_internal_la-graphnode.o because it was not compiled with 'atomics' or 'bulk-memory' features“. It seemed like I still had not built zimg with multithread. Please give me a hint of my mistakes. @sekrit-twc Thank you very much!
The problem has been solved and it really works for me. Thank you very much for your help! @sekrit-twc
Thank you all.
I had tried to build zimg with multithreads, so I read the
"configure"
file. It said "First of all, check if the user has set any of thePTHREAD_LIBS
, etcetera environment variables...". So I had setPTHREAD_CFLAGS
to"-pthread"
andPTHREAD_LIBS
to"lpthread"
, and then built zimg, nothing special happened.But when built FFmpeg with emcc and set
"-s USE_PTHREADS=1"
, I got "--shared-memory is disallowed by libzimg_internal_la-graphnode.o because it was not compiled with 'atomics' or 'bulk-memory' features“. It seemed like I still had not built zimg with multithread.So how can I build zimg with multithreads?