CDLL can not find find shared object - python-3.x

I have shared object file libalgo.so in /usr/lib. ls -al /usr/lib gives
-rwxr-xr-x 1 root root 14264 Jul 6 06:57 libalgo.so
-rwxr-xr-x 1 root root 403496 Oct 8 12:07 libnlopt.so.0
I have to import this shared library in python
from ctypes import *
try:
lib = '/usr/lib/libalgo.so'
algo_lib = CDLL(lib)
print('algo_lib loaded')
except Exception as e:
print(e)
when running this code I get an error message saying could not read the shared object. No such file...
I have also added /usr/lib in LD_LIBRARY_PATH. This error only occurs in remote in which I am sshing into not in my local machine.

TL;DR The libalgo.so was compiled for arm.
We are developing for an arm system on x86 machines. One of the deb packages ended up with wrong shared object. Also error message given by python were misleading at best . instead of showing something like invalid object file , the message led me to believe that python could not find the file. I am not sure why such error message was given and any more information on this will be appreciated.

Related

libopencv_highgui.so.3.2 not found

I am linux ubuntu 20.4 user. I was trying to execute my code :
./darknet detector test ~/Documents/Data_challenge/Apple_detection_via_YOLOV4/main_folder/Model_ALL_views/obj.data ~/Documents/Data_challenge/Apple_detection_via_YOLOV4/main_folder/yolov4-tiny-test.cfg ~/Documents/Data_challenge/Apple_detection_via_YOLOV4/main_folder/Model_ALL_views/backup/yolov4-tiny-train_best.weights -thresh 0.20 -dont_show -out ~/Documents/Data_challenge/Apple_detection_via_YOLOV4/main_folder/Model_ALL_views/Prediction.csv < ~/Documents/Data_challenge/Apple_detection_via_YOLOV4/main_folder/Model_ALL_views/test.txt
This code took me this output
./darknet: error while loading shared libraries: libopencv_highgui.so.3.2: cannot open shared object file: No such file or directory
I searched what libraries is missing :
ldd darknet
So, I tried to find if libopencv_highgui.so.3.2 exist and where it is located : sudo find / -name "libopencv_hig*.
Then, it means libopencv_highgui.so.3.2 doesn't exist. I looked some forum about this problem :
#DavidChenTaipei (12 Dec 2019)
#guerillagorilla (24 Dec 2017)
but they doesn't work on my situation.

Why do I get "error: invalid channel name '[toolchain]'" for a dependency when it is in the simple format?

When I try to add sfw-tools v0.2.0 to a project, I run into this issue:
Compiling sfw-tools v0.2.0
error: invalid channel name '[toolchain]' in '/home/brandon/.cargo/registry/src/github.com-1ecc6299db9ec823/sfw-tools-0.2.0/rust-toolchain'
error: caused by: invalid toolchain name: '[toolchain]'
error: could not compile `sfw-tools`
Perplexingly, in the SoftwareTools repository, the contents of the rust-toolchain file is just
nightly-2020-12-25-x86_64-unknown-linux-gnu
(though it is a symbolic link).
Note: I'm guilty of being the author of the dependency as well, so on the bright side, I can probably fix it, once I understand the issue.
ripgrep to the rescue:
$ rg "\[toolchain\]"
Rust/sfw-tools/rust-toolchain
1:[toolchain]
ls -last rust-toolchain
0 lrwxrwxrwx 1 brandon users 36 Dec 26 20:43 rust-toolchain -> Rust/sfw-tools/rust-toolchain.simple
Oops.
So, I needed to rename Rust/sfw-tools/rust-toolchain.simple to be the actual toolchain file

How correctly to link program against library

