Skip to content

Commit ea38d7b

Browse files
[bugfix] linux64 linker (#8468)
only add '-fuse-ld=gold' if gold exists While we're at it.. use mold, if mold exists
1 parent 2cc4b71 commit ea38d7b

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

libs/openFrameworksCompiled/project/linux64/config.linux64.default.mk

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,8 @@
2727

2828
include $(OF_SHARED_MAKEFILES_PATH)/config.linux.common.mk
2929

30-
PLATFORM_LDFLAGS += -fuse-ld=gold
30+
ifneq (, $(shell command -v mold))
31+
PLATFORM_LDFLAGS += -fuse-ld=mold
32+
else ifneq (, $(shell command -v gold))
33+
PLATFORM_LDFLAGS += -fuse-ld=gold
34+
endif

libs/openFrameworksCompiled/project/qtcreator/modules/of/helpers.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ function pkgExists(pkg){
116116
return pkgconfig.exitCode() === 0;
117117
}
118118

119+
function commandExists(command) {
120+
var commandProcess = new Process();
121+
commandProcess.exec('command', ['-v', command]);
122+
return commandProcess.exitCode() === 0;
123+
}
124+
119125
function findLibsRecursive(dir, platform, exclude){
120126
var ret = []
121127
if(!File.exists(dir)){

libs/openFrameworksCompiled/project/qtcreator/modules/of/of.qbs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,9 @@ Module{
210210
ldflags = Helpers.pkgconfig(configs, ["--libs-only-L"]);
211211
if(platform === "msys2"){
212212
ldflags.push("-L"+FileInfo.joinPaths(Helpers.msys2root(),"mingw32/lib"));
213-
}else{
213+
}else if (Helpers.commandExists("mold")) {
214+
ldflags.push("-fuse-ld=mold");
215+
}else if (Helpers.commandExists("gold")) {
214216
ldflags.push("-fuse-ld=gold");
215217
}
216218
}else{

0 commit comments

Comments
 (0)