Harsh Mishra
Harsh Mishra

Reputation: 901

Error while loading shared object file: No such file or directory

I am trying to generate a usable binary for GCBM, a C++ carbon accounting tool. The binary has been generated from a GitHub Action workflow which is available as an artifact here: https://nightly.link/HarshCasper/moja.canada/actions/runs/1999997115/GCBM.zip

I downloaded the ZIP, unzipped it inside a gcbm directory, cd inside it, and tried launching the binary through:

./moja.cli

I got the following error:

./moja.cli: error while loading shared libraries: libmoja.flint.so.1: cannot open shared object file: No such file or directory

I have tried various ways to fix it by following other StackOverflow threads but nothing really has worked out. Can anyone please help me solve it?

Upvotes: 1

Views: 2110

Answers (2)

Knud Larsen
Knud Larsen

Reputation: 5909

Example, how to run GCBM/moja.cli with the ~40 internal shared libraries

mkdir GCBM && cd GCBM/
unzip GCBM.zip
chmod +x moja.cli

         ## create a script moja.sh to run moja.cli :

#!/bin/sh
export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
exec ./moja.cli

     ## make the script executable and run ./moja.sh

Upvotes: 1

8-DK
8-DK

Reputation: 301

From the error, it's clear library path that the executable looking for is not present. It happens sometimes if the executable compiled on another system takes a hardcoded library path that is not present on your system. The solution is you have to compile source on your system. Better compile it with a STATIC library. Make changes to Cmake(https://github.com/HarshCasper/moja.canada/blob/bffb196222e118e6797afa2bedab02dbe29dd330/Source/CMakeLists.txt#L47). or copy shared library to proper path.

Upvotes: 3

Related Questions