I run ./myprogram and it gives me a warning:
Warning: Your program was compiled with SimGrid version 3.13.90, and then linked against SimGrid 3.13.0. Proceeding anyway.
Tryldd myprogram and it gives following:
libsimgrid.so.3.13.90 => /usr/lib/libsimgrid.so.3.13.90 (0x00007f338ef47000)
Then I go to usr/lib and type ll *sim* in terminal:
lrwxrwxrwx 1 ken ken 21 июл 28 19:29 libsimgrid.so -> libsimgrid.so.3.13.90*
-rwxrwxr-x 1 ken ken 12307480 июл 28 19:29 libsimgrid.so.3.13.90*
In CMakeLists.txt I link library simgrid in such way:
target_link_libraries(CSim2Sim simgrid)
Why myprogram still links against SimGrid 3.13.0 (it doesn't exist in /usr/lib while SimGrid 3.13.90 does)?
UPDATE:
Command locate libsimgrid.so in ternimal gives:
/home/ken/Downloads/simgrid-master/lib/libsimgrid.so
/home/ken/Downloads/simgrid-master/lib/libsimgrid.so.3.13.90
/home/ken/SimGrid/lib/libsimgrid.so
/home/ken/SimGrid/lib/libsimgrid.so.3.13.90
/usr/lib/libsimgrid.so
/usr/lib/libsimgrid.so.3.13.90
The message seems buggy, it looks like your application was actually compiled with 3.13.0, and linked to libsimgrid 3.13.90. The order was inverted in the message, I will fix that.
It could be a problem with your includes when you compile your code, I think. Please check that you don't use old versions of msg.h/simgrid_config.h files when you compile your app (maybe there are still one in /usr/include ?).
To check, you can look for SIMGRID_VERSION_PATCH in simgrid_config.h. it should be 90 in a recent one, not 0.

hbase 1.1.2 cannot start up ?something wrong with classpath ?

[root#localhost local]# ll
lrwxrwxrwx. 1 root root 11 Sep 12 21:34 hbase -> hbase-1.1.2
drwxr-xr-x. 30 root root 4096 Sep 12 21:34 hbase-1.1.2
[root#localhost local]# ./hbase/bin/start-hbase.sh
Error: Could not find or load main class。 org.apache.hadoop.hbase.util.HBaseConfTool
Error: Could not find or load main class org.apache.hadoop.hbase.zookeeper.ZKServerTool
starting master, logging to /usr/local/hbase/logs/hbase-root-master-localhost.out
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
Error: Could not find or load main class org.apache.hadoop.hbase.master.HMaster
starting regionserver, logging to /usr/local/hbase/logs/hbase-root-1-regionserver-localhost.out
Error: Could not find or load main class org.apache.hadoop.hbase.regionserver.HRegionServer
Why does it show this error? The class file exists.
[root#localhost local]# find ./ -name HBaseConfTool.class
./hbase-1.1.2/hbase-server/target/classes/org/apache/hadoop/hbase/util/HBaseConfTool.class
The /etc/profile:
export JAVA_HOME=/usr/local/jdk1.8.0_20
export HBASE_HOME=/usr/local/hbase
export PATH=$JAVA_HOME/bin:$HBASE_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$HBASE_HOME/hbase-server/target/classes
I add $HBASE_HOME/hbase-server/target/classes, but it still does not find the class file。
I am just a newer,getting start follow official docs, but can not run。I am so eggache... sos...
thanks for you asking my quesiton。
I get the src version, and I use "mvn package -Dmaven.test.skip.exec=true -Dtar -e" compile,I hope it makes hbasexx-bin.tar.gz,but get nothing。
Complie hadoop src use 'mvn package -Pdist,native,docs -DskipTests -Dtar' ,then the xx.tar.gz can be found in hadoop-dist/target/ 。
Maybe my hbase compile command is wrong? I copy it from others。what is the right complie commad ? I am not familiar with mvn params 。。。
/usr/local/hbase-1.1.2/bin/hbase --config conf classpath
I find that many main module path is the old compile path,
/root/hbase-1.1.2/hbase-it/target/hbase-it-1.1.2-tests.jar:/root/hbase-1.1.2/hbase-common/target/hbase-common-1.1.2.jar:/root/hbase-1.1.2/hbase-protocol/target/hbase-protocol-1.1.2.jar:/root/hbase-1.1.2/hbase-client/target/hbase-client-1.1.2.jar:
Oh my god,but how to complie in path /root compile /root/hbase-1.1.2 ,then I mv to /usr/local ? or how to modify classpath when I use in path /usr/local/hbase-1.1.2 ?
Maybe you are using source package.
Try binary package (http://apache.mirror.cdnetworks.com/hbase/1.1.2/hbase-1.1.2-bin.tar.gz) or build it first.
not "hbase-1.1.2-src.tar.gz"
but "hbase-1.1.2-bin.tar.gz"

getting error on executing a program LNK1104

i am using GLUT 3.7.6 with VC++6.0 n on compiling a program i get following error
--------------------Configuration: abc2 - Win32 Debug--------------------
Linking...
LINK : fatal error LNK1104: cannot open file "abc2.exe"
Error executing link.exe.
abc2.exe - 1 error(s), 0 warning(s)
i have included all the header files ...linked all the lib files bt still the result is same...!!...please guide me through this problem...THNX in advance...!!
This usually happens when the output file already exists and something has a lock on it. Check to see if abc2.exe is alright running, or of some program has a file lock on it.
You can check whether abc.exe is running using Process Explorer from sysinternals. If that's the case the link step will fail.
Also check the target file is not write-protected.
All the Microsoft tool error codes are documented online - see here for more reasons why you might see LNK1104.

Resources