Ghidra's build system prefers g++ over clang, which is not what we want on a
clang-based platform like amd64. This commit makes Ghidra build with clang by: * Adding a clang toolChains block in nativeBuildProperties.gradle * Adding COMPILER="base-clang ports-clang" * Updating WANTLIB by replacing libstdc++ with ${COMPILER_LIBCXX} In addition, honor CXX by setting tools.cppCompiler.executable and tools.linker.executable in nativeBuildProperties.gradle to ${CXX}. Also print those variables so that we can confirm that they are set properly. Lastly, add --stacktrace to the gradle command to facilitate future debugging. Thanks to daniel@ for bringing this to my attention, naddy@ for his detailed report of the g++ and CXX issues, and sthen@ for suggesting a possible fix. ok naddy@ sthen@
This commit is contained in:
parent
41ff140477
commit
f8789dabac
@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Makefile,v 1.6 2019/07/23 02:52:58 lteo Exp $
|
||||
# $OpenBSD: Makefile,v 1.7 2019/09/12 02:10:07 lteo Exp $
|
||||
|
||||
# bundled jython has amd64 components for OpenBSD
|
||||
ONLY_FOR_ARCHS = amd64
|
||||
@ -7,7 +7,7 @@ COMMENT = software reverse engineering (SRE) framework
|
||||
|
||||
VERSION = 9.0.4
|
||||
GHIDRA_DATE = 20190516
|
||||
REVISION = 2
|
||||
REVISION = 3
|
||||
|
||||
GH_ACCOUNT = NationalSecurityAgency
|
||||
GH_PROJECT = ghidra
|
||||
@ -23,7 +23,7 @@ MAINTAINER = Lawrence Teo <lteo@openbsd.org>
|
||||
# Apache v2
|
||||
PERMIT_PACKAGE = Yes
|
||||
|
||||
WANTLIB += c m stdc++
|
||||
WANTLIB += c m ${COMPILER_LIBCXX}
|
||||
|
||||
MASTER_SITES0 = ${HOMEPAGE}
|
||||
MASTER_SITES1 = https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-stable-${YAJSW_VER}/
|
||||
@ -55,6 +55,8 @@ DISTFILES += ${JAR_DISTFILES:C/$/:2/}
|
||||
|
||||
EXTRACT_ONLY = ${DISTNAME}.tar.gz
|
||||
|
||||
COMPILER = base-clang ports-clang
|
||||
|
||||
MODULES = java
|
||||
MODJAVA_VER = 11+
|
||||
|
||||
@ -68,7 +70,7 @@ RUN_DEPENDS = shells/bash \
|
||||
|
||||
NO_TEST = Yes
|
||||
|
||||
SUBST_VARS += GHIDRA_DATE VERSION WRKDIR
|
||||
SUBST_VARS += CXX GHIDRA_DATE VERSION WRKDIR
|
||||
|
||||
JAR_DIRS += Features-FileFormats
|
||||
JAR_DIRS += Features-Python
|
||||
@ -94,6 +96,7 @@ post-extract:
|
||||
pre-build:
|
||||
cp ${FILESDIR}/repos.gradle ${WRKDIR}
|
||||
${SUBST_CMD} ${WRKDIR}/repos.gradle \
|
||||
${WRKSRC}/GPL/nativeBuildProperties.gradle \
|
||||
${WRKSRC}/Ghidra/Framework/Help/src/main/java/help/GHelpBuilder.java
|
||||
mkdir ${WRKDIR}/{flatRepo,gradle,home}
|
||||
.for dir in ${JAR_DIRS}
|
||||
@ -113,11 +116,13 @@ pre-build:
|
||||
cp ${DISTDIR}/yajsw-stable-${YAJSW_VER}.zip \
|
||||
${WRKDIR}/ghidra.bin/Ghidra/Features/GhidraServer
|
||||
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} gradle -g ${WRKDIR}/gradle \
|
||||
--no-daemon --offline -I ${WRKDIR}/repos.gradle yajswDevUnpack
|
||||
--no-daemon --offline --stacktrace -I ${WRKDIR}/repos.gradle \
|
||||
yajswDevUnpack
|
||||
|
||||
do-build:
|
||||
cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} gradle -g ${WRKDIR}/gradle \
|
||||
--no-daemon --offline -I ${WRKDIR}/repos.gradle buildGhidra
|
||||
--no-daemon --offline --stacktrace -I ${WRKDIR}/repos.gradle \
|
||||
buildGhidra
|
||||
|
||||
do-install:
|
||||
${INSTALL_DATA_DIR} ${PREFIX}/share/java
|
||||
|
@ -1,11 +1,13 @@
|
||||
$OpenBSD: patch-GPL_nativeBuildProperties_gradle,v 1.1 2019/07/23 02:09:20 lteo Exp $
|
||||
$OpenBSD: patch-GPL_nativeBuildProperties_gradle,v 1.2 2019/09/12 02:10:07 lteo Exp $
|
||||
|
||||
Adapted from https://github.com/NationalSecurityAgency/ghidra/pull/490
|
||||
|
||||
Force use of Clang and honor CXX.
|
||||
|
||||
Index: GPL/nativeBuildProperties.gradle
|
||||
--- GPL/nativeBuildProperties.gradle.orig
|
||||
+++ GPL/nativeBuildProperties.gradle
|
||||
@@ -75,6 +75,10 @@ model {
|
||||
@@ -75,7 +75,23 @@ model {
|
||||
architecture 'x86_64'
|
||||
operatingSystem 'osx'
|
||||
}
|
||||
@ -14,5 +16,18 @@ Index: GPL/nativeBuildProperties.gradle
|
||||
+ operatingSystem 'openbsd'
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+ toolChains {
|
||||
+ // Force use of Clang
|
||||
+ clang(Clang) {
|
||||
+ eachPlatform { tools ->
|
||||
+ tools.cppCompiler.executable = "${CXX}"
|
||||
+ tools.linker.executable = "${CXX}"
|
||||
+ println "C++ compiler is [${tools.cppCompiler.executable}]"
|
||||
+ println "Linker is [${tools.linker.executable}]"
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
/*******************************************************************************************
|
||||
|
Loading…
Reference in New Issue
Block a user