Skip to content

Commit

Permalink
chore: Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shdwmtr committed Aug 8, 2024
1 parent 8a5997f commit 0b1067e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ jobs:
sudo mkdir -p $HOME/.millennium/ext/data/cache/lib/tmp
cd $HOME/.millennium/ext/data/cache/lib/tmp
sudo ar -x ../libpython3.11.a
sudo gcc -m32 -shared -o ../libpython3.11.so *.o
sudo gcc -m32 -shared -o ../libpython3.11.8.so *.o
cd $HOME/.millennium/ext/data/cache/lib
sudo rm -rf tmp
Expand Down
4 changes: 3 additions & 1 deletion src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,13 @@ extern "C"
pid_t pid = getpid();
Logger.Log("Hooked main() with PID: {}", pid);

std::string homeDirectory = std::getenv("HOME");

/**
* Since this isn't an executable, and is "preloaded", the kernel doesn't implicitly load dependencies, so we need to manually.
* libpython3.11.so.1.0 should already be in $PATH, so we can just load it from there.
*/
if (!dlopen("/home/shadow/.millennium/ext/data/cache/lib/libpython3.11.8.so", RTLD_LAZY | RTLD_GLOBAL))
if (!dlopen(fmt::format("{}/.millennium/ext/data/cache/lib/libpython3.11.8.so", homeDirectory).c_str(), RTLD_LAZY | RTLD_GLOBAL))
{
LOG_ERROR("Failed to load python libraries: {},\n\nThis is likely because it was not found on disk, try reinstalling Millennium.", dlerror());
}
Expand Down

0 comments on commit 0b1067e

Please sign in to comment.