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

Build: Discover.scala can use wrong includes in certain cases. #3506

Open
LeeTibbert opened this issue Sep 26, 2023 · 0 comments
Open

Build: Discover.scala can use wrong includes in certain cases. #3506

LeeTibbert opened this issue Sep 26, 2023 · 0 comments

Comments

@LeeTibbert
Copy link
Contributor

LeeTibbert commented Sep 26, 2023

Build Discover.scala uses the wrong includes when an alternate clang and/or clang++
are specified.

The configuration below used to debug/verify in Issue #2779. Skip
lightly over the bug that the system linker is used lld instead of lld-15,
that is not the fault of Build.scala.

   nativeConfig ~= { _
        .withLTO(scala.scalanative.build.LTO.thin)
        .withLinkingOptions(_ :+ "-fuse-ld=lld")
        .withClang(Paths.get("/opt/homebrew/opt/llvm@15/bin/clang"))
        .withClangPP(Paths.get("/opt/homebrew/opt/llvm@15/bin/clang++"))
    }

When the above executes, it looks like Discover.scala Line 53 executes

     val llvmIncludeDir =
        Try(Process("llvm-config --includedir").lineStream_!.toSeq)
          .getOrElse(Seq.empty)

This gives the configuration for the installed system clang, say clang-17, and not
the requested clang. A similar problem exists at line 78.

This is an insidious bug because there may well be a mismatch between the
include and libraries files implied by the use of the alternate compiler and
those actually used. One may see either false positives or false negatives.

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

No branches or pull requests

1 participant