serious-engine-tfe-git: solve library loading problem in a different way

Instead of using the rpath, just try the installed library directory directly.
Also, change the way that errors are detected for dlopen, checking the error
string picks up errors messages (on NetBSD) that are not relevant.

Adjust serious-engine-tse-git accordingly.
This commit is contained in:
Yorick Hardy 2020-09-27 22:26:41 +02:00
parent 96ad978172
commit 675059beee
5 changed files with 28 additions and 20 deletions

View File

@ -3,6 +3,6 @@
PKGNAME= serious-engine-tfe-0.0
CMAKE_ARGS+= -DTFE:BOOL=TRUE
LDFLAGS+= ${COMPILER_RPATH_FLAG}${PREFIX}/lib/ssam-tfe
CXXFLAGS+= -DPACKAGE_LIBDIR=\""${PREFIX}/lib/ssam-tfe/"\"
.include "../../wip/serious-engine-tfe-git/Makefile.common"

View File

@ -2,5 +2,5 @@ $NetBSD$
SHA1 (patch-CMakeLists.txt) = 8118cf60d01846bf0772e9e7a89a7f5e5b8035a5
SHA1 (patch-Ecc_StdH.h) = e8c1bc298362db1781b5d15aeebcc10201ab8600
SHA1 (patch-Engine_Base_Unix_UnixDynamicLoader.cpp) = 2e139fae083e0dc5f6f5af355e8bd907cabc2d94
SHA1 (patch-Engine_Base_Unix_UnixDynamicLoader.cpp) = 51c406427eadf287df4a6be1990e427730bb2204
SHA1 (patch-Engine_Engine.cpp) = 482b4af4d14aeade6c49703dc3578b730969280c

View File

@ -1,32 +1,40 @@
$NetBSD$
Don't override the search paths for libraries, the rpath is correct.
1) Check for an error (in the handle), instead of just the error string.
(Otherwise transient errors are detected as a loading error.)
2) Use the package directory to find the game libraries.
--- Engine/Base/Unix/UnixDynamicLoader.cpp.orig 2020-09-26 18:29:18.000000000 +0000
+++ Engine/Base/Unix/UnixDynamicLoader.cpp
@@ -78,7 +78,8 @@ CTFileName CDynamicLoader::ConvertLibNam
@@ -65,7 +65,9 @@ void *CUnixDynamicLoader::FindSymbol(con
void CUnixDynamicLoader::DoOpen(const char *lib)
{
module = ::dlopen(lib, RTLD_LAZY | RTLD_GLOBAL);
- SetError();
+ if (module == NULL) {
+ SetError();
+ }
}
@@ -78,7 +80,8 @@ CTFileName CDynamicLoader::ConvertLibNam
#endif
CTFileName fnm = CTString(libname);
CTString libstr((strncmp("lib", fnm.FileName(), 3) == 0) ? "" : "lib");
- return(fnm.FileDir() + libstr + fnm.FileName() + DLLEXTSTR);
+ // use the rpath to find libraries, not the path name
+ // use the pkgsrc path to find libraries, not the path name
+ return(libstr + fnm.FileName() + DLLEXTSTR);
}
@@ -91,6 +92,7 @@ CUnixDynamicLoader::CUnixDynamicLoader(c
} else {
CTFileName fnm = ConvertLibNameToPlatform(libname);
+#if 0
@@ -94,9 +97,7 @@ CUnixDynamicLoader::CUnixDynamicLoader(c
// Always try to dlopen from inside the game dirs before trying
// system libraries...
if (fnm.FileDir() == "") {
@@ -103,6 +105,7 @@ CUnixDynamicLoader::CUnixDynamicLoader(c
return;
}
}
+#endif
DoOpen(fnm);
}
- char buf[MAX_PATH];
- _pFileSystem->GetExecutablePath(buf, sizeof (buf));
- CTFileName fnmDir = CTString(buf);
+ CTFileName fnmDir = CTString(PACKAGE_LIBDIR);
fnmDir = fnmDir.FileDir() + fnm;
DoOpen(fnmDir);
if (module != NULL) {

View File

@ -4,6 +4,6 @@ PKGNAME= serious-engine-tse-0.0
PATCHDIR= ../../wip/serious-engine-tfe-git/patches
CMAKE_ARGS+= -DTFE:BOOL=FALSE
LDFLAGS+= ${COMPILER_RPATH_FLAG}${PREFIX}/lib/ssam-tse
CXXFLAGS+= -DPACKAGE_LIBDIR=\""${PREFIX}/lib/ssam-tse/"\"
.include "../../wip/serious-engine-tfe-git/Makefile.common"

View File

@ -2,5 +2,5 @@ $NetBSD$
SHA1 (patch-CMakeLists.txt) = 8118cf60d01846bf0772e9e7a89a7f5e5b8035a5
SHA1 (patch-Ecc_StdH.h) = e8c1bc298362db1781b5d15aeebcc10201ab8600
SHA1 (patch-Engine_Base_Unix_UnixDynamicLoader.cpp) = 2e139fae083e0dc5f6f5af355e8bd907cabc2d94
SHA1 (patch-Engine_Base_Unix_UnixDynamicLoader.cpp) = 51c406427eadf287df4a6be1990e427730bb2204
SHA1 (patch-Engine_Engine.cpp) = 482b4af4d14aeade6c49703dc3578b730969280c