Skip to content

Commit

Permalink
improvement: Warn when using LTO.thin on MacOS (#3833)
Browse files Browse the repository at this point in the history
  • Loading branch information
WojciechMazur committed Mar 11, 2024
1 parent 7fa2a26 commit 4b9f631
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/src/main/scala/scala/scalanative/build/Validator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ private[build] object Validator {
private def validateCompileConfig(config: Config): Config = {
val c = config.compilerConfig
val issues = List.newBuilder[String]
def warn(msg: String) = config.logger.warn(msg)

if (!Files.exists(c.clang))
issues += s"Provided clang path '${c.clang.toAbsolutePath()}' does not exist, specify a valid path to LLVM Toolchain distribution using config or LLVM_BIN environment variable"
Expand All @@ -51,6 +52,11 @@ private[build] object Validator {
if (config.baseName.trim().isEmpty())
issues += s"Provided baseName is blank, provide a name of target artifact without extensions to allow for determinstic builds"

if (config.targetsMac && c.lto == LTO.thin)
warn(
"LTO.thin is unstable on MacOS, it can lead to compilation errors. Consider using LTO.full (legacy, slower) or LTO.none (disabled)"
)

issues.result() match {
case Nil => config
case issues =>
Expand Down

0 comments on commit 4b9f631

Please sign in to comment.