From 22bbf4dc4f002d1a9178d45f92e5f81bac8593a4 Mon Sep 17 00:00:00 2001
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
Date: Sat, 19 Sep 2020 23:11:08 -0400
Subject: [PATCH 4/5] Also check lib64 for clang include path.
On 64-bit Fedora, `lib64` is where the clang headers are, not `lib`. For
multiarch systems, both will exist, but it's likely you want 64-bit, so
check that first.
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
---
builder/env.go | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/builder/env.go b/builder/env.go
index c59f5df..91bc263 100644
--- a/builder/env.go
+++ b/builder/env.go
@@ -40,13 +40,19 @@ func getClangHeaderPath(TINYGOROOT string) string {
// Example executable:
// /usr/lib/llvm-9/bin/clang
// Example include path:
- // /usr/lib/llvm-9/lib/clang/9.0.1/include/
+ // /usr/lib/llvm-9/lib64/clang/9.0.1/include/
llvmRoot := filepath.Dir(filepath.Dir(binpath))
- clangVersionRoot := filepath.Join(llvmRoot, "lib", "clang")
+ clangVersionRoot := filepath.Join(llvmRoot, "lib64", "clang")
dirs, err := ioutil.ReadDir(clangVersionRoot)
if err != nil {
- // Unexpected.
- continue
+ // Example include path:
+ // /usr/lib/llvm-9/lib/clang/9.0.1/include/
+ clangVersionRoot = filepath.Join(llvmRoot, "lib", "clang")
+ dirs, err = ioutil.ReadDir(clangVersionRoot)
+ if err != nil {
+ // Unexpected.
+ continue
+ }
}
dirnames := make([]string, len(dirs))
for i, d := range dirs {
--
2.26.2