<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>13508</bug_id>
          
          <creation_ts>2019-09-10 08:29:59 +0000</creation_ts>
          <short_desc>Meson detects googletest installed on system</short_desc>
          <delta_ts>2024-12-13 17:44:25 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>devtools / tool chain</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>backport 3.1</status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Future</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Martin">marejde</reporter>
          <assigned_to name="Ross Burton">ross.burton</assigned_to>
          <cc>alex.kanavin</cc>
    
    <cc>meta.mr.watcher</cc>
    
    <cc>meta.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
    
    <cc>sgw</cc>
    
    <cc>tgamblin</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>84909</commentid>
    <comment_count>0</comment_count>
    <who name="Martin">marejde</who>
    <bug_when>2019-09-10 08:29:59 +0000</bug_when>
    <thetext>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 &apos;src/common/unit_tests/src@common@unit_tests@@common-unit_tests@exe/gtest-all.cc.o&apos; -MF &apos;src/common/unit_tests/src@common@unit_tests@@common-unit_tests@exe/gtest-all.cc.o.d&apos; -o &apos;src/common/unit_tests/src@common@unit_tests@@common-unit_tests@exe/gtest-all.cc.o&apos; -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 &quot;gtest/gtest.h&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84936</commentid>
    <comment_count>1</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-09-12 14:43:53 +0000</bug_when>
    <thetext>I&apos;d say:
1) Change the self.src_dirs assignment to [] in our recipe
2) File upstream bug, maybe use $prefix instead of /usr?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84946</commentid>
    <comment_count>2</comment_count>
    <who name="Alexander Kanavin">alex.kanavin</who>
    <bug_when>2019-09-12 16:34:56 +0000</bug_when>
    <thetext>I am reluctant to make patches or submit bug reports for something I cannot reproduce. I&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84947</commentid>
    <comment_count>3</comment_count>
    <who name="Martin">marejde</who>
    <bug_when>2019-09-12 17:09:59 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; I&apos;d say:
&gt; 1) Change the self.src_dirs assignment to [] in our recipe
&gt; 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)
&gt; I am reluctant to make patches or submit bug reports for something I cannot
&gt; reproduce. I&apos;d suggest the original submitter should create and send a
&gt; patch, and report the issue upstream, or at least share a recipe where the
&gt; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84948</commentid>
    <comment_count>4</comment_count>
    <who name="Martin">marejde</who>
    <bug_when>2019-09-12 17:20:28 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86762</commentid>
    <comment_count>5</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2020-03-19 16:08:06 +0000</bug_when>
    <thetext>Hongxu is no longer working on YP so unassign defect.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88499</commentid>
    <comment_count>6</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2020-10-27 08:06:46 +0000</bug_when>
    <thetext>Hongxu, I&apos;d like to see this fix sooner than M4 so I&apos;ve moved it to M2.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96113</commentid>
    <comment_count>7</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-07-26 21:29:36 +0000</bug_when>
    <thetext>Bulk move to 4.3 M3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96497</commentid>
    <comment_count>8</comment_count>
    <who name="Trevor Gamblin">tgamblin</who>
    <bug_when>2023-09-14 16:55:24 +0000</bug_when>
    <thetext>Moved to M4.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97710</commentid>
    <comment_count>9</comment_count>
    <who name="Saul Wold">sgw</who>
    <bug_when>2023-12-27 23:11:30 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97722</commentid>
    <comment_count>10</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2024-01-03 13:58:01 +0000</bug_when>
    <thetext>I just filed a new bug with meson to prod this further: https://github.com/mesonbuild/meson/issues/12690.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98210</commentid>
    <comment_count>11</comment_count>
    <who name="Stephen K Jolley">sjolley.yp.pm</who>
    <bug_when>2024-02-15 16:02:49 +0000</bug_when>
    <thetext>Moved out of NEEDINFO</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100235</commentid>
    <comment_count>12</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2024-11-21 14:56:44 +0000</bug_when>
    <thetext>Posted &apos;meson: don&apos;t look on the host for GTest when cross-compiling&apos; to the list.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100439</commentid>
    <comment_count>13</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2024-12-13 17:44:25 +0000</bug_when>
    <thetext>Merged in feb9a58814720a4382d3f02467dcecb276f58040.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>