pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/55290: 'llvm' fail to cross-compile (it uses target's llvm-tblgen)



>Number:         55290
>Category:       pkg
>Synopsis:       'llvm' fail to cross-compile (it uses target's llvm-tblgen)
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 23 12:30:00 +0000 2020
>Originator:     Romain Dolbeau
>Release:        pkgsrc 2020Q1
>Organization:
-
>Environment:
NetBSD amd64-netbsd 9.0 NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
When trying to cross-compile from NetBSD 9.0/amd64 to NetBSD 9.0/sparc, llvm fails to cross-compile as it cannot execute the "../../bin/llvm-tblgen" binary - which of course is a sparc binary. It seems the required cmake parameters are missing.
>How-To-Repeat:
cross-compile llvm from NetBSD 9.0/amd64 to NetBSD 9.0/sparc. Please note that this requires some sparc packages that have been compiled natively as they won't cross-compile (e.g. python37).
>Fix:
I forced the cross-compilation options to cmake in the package Makefile:

#####
diff -u -r1.51 Makefile
--- Makefile    22 Mar 2020 18:01:21 -0000      1.51
+++ Makefile    23 May 2020 12:21:57 -0000
@@ -51,6 +51,10 @@
 CMAKE_ARGS+=   -DLLVM_LINK_LLVM_DYLIB=ON
 CMAKE_ARGS+=   -DLLVM_ENABLE_RTTI=ON
 
+CMAKE_ARGS+=   -DCMAKE_CROSSCOMPILING=True
+CMAKE_ARGS+=   -DLLVM_TABLEGEN=/usr/pkg/bin/llvm-tblgen
+CMAKE_ARGS+=   -DCLANG_TABLEGEN=/usr/pkg/bin/clang-tblgen
+
 CMAKE_ARGS.Darwin+=    -DCMAKE_LIBTOOL=/usr/bin/libtool
 
 CHECK_PORTABILITY_SKIP=        utils/buildit/build_llvm
#####

I don't know how to 1) properly detect this is a cross-compilation and 2) require the llvm package to be installed for the native llvm-tblgen (clang-tblgen is probably not needed for llvm, only for clang), so this is not a 'proper' fix.



Home | Main Index | Thread Index | Old Index