Usr/local/include not included in build includes
Opened this issue · 5 comments
harfbuzz installs by default to /usr/local/include/harfbuzz
. I had to manually copy harfbuzz source to /usr/include/harfbuzz
to get skia to build.
ben@benpi-desktop:~/deps/skia$ find / -name "hb.h" 2>/dev/null
/usr/local/include/harfbuzz/hb.h
/home/ben/Projects/aseprite/third_party/harfbuzz/src/hb.h
/home/ben/deps/skia/third_party/externals/harfbuzz/src/hb.h
/home/ben/deps/harfbuzz/src/hb.h
[1/422] compile ../../modules/skshaper/src/SkShaper_harfbuzz.cpp
FAILED: obj/modules/skshaper/src/libskshaper.SkShaper_harfbuzz.o
g++ -MD -MF obj/modules/skshaper/src/libskshaper.SkShaper_harfbuzz.o.d -DSKSHAPER_IMPLEMENTATION=1 -DNDEBUG -DSK_GAMMA_APPLY_TO_A8 -DSK_SHAPER_HARFBUZZ_AVAILABLE -DSK_GL -DSK_SUPPORT_PDF -DSK_HAS_JPEG_LIBRARY -DSK_USE_LIBGIFCODEC -DSK_HAS_PNG_LIBRARY -DSK_CODEC_DECODES_RAW -DSK_HAS_WEBP_LIBRARY -DSK_XML -DSK_R32_SHIFT=16 -DU_USING_ICU_NAMESPACE=0 -DSK_USING_THIRD_PARTY_ICU -I../../modules/skshaper/include -I../.. -I../../third_party/externals/libgifcodec -I/usr/include/harfbuzz -fstrict-aliasing -fPIC -O3 -fdata-sections -ffunction-sections -Wno-unused-parameter -I /home/ben/deps/skia/third_party/externals/icu/source/common -I /home/ben/deps/skia/third_party/externals/icu/source/i18n -I /home/ben/deps/skia/third_party/icu -std=c++17 -fno-exceptions -fno-rtti -c ../../modules/skshaper/src/SkShaper_harfbuzz.cpp -o obj/modules/skshaper/src/libskshaper.SkShaper_harfbuzz.o
../../modules/skshaper/src/SkShaper_harfbuzz.cpp:32:10: fatal error: hb.h: No such file or directory
32 | #include <hb.h>
| ^~~~~~
compilation terminated.
This happens because when the skia build uses the system version of harfbuzz, it hardcodes the location /usr/include/harfbuzz:
skia/third_party/harfbuzz/BUILD.gn
Line 15 in bbcd043
Hardcoding /usr/local/include/harfbuzz would not be an improvement. This location needs to be configurable. Even better, the correct location could be determined automatically using pkg-config harfbuzz --cflags
.
A similar problem exists for skia when using system freetype2:
../../src/ports/SkFontHost_FreeType_common.cpp:24:10: fatal error: 'ft2build.h' file not found
24 | #include <ft2build.h>
| ^~~~~~~~~~~~
1 error generated.
../../src/ports/SkFontHost_FreeType.cpp:41:10: fatal error: 'ft2build.h' file not found
41 | #include <ft2build.h>
| ^~~~~~~~~~~~
1 error generated.
for a similar reason:
skia/third_party/freetype2/BUILD.gn
Line 18 in bbcd043
which could be fixed similarly by using pkg-config freetype2 --cflags
.
I couldn't find an upstream issue for this so I've now filed https://issues.skia.org/issues/372508426.
@ryandesign I'd highly recommend you to avoid creating new issues on Skia if you are not testing their latest version in main
branch. I'd say that if we have a compilation problem using m102, or m124, it is our problem.
Since the hardcoded /usr/include paths are still present in the latest version of the code in their main branch, I felt sufficiently confident in filing the issue with them even without attempting to build their version.
I ran into the same issue using vcpkg to install skia using -_m134. After Harfbuzz was being built successfully in the dependency chain, skia is unable to build since hb.h cannot be found.