silnrsi / graphite

Graphite is a "smart font" system developed specifically to handle the complexities of lesser-known languages of the world.
http://graphite.sil.org/
Other
145 stars 44 forks source link

Build with Clang fails; link error: unable to find library -lgcc #35

Closed jstraarup closed 6 years ago

jstraarup commented 6 years ago

Hi, I am trying to compile graphite2-1.3.11 with Clang on Gentoo, and it fails with a linking error. There is no GCC on the system, so it make sense that it can't find the library, but I have not been able to find where it gets the -lgcc flag. The system uses musl, instead of glibc - I do not know if that is relevant. Please help. Thank you :-)

* abi_x86_64.amd64: running multilib-minimal_abi_src_configure

Working in BUILD_DIR: "/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64" cmake -C /dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64/gentoo_common_config.cmake -G Unix Makefiles -DCMAKE_INSTALL_PREFIX=/usr -DVM_MACHINE_TYPE=direct -DCMAKE_BUILD_TYPE=Gentoo -DCMAKE_USER_MAKE_RULES_OVERRIDE=/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64/gentoo_rules.cmake -DCMAKE_TOOLCHAIN_FILE=/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64/gentoo_toolchain.cmake /dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11 loading initial cache file /dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64/gentoo_common_config.cmake -- The C compiler identification is Clang 6.0.0 -- The CXX compiler identification is Clang 6.0.0 -- Check for working C compiler: /usr/lib/llvm/6/bin/clang -- Check for working C compiler: /usr/lib/llvm/6/bin/clang -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/lib/llvm/6/bin/clang++ -- Check for working CXX compiler: /usr/lib/llvm/6/bin/clang++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Build: Gentoo -- Building library: shared -- Segment Cache support: enabled -- File Face support: enabled -- Tracing support: enabled -- Using vm machine type: call -- Compiler ID is: Clang -- <<< Gentoo configuration >>> Build type Gentoo Install path /usr Compiler flags: C -O3 -pipe C++ -O3 -pipe Linker flags: Executable -Wl,-O2 -Wl,--as-needed -Wl,--strip-all Module -Wl,-O2 -Wl,--as-needed -Wl,--strip-all Shared -Wl,-O2 -Wl,--as-needed -Wl,--strip-all

-- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project:

VM_MACHINE_TYPE

-- Build files have been written to: /dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64 * abi_x86_64.amd64: running multilib-minimal_abi_src_compile

Working in BUILD_DIR: "/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64" make -j6 VERBOSE=1 /usr/bin/cmake -H/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11 -B/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64 --check-build-system CMakeFiles/Makefile.cmake 0 /usr/bin/cmake -E cmake_progress_start /dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64/CMakeFiles /dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64/CMakeFiles/progress.marks make -f CMakeFiles/Makefile2 all make[1]: Entering directory '/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64' make -f src/CMakeFiles/graphite2.dir/build.make src/CMakeFiles/graphite2.dir/depend make[2]: Entering directory '/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64' cd /dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64 && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11 /dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11/src /dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64 /dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64/src /dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64/src/CMakeFiles/graphite2.dir/DependInfo.cmake --color= Dependee "/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64/src/CMakeFiles/graphite2.dir/DependInfo.cmake" is newer than depender "/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64/src/CMakeFiles/graphite2.dir/depend.internal". Dependee "/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64/src/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64/src/CMakeFiles/graphite2.dir/depend.internal". Scanning dependencies of target graphite2 make[2]: Leaving directory '/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64' make -f src/CMakeFiles/graphite2.dir/build.make src/CMakeFiles/graphite2.dir/build make[2]: Entering directory '/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64' [ 2%] Building CXX object src/CMakeFiles/graphite2.dir/call_machine.cpp.o ... [ 89%] Building CXX object src/CMakeFiles/graphite2.dir/json.cpp.o cd /dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64/src && /usr/lib/llvm/6/bin/clang++ -Dgraphite2_EXPORTS -I/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11/include -I/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11/src -DNDEBUG -O3 -pipe -fPIC -mfpmath=sse -msse2 -Wimplicit-fallthrough -Wall -Wextra -Wno-unknown-pragmas -Wendif-labels -Wshadow -Wctor-dtor-privacy -Wnon-virtual-dtor -fno-rtti -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden -o CMakeFiles/graphite2.dir/json.cpp.o -c /dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11/src/json.cpp [ 92%] Linking C shared library libgraphite2.so cd /dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/graphite2.dir/link.txt --verbose=1 /usr/lib/llvm/6/bin/clang -fPIC -O3 -pipe -nodefaultlibs -Wl,-O2 -Wl,--as-needed -Wl,--strip-all -shared -Wl,-soname,libgraphite2.so.3 -o libgraphite2.so.3.0.1 CMakeFiles/graphite2.dir/call_machine.cpp.o CMakeFiles/graphite2.dir/gr_char_info.cpp.o CMakeFiles/graphite2.dir/gr_features.cpp.o CMakeFiles/graphite2.dir/gr_face.cpp.o CMakeFiles/graphite2.dir/gr_font.cpp.o CMakeFiles/graphite2.dir/gr_logging.cpp.o CMakeFiles/graphite2.dir/gr_segment.cpp.o CMakeFiles/graphite2.dir/gr_slot.cpp.o CMakeFiles/graphite2.dir/CachedFace.cpp.o CMakeFiles/graphite2.dir/CmapCache.cpp.o CMakeFiles/graphite2.dir/Code.cpp.o CMakeFiles/graphite2.dir/Collider.cpp.o CMakeFiles/graphite2.dir/Decompressor.cpp.o CMakeFiles/graphite2.dir/Face.cpp.o CMakeFiles/graphite2.dir/FeatureMap.cpp.o CMakeFiles/graphite2.dir/Font.cpp.o CMakeFiles/graphite2.dir/GlyphFace.cpp.o CMakeFiles/graphite2.dir/GlyphCache.cpp.o CMakeFiles/graphite2.dir/Intervals.cpp.o CMakeFiles/graphite2.dir/Justifier.cpp.o CMakeFiles/graphite2.dir/NameTable.cpp.o CMakeFiles/graphite2.dir/Pass.cpp.o CMakeFiles/graphite2.dir/Position.cpp.o CMakeFiles/graphite2.dir/Segment.cpp.o CMakeFiles/graphite2.dir/Silf.cpp.o CMakeFiles/graphite2.dir/Slot.cpp.o CMakeFiles/graphite2.dir/Sparse.cpp.o CMakeFiles/graphite2.dir/TtfUtil.cpp.o CMakeFiles/graphite2.dir/UtfCodec.cpp.o CMakeFiles/graphite2.dir/FileFace.cpp.o CMakeFiles/graphite2.dir/SegCache.cpp.o CMakeFiles/graphite2.dir/SegCacheEntry.cpp.o CMakeFiles/graphite2.dir/SegCacheStore.cpp.o CMakeFiles/graphite2.dir/json.cpp.o -lc -lgcc /usr/bin/x86_64-gentoo-linux-musl-ld: error: unable to find library -lgcc clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: [src/CMakeFiles/graphite2.dir/build.make:953: src/libgraphite2.so.3.0.1] Error 1 make[2]: Leaving directory '/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64' make[1]: [CMakeFiles/Makefile2:86: src/CMakeFiles/graphite2.dir/all] Error 2 make[1]: Leaving directory '/dev/shm/portage/media-gfx/graphite2-1.3.11/work/graphite2-1.3.11-abi_x86_64.amd64' make: *** [Makefile:141: all] Error 2

tim-eves commented 6 years ago

The line I believe you're looking for is: https://github.com/silnrsi/graphite/blob/8e2dc27d3519d9dae514a912a0281c2839cdb2e3/src/CMakeLists.txt#L126 As it looks like you're not on the latest releasse I would recommend you pull. A few things to bear in mind:

  1. We renamed VM_MACHINE_TYPE to GRAPHITE2_VM_TYPE way back in version 1.1
  2. Tracing support is only intended for font development environments and adds a non-trivial amount of logging code to the shared object, so if you can turn it off you might want to. It was envisioned that a separate debug build would be made for IDE's or tools in a similar fashion to the -dbg or dev packages of other shared libs. See Graide for an example the intended use case.
  3. While the code is designed to be as portable as possible, we only test on Debian/Ubuntu GCC+Clang and Windows, arm & intel and 32 & 64 bit on all configs. It does get tested on Mac OS occasionally, though there we obviously don't link against gcc but the clang libc. There should be no technical I can think of reason why it wouldn't work with musl but bear in mind this is an untested configuration.