ide, uppsrc: Fixed to compile PORTABLE_HYBRID with Ubuntu 22.04

This commit is contained in:
cxl 2026-04-26 11:07:48 +02:00
parent ae67da9cc4
commit 558df79005
2 changed files with 14 additions and 4 deletions

View file

@ -8,7 +8,7 @@ uses
library(WIN32) "advapi32 comdlg32 comctl32 imm32";
library(PORTABLE_HYBRID) "brotlidec brotlicommon bz2 Xau";
library(PORTABLE_HYBRID) "brotlidec brotlicommon bz2 Xau uuid";
pkg_config(POSIX !OSX !VIRTUALGUI) "freetype2 x11 xinerama xrender xft xdmcp fontconfig xcb xext";

View file

@ -580,11 +580,21 @@ bool GccBuilder::Link(const Vector<String>& linkfile, const String& linkoptions,
if(!HasFlag("SOLARIS") && !HasFlag("OSX") && !HasFlag("OBJC"))
lnk << " -Wl,--start-group ";
for(String s : pkg_config)
lnk << " `" << Host::CMDLINE_PREFIX << "pkg-config --libs " << s << "`";
if(portable) {
DDUMP(s);
Vector<String> libs = Split(HostSys("pkg-config --libs " + s), CharFilterWhitespace);
DDUMP(libs);
libs.RemoveIf([&](int i) { return findarg(libs[i], "-ldl", "-lpthread", "-lrt", "-lm") >= 0; });
DDUMP(libs);
if(libs.GetCount())
lnk << ' ' << Join(libs, " ");
}
else
lnk << " `" << Host::CMDLINE_PREFIX << "pkg-config --libs " << s << "`";
for(int pass = 0; pass < 2; pass++) {
for(i = 0; i < lib.GetCount(); i++) {
String ln = lib[i];
if(portable && (ln == "dl" || ln == "pthread" || ln == "rt"))
if(portable && (ln == "dl" || ln == "pthread" || ln == "rt" || ln == "m"))
continue;
String ext = ToLower(GetFileExt(ln));
@ -618,7 +628,7 @@ bool GccBuilder::Link(const Vector<String>& linkfile, const String& linkoptions,
lnk << " -Wl,--end-group";
}
if(portable)
lnk << " -Wl,-Bdynamic -lpthread -ldl -lrt";
lnk << " -Wl,-Bdynamic -lpthread -ldl -lrt -lm";
PutConsole("Linking...");
bool error = false;