Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Meson] HarfBuzz fails to build with enabled support for ICU #3450

Closed
Arfrever opened this issue Feb 17, 2022 · 1 comment · Fixed by #3459
Closed

[Meson] HarfBuzz fails to build with enabled support for ICU #3450

Arfrever opened this issue Feb 17, 2022 · 1 comment · Fixed by #3459

Comments

@Arfrever
Copy link

Since commit daab4bf, HarfBuzz fails to build with enabled support for ICU (-Dicu=enabled passed to meson) if ICU's .pc files specify multiple elements in value of DEFS variable.

meson setup --libdir lib64 --localstatedir /var/lib --prefix /usr --sysconfdir /etc --wrap-mode nodownload --build.pkg-config-path /var/tmp/portage/media-libs/harfbuzz-3.4.0/temp/python3.10/pkgconfig:/usr/share/pkgconfig --pkg-config-path /var/tmp/portage/media-libs/harfbuzz-3.4.0/temp/python3.10/pkgconfig:/usr/share/pkgconfig --native-file /var/tmp/portage/media-libs/harfbuzz-3.4.0/temp/meson.x86_64-pc-linux-gnu.amd64.ini --buildtype plain -Dcoretext=disabled -Dchafa=disabled -Dglib=enabled -Dgraphite2=enabled -Dicu=enabled -Dgobject=enabled -Dtests=disabled -Dfreetype=enabled -Dcairo=enabled -Ddocs=disabled -Dintrospection=enabled -Dexperimental_api=false /var/tmp/portage/media-libs/harfbuzz-3.4.0/work/harfbuzz-3.4.0 /var/tmp/portage/media-libs/harfbuzz-3.4.0/work/harfbuzz-3.4.0-abi_x86_64.amd64
...
Run-time dependency icu-uc found: YES 70.1
...
meson compile -C /var/tmp/portage/media-libs/harfbuzz-3.4.0/work/harfbuzz-3.4.0-abi_x86_64.amd64 --jobs 1 --load-average 0 --verbose
...
[68/86] x86_64-pc-linux-gnu-g++ -Isrc/libharfbuzz-icu.so.0.30400.0.p -Isrc -I../harfbuzz-3.4.0/src -I. -I../harfbuzz-3.4.0 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++11 -fno-rtti -fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden '-DU_DISABLE_RENAMING=1 -DUCONFIG_ENABLE_PLUGINS=1' -DHAVE_CONFIG_H -march=native -O2 -fno-ident -frecord-gcc-switches -fstack-clash-protection -fstack-protector-all -mfunction-return=thunk -mindirect-branch=thunk -mindirect-branch-register -pipe -Wall -Werror=terminate -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_CONCEPT_CHECKS -std=c++14 -DHB_NDEBUG -fPIC -Wno-non-virtual-dtor -MD -MQ src/libharfbuzz-icu.so.0.30400.0.p/hb-icu.cc.o -MF src/libharfbuzz-icu.so.0.30400.0.p/hb-icu.cc.o.d -o src/libharfbuzz-icu.so.0.30400.0.p/hb-icu.cc.o -c ../harfbuzz-3.4.0/src/hb-icu.cc
FAILED: src/libharfbuzz-icu.so.0.30400.0.p/hb-icu.cc.o 
x86_64-pc-linux-gnu-g++ -Isrc/libharfbuzz-icu.so.0.30400.0.p -Isrc -I../harfbuzz-3.4.0/src -I. -I../harfbuzz-3.4.0 -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++11 -fno-rtti -fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden '-DU_DISABLE_RENAMING=1 -DUCONFIG_ENABLE_PLUGINS=1' -DHAVE_CONFIG_H -march=native -O2 -fno-ident -frecord-gcc-switches -fstack-clash-protection -fstack-protector-all -mfunction-return=thunk -mindirect-branch=thunk -mindirect-branch-register -pipe -Wall -Werror=terminate -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_CONCEPT_CHECKS -std=c++14 -DHB_NDEBUG -fPIC -Wno-non-virtual-dtor -MD -MQ src/libharfbuzz-icu.so.0.30400.0.p/hb-icu.cc.o -MF src/libharfbuzz-icu.so.0.30400.0.p/hb-icu.cc.o.d -o src/libharfbuzz-icu.so.0.30400.0.p/hb-icu.cc.o -c ../harfbuzz-3.4.0/src/hb-icu.cc
<command-line>: error: token "=" is not valid in preprocessor expressions
<command-line>: error: token "=" is not valid in preprocessor expressions
ninja: build stopped: subcommand failed.

As seen above, '-DU_DISABLE_RENAMING=1 -DUCONFIG_ENABLE_PLUGINS=1' (in single quotes) was passed to compiler.
Since it was in single quotes, it was treated as single argument, not multiple separate arguments.

In meson-log.txt:

...
Called `/usr/bin/pkg-config --variable=DEFS icu-uc` -> 0
-DU_DISABLE_RENAMING=1 -DUCONFIG_ENABLE_PLUGINS=1
Got pkgconfig variable DEFS : -DU_DISABLE_RENAMING=1 -DUCONFIG_ENABLE_PLUGINS=1
...

Fix working for me:

--- meson.build
+++ meson.build
@@ -130,8 +130,8 @@
 endif
 
 if icu_dep.found() and icu_dep.type_name() == 'pkgconfig'
-  icu_defs = icu_dep.get_variable(pkgconfig: 'DEFS', default_value: '')
-  if icu_defs != ''
+  icu_defs = icu_dep.get_variable(pkgconfig: 'DEFS', default_value: '').split()
+  if icu_defs.length() > 0
     add_project_arguments(icu_defs, language: ['c', 'cpp'])
   endif
 endif
@jameshilliard
Copy link
Contributor

I made a pull request with your suggested patch in #3459.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants