<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - libFuzzer main is masked by gtest_main"
   href="https://bugs.llvm.org/show_bug.cgi?id=38148">38148</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>libFuzzer main is masked by gtest_main
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>fuzzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>rgovostes@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Maybe somehow related to 23967, which is quite old.

I built clang ToT in a fairly straightforward way (Release build), then tried
to use it to build another LLVM tool with -fsanitize=fuzzer. Running the fuzz
target, I saw:

[==========] Running 0 tests from 0 test cases.
[==========] 0 tests from 0 test cases ran. (0 ms total)
[  PASSED  ] 0 tests.

The program refused to accept a corpus directory, and -help talked about how it
was a Google Test program.

The culprit seems to be that when I built my LLVM tool, I used:

clang++ \
  $("$TARGETDIR"/llvm-config --cxxflags --ldflags --system-libs --libs all) \
  ...

llvm-config adds -lgtest_main -lgtest to the linker flags, and gtest's main()
is apparently winning out over libFuzzer's.

I used sed to cut out -lgtest_main and that solved the issue.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>