The googletest dependency in Meson looks for files in /usr/src/gtest if no pkg-config file or prebuilt libraries can be found. See: https://github.com/mesonbuild/meson/blob/d5026f13dedd91e3bf88a72c5be83217d94e3254/mesonbuild/dependencies/dev.py#L46 This will cause compilation errors when building a component that has automatic detection of googletest in it and does not have it as a dependency in its recipe or if building with an SDK that does not have googletest in it: $ ninja -C build ... arm-pelux-linux-gnueabi-g++ -march=armv7ve -mthumb -mfpu=neon-vfpv4 -mfloat-abi=hard -mcpu=cortex-a7 --sysroot=/home/martin/Downloads/pelux-rpi-sdk/sysroots/cortexa7t2hf-neon-vfpv4-pelux-linux-gnueabi -Isrc/common/unit_tests/src@common@unit_tests@@common-unit_tests@exe -Isrc/common/unit_tests -I../src/common/unit_tests -Isrc -I../src -I/home/martin/Downloads/pelux-rpi-sdk/sysroots/cortexa7t2hf-neon-vfpv4-pelux-linux-gnueabi/usr/include/glibmm-2.4 -I/home/martin/Downloads/pelux-rpi-sdk/sysroots/cortexa7t2hf-neon-vfpv4-pelux-linux-gnueabi/usr/lib/glibmm-2.4/include -I/home/martin/Downloads/pelux-rpi-sdk/sysroots/cortexa7t2hf-neon-vfpv4-pelux-linux-gnueabi/usr/include/glib-2.0 -I/home/martin/Downloads/pelux-rpi-sdk/sysroots/cortexa7t2hf-neon-vfpv4-pelux-linux-gnueabi/usr/lib/glib-2.0/include -I/home/martin/Downloads/pelux-rpi-sdk/sysroots/cortexa7t2hf-neon-vfpv4-pelux-linux-gnueabi/usr/include/sigc++-2.0 -I/home/martin/Downloads/pelux-rpi-sdk/sysroots/cortexa7t2hf-neon-vfpv4-pelux-linux-gnueabi/usr/lib/sigc++-2.0/include -I/usr/src/gtest -I/usr/src/gtest/include -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -Wextra -Wpedantic -std=c++17 -O0 -g -Wformat=2 -Woverloaded-virtual -Wshadow -Wsuggest-override -pthread -MD -MQ 'src/common/unit_tests/src@common@unit_tests@@common-unit_tests@exe/gtest-all.cc.o' -MF 'src/common/unit_tests/src@common@unit_tests@@common-unit_tests@exe/gtest-all.cc.o.d' -o 'src/common/unit_tests/src@common@unit_tests@@common-unit_tests@exe/gtest-all.cc.o' -c /usr/src/gtest/src/gtest-all.cc /usr/src/gtest/src/gtest-all.cc:38:10: fatal error: gtest/gtest.h: No such file or directory #include "gtest/gtest.h"
I'd say: 1) Change the self.src_dirs assignment to [] in our recipe 2) File upstream bug, maybe use $prefix instead of /usr?
I am reluctant to make patches or submit bug reports for something I cannot reproduce. I'd suggest the original submitter should create and send a patch, and report the issue upstream, or at least share a recipe where the issue can be observed.
(In reply to comment #1) > I'd say: > 1) Change the self.src_dirs assignment to [] in our recipe > 2) File upstream bug, maybe use $prefix instead of /usr? Thank you Ross, I sent a patch for using sys.prefix here https://github.com/mesonbuild/meson/pull/5919 . Should do the right thing when building in Yocto or with a Yocto generated SDK, I think. (In reply to comment #2) > I am reluctant to make patches or submit bug reports for something I cannot > reproduce. I'd suggest the original submitter should create and send a > patch, and report the issue upstream, or at least share a recipe where the > issue can be observed. Any component built with meson that has gtest as a dep in meson.build and does not have it as a dependency in its recipe should be a problem when building on a system that installs gtest source in /usr/src.
Posted a comment in upstream pr about whether it makes sense for Meson or if it is something that needs to be patched in Yocto.
Hongxu is no longer working on YP so unassign defect.
Hongxu, I'd like to see this fix sooner than M4 so I've moved it to M2.
Bulk move to 4.3 M3.
Moved to M4.
It appears that the request to patch upstream meson was denied according to the pull request against the Meson Source. So a patch should be created for the YP Meson recipe. @martin, can you provide a reproducer? It would be required to correctly test the patch.
I just filed a new bug with meson to prod this further: https://github.com/mesonbuild/meson/issues/12690.
Moved out of NEEDINFO
Posted 'meson: don't look on the host for GTest when cross-compiling' to the list.
Merged in feb9a58814720a4382d3f02467dcecb276f58040.