NetBSD Problem Report #55290

From  Sat May 23 12:27:03 2020
Return-Path: <>
Received: from ( [])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id 741251A9244
	for <>; Sat, 23 May 2020 12:27:03 +0000 (UTC)
Message-Id: <>
Date: Sat, 23 May 2020 12:27:02 +0000 (UTC)
Subject: 'llvm' fail to cross-compile (it uses target's llvm-tblgen)
X-Send-Pr-Version: www-1.0

>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
>Last-Modified:  Mon May 25 08:15:01 +0000 2020
>Originator:     Romain Dolbeau
>Release:        pkgsrc 2020Q1
NetBSD amd64-netbsd 9.0 NetBSD 9.0 (GENERIC) #0: Fri Feb 14 00:06:28 UTC 2020 amd64
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.
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).
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_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.

From: Romain Dolbeau <>
Subject: Re: pkg/55290: 'llvm' fail to cross-compile (it uses target's llvm-tblgen)
Date: Mon, 25 May 2020 10:13:33 +0200

 Extra note; the resulting LLVM default to a x86-64 target (despite it
 not being built), I had to also add this:


NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.