Where to put the shared library (*.so) to avoid "Error: External module not found" - smalltalk

I created a new code in C Programming and created a shared library out of it. I want to access it on Pharo 7. So I put it on /usr/local/lib , /usr/lib and even on the folder where Pharo executable file located. When I run the code I always get an "Error: External module not found". Where should I put properly the *.so library. I run the Pharo 7 in Raspberry Pi 3 Model B+ with a Raspbian Stretch OS. Here is my code:
'From Pharo7.0.1 of 25 February 2019 [Build information: Pharo-7.0.1+build.149.sha.890f474a81f116ead0e68c8de77790aef4e9a752 (32 Bit)] on 9 May 2019 at 2:29:46.092395 pm'!
FFILibrary subclass: #AD7091RFFILibrary
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Manifold-AD7091R'!
!AD7091RFFILibrary methodsFor: 'accessing platform' stamp: 'LesterLecong 5/9/2019 14:01'!
unixModuleName
"Kept for backward compatibility.
Users should use unix32* or unix64*"
^ 'AD7091R.so'! !
!AD7091RFFILibrary methodsFor: 'accessing platform' stamp: 'LesterLecong 5/9/2019 11:49'!
macModuleName
^ 'AD7091R.dylib'! !
!AD7091RFFILibrary methodsFor: 'accessing platform' stamp: 'LesterLecong 5/9/2019 11:50'!
win32ModuleName
^ 'AD7091R.dll'! !
!AD7091RFFILibrary methodsFor: 'accessing platform' stamp: 'LesterLecong 5/9/2019 14:01'!
unix32ModuleName
"Kept for backward compatibility.
Users should use unix32* or unix64*"
^ 'AD7091R.so'! !
!AD7091RFFILibrary methodsFor: 'api' stamp: 'LesterLecong 5/9/2019 12:01'!
apiAD7091RDealloc: handle
"int AD7091R_dealloc(AD7091R *p_instance)"
^ self ffiCall: #(int AD7091R_dealloc(AD7091RExternalObject handle))! !
!AD7091RFFILibrary methodsFor: 'api' stamp: 'LesterLecong 5/9/2019 12:13'!
apiAD7091RData: handle pin: pin
"iint AD7091R_data_pin(AD7091R *p_instance,
uint8_t n_data_pin)"
^ self ffiCall: #(int AD7091R_data_pin(AD7091RExternalObject handle, int pin))! !
!AD7091RFFILibrary methodsFor: 'api' stamp: 'LesterLecong 5/9/2019 11:57'!
apiAD7091RAlloc: handle
"int AD7091R_alloc(AD7091R **pp_instance)"
^ self ffiCall: #(int AD7091R_alloc(AD7091RExternalObject *handle))! !
!AD7091RFFILibrary methodsFor: 'api' stamp: 'LesterLecong 5/9/2019 13:12'!
apiAD7091RPins: handle convst: convstPin cs: csPin clk: clkPin data: dataPin
"int AD7091R_pins(AD7091R *p_instance,
uint8_t n_convst_pin,
uint8_t n_cs_pin,
uint8_t n_clk_pin,
uint8_t n_data_pin)"
^self ffiCall: #(int AD7091R_pins(AD7091RExternalObject handle,
int convstPin,
int csPin,
int clkPin,
int dataPin))! !
!AD7091RFFILibrary methodsFor: 'api' stamp: 'LesterLecong 5/9/2019 12:14'!
apiAD7091RBegin: handle
"iint AD7091R_begin(AD7091R *p_instance)"
^ self ffiCall: #(int AD7091R_begin(AD7091RExternalObject handle))! !
!AD7091RFFILibrary methodsFor: 'api' stamp: 'LesterLecong 5/9/2019 12:11'!
apiAD7091RClk: handle pin: pin
"iint AD7091R_clk_pin(AD7091R *p_instance,
uint8_t n_clk_pin)"
^ self ffiCall: #(int AD7091R_clk_pin(AD7091RExternalObject handle, int pin))! !
!AD7091RFFILibrary methodsFor: 'api' stamp: 'LesterLecong 5/9/2019 12:11'!
apiAD7091RConvst: handle pin: pin
"iint AD7091R_convst_pin(AD7091R *p_instance,
uint8_t n_convst_pin)"
^ self ffiCall: #(int AD7091R_convst_pin(AD7091RExternalObject handle, int pin))! !
!AD7091RFFILibrary methodsFor: 'api' stamp: 'LesterLecong 5/9/2019 12:12'!
apiAD7091RCs: handle pin: pin
"iint AD7091R_cs_pin(AD7091R *p_instance,
uint8_t n_cs_pin)"
^ self ffiCall: #(int AD7091R_cs_pin(AD7091RExternalObject handle, int pin))! !
!AD7091RFFILibrary methodsFor: 'api' stamp: 'LesterLecong 5/9/2019 12:16'!
apiAD7091RData: handle
"iint AD7091R_data(AD7091R *p_instance)"
^ self ffiCall: #(int AD7091R_data(AD7091RExternalObject handle))! !
!AD7091RFFILibrary methodsFor: 'api' stamp: 'LesterLecong 5/9/2019 12:16'!
apiAD7091RReset: handle
"iint AD7091R_reset(AD7091R *p_instance)"
^ self ffiCall: #(int AD7091R_reset(AD7091RExternalObject handle))! !

I generally recommend putting library files in the the VM's lib folder. So for a Pharo 6 distro I have handy, it would go in the pharo6.0-64/bin/lib/pharo/5.0-201705310241 directory. (The exact subdirectory names will vary a bit from version to version since they embed version numbers.) Also, you can usually get away with symlinking to the library rather than copying it.

Related

How can I resolve the faulting error in Apache

Faulting application name: httpd.exe, version: 2.4.48.0, time stamp: 0x60a37f00
Faulting module name: opencv_videoio_ffmpeg460_64.dll, version: 2022.5.0.0, time stamp: 0x00000000
Exception code: 0x40000015
Fault offset: 0x0000000000f7fd52
Faulting process id: 0x102d0
Faulting application start time: 0x01d913a882251b82
Faulting application path: C:\AI_People_Counter\Software_Files\Apache24\bin\httpd.exe
Faulting module path: C:\Program Files\Python38\Lib\site-packages\cv2\opencv_videoio_ffmpeg460_64.dll
Report Id: 63bbc67f-ae93-4b02-83d9-f9541a09f63b
Faulting package full name:
Faulting package-relative application ID:
How can I resolve this issue?

Detox build fails for Android - :app:compileDebugAndroidTestJavaWithJavac FAILED

I am attempting to finish setting up Detox on my bare Expo project. I have followed the instructions in the docs and believe I have everything configured for Android, but I'm getting an error running detox build -c android.emu.debug. Note that I have TestButler set up as well and installed on the emulator.
/Users/brand/psrn/parksmarter/android/app/src/androidTest/java/com/polygrok.parksmarter/DetoxTest.java:22: error: cannot find symbol
TestButlerProbe.assertReadyIfInstalled();
^
symbol: variable TestButlerProbe
location: class DetoxTest
/Users/brand/psrn/parksmarter/android/app/src/androidTest/java/com/polygrok.parksmarter/TestButlerProbe.java:10: error: cannot find symbol
Log.i(LOG_TAG, "Test butler service verification started...");
^
symbol: variable Log
location: class TestButlerProbe
/Users/brand/psrn/parksmarter/android/app/src/androidTest/java/com/polygrok.parksmarter/TestButlerProbe.java:13: error: cannot find symbol
Log.w(LOG_TAG, "Test butler not installed on device - skipping verification");
^
symbol: variable Log
location: class TestButlerProbe
/Users/brand/psrn/parksmarter/android/app/src/androidTest/java/com/polygrok.parksmarter/TestButlerProbe.java:18: error: cannot find symbol
Log.i(LOG_TAG, "Test butler service is up and running!");
^
symbol: variable Log
location: class TestButlerProbe
/Users/brand/psrn/parksmarter/android/app/src/androidTest/java/com/polygrok.parksmarter/TestButlerProbe.java:23: error: cannot find symbol
PackageManager pm = InstrumentationRegistry.getInstrumentation().getTargetContext().getPackageManager();
^
symbol: class PackageManager
location: class TestButlerProbe
/Users/brand/psrn/parksmarter/android/app/src/androidTest/java/com/polygrok.parksmarter/TestButlerProbe.java:23: error: cannot find symbol
PackageManager pm = InstrumentationRegistry.getInstrumentation().getTargetContext().getPackageManager();
^
symbol: variable InstrumentationRegistry
location: class TestButlerProbe
/Users/brand/psrn/parksmarter/android/app/src/androidTest/java/com/polygrok.parksmarter/TestButlerProbe.java:26: error: package PackageManager does not exist
} catch (PackageManager.NameNotFoundException e) {
^
/Users/brand/psrn/parksmarter/android/app/src/androidTest/java/com/polygrok.parksmarter/TestButlerProbe.java:35: error: cannot find symbol
TestButler.setRotation(Surface.ROTATION_0);
^
symbol: variable Surface
location: class TestButlerProbe
/Users/brand/psrn/parksmarter/android/app/src/androidTest/java/com/polygrok.parksmarter/TestButlerProbe.java:35: error: cannot find symbol
TestButler.setRotation(Surface.ROTATION_0);
^
symbol: variable TestButler
location: class TestButlerProbe
Note: /Users/brand/psrn/parksmarter/android/app/src/androidTest/java/com/polygrok.parksmarter/DetoxTest.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
9 errors

PCIe Problem -- Why pciehp gives contradictory log info

I am running fio jobs on my NVMe SSD and hotplug it then. The platform is hot-pluggable and the system is Centos 7.0.Several seconds after my plug-out, the system encounters a crash and gives these print info:
================
[ 1026.468414] {1}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 1
[ 1026.468422] pciehp 0000:5d:02.0:pcie04: Card present on Slot(6-1)
[ 1026.468432] pciehp 0000:5d:02.0:pcie04: slot(6-1): Link Down event
[ 1026.468451] pciehp 0000:5d:02.0:pcie04: Link Down event queued on slot(6-1): currently getting powered on
[ 1026.468457] pciehp 0000:5d:02.0:pcie04: Already enabled on slot(7-1)
[ 1026.468705] {1}[Hardware Error]: event severity: fatal
[ 1026.468744] {1}[Hardware Error]: Error 0, type: fatal
[ 1026.468782] {1}[Hardware Error]: section_type: PCIe error
[ 1026.468825] {1}[Hardware Error]: port_type: 0, PCIe end point
[ 1026.468867] {1}[Hardware Error]: version: 3.0
[ 1026.468915] {1}[Hardware Error]: command: 0x0102, status: 0x4010
[ 1026.468961] {1}[Hardware Error]: device_id: 0000:00:00.0
[ 1026.469901] {1}[Hardware Error]: slot: 0
[ 1026.469032] {1}[Hardware Error]: secondary_bus: 0x00
[ 1026.469070] {1}[Hardware Error]: vendor_id: 0x1ded, device_id: 0x3010
[ 1026.469117] {1}[Hardware Error]: class_code: 008001
[ 1026.469155] Kernel panic - not syncing: Fatal hardware error!
================
The possible root cause for system crash is that the contradictory event pair that "card present" and "link down" have messed up the system logic. So what confuses me is that pciehp reports both "card present" and "link down" at the same time. As my experience, "card present" often comes with "link up" and "link down" normally goes by "card not present".
Could anybody give me some clues about how this strange situation happens? Or which bit in PCIe register trigger "card present" event and "link down" event?

Cmake building error,trying to install gnuradio-mediatools.amodule in GNURadio

The module can be find Here
I think maybe some dependencies errors occured,anyone who has an idea will be great~
What I find important is
lib/CMakeFiles/gnuradio-mediatools.dir/build.make:86: recipe for target 'lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_impl.cc.o' failed
The whole list as follow:
imatrix#Zero:~/下载/GNU/ 模块/gr-mediatools-master/build$ make -j4
Scanning dependencies of target mediatools_swig_swig_doc
Scanning dependencies of target pygen_python_aead6
Scanning dependencies of target pygen_apps_9a6dd
Scanning dependencies of target gnuradio-mediatools
[ 0%] Built target mediatools_swig_swig_doc
[ 5%] Generating __init__.pyc
[ 5%] Built target pygen_apps_9a6dd
Scanning dependencies of target _mediatools_swig_swig_tag
[ 11%] Generating __init__.pyo
[ 17%] Building CXX object swig/CMakeFiles/_mediatools_swig_swig_tag.dir/_mediatools_swig_swig_tag.cpp.o
[ 23%] Building CXX object lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_s.cc.o
[ 29%] Building CXX object lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_impl.cc.o
[ 35%] Linking CXX executable _mediatools_swig_swig_tag
[ 35%] Built target pygen_python_aead6
[ 35%] Built target _mediatools_swig_swig_tag
[ 41%] Generating mediatools_swig.tag
Scanning dependencies of target mediatools_swig_swig_2d0df
[ 47%] Building CXX object swig/CMakeFiles/mediatools_swig_swig_2d0df.dir/mediatools_swig_swig_2d0df.cpp.o
[ 52%] Linking CXX executable mediatools_swig_swig_2d0df
Swig source
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc: In member function ‘bool mediatools_audiosource_impl::open(std::__cxx11::string)’:
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:42:58: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
d_codec_ctx = d_format_ctx->streams[stream_idx]->codec;
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:11:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavformat/avformat.h:893:21: note: declared here
AVCodecContext *codec;
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:42:58: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
d_codec_ctx = d_format_ctx->streams[stream_idx]->codec;
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:11:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavformat/avformat.h:893:21: note: declared here
AVCodecContext *codec;
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:42:58: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
d_codec_ctx = d_format_ctx->streams[stream_idx]->codec;
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:11:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavformat/avformat.h:893:21: note: declared here
AVCodecContext *codec;
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc: In member function ‘void mediatools_audiosource_impl::readData(std::vector<short int>&)’:
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:91:39: error: ‘avcodec_alloc_frame’ was not declared in this scope
d_frame = avcodec_alloc_frame();
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:95:14: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
int rc = avcodec_decode_audio4(d_codec_ctx, d_frame, &got_frame, &d_packet);
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:10:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavcodec/avcodec.h:4817:5: note: declared here
int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:95:14: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
int rc = avcodec_decode_audio4(d_codec_ctx, d_frame, &got_frame, &d_packet);
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:10:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavcodec/avcodec.h:4817:5: note: declared here
int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:95:79: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
int rc = avcodec_decode_audio4(d_codec_ctx, d_frame, &got_frame, &d_packet);
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:10:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavcodec/avcodec.h:4817:5: note: declared here
int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
^
lib/CMakeFiles/gnuradio-mediatools.dir/build.make:86: recipe for target 'lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_impl.cc.o' failed
make[2]: *** [lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_impl.cc.o] Error 1
make[2]: *** 正在等待未完成的任务....
[ 52%] Built target mediatools_swig_swig_2d0df
Scanning dependencies of target pygen_swig_d4ca7
[ 64%] Generating mediatools_swig.pyc
[ 64%] Generating mediatools_swig.pyo
[ 70%] Built target pygen_swig_d4ca7
CMakeFiles/Makefile2:135: recipe for target 'lib/CMakeFiles/gnuradio-mediatools.dir/all' failed
make[1]: *** [lib/CMakeFiles/gnuradio-mediatools.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Your error stems from here:
gr-mediatools-master/lib/mediatools_audiosource_impl.cc:91:39: error: ‘avcodec_alloc_frame’ was not declared in this scope
d_frame = avcodec_alloc_frame();
That's because avcodec_alloc_frame has been deprecated in recent versions of ffmpeg. The gr-mediatools repository is quite old now.
Replacing avcodec_alloc_frame with av_frame_alloc in lib/mediatools_audiosource_impl.cc on line 91 might just do the trick.

Program with System.Timers.Timer runned via mono project causes high CPU load

I've noticed that programs where usage of System.Timers.Timer object appears is very CPU consumptive (almost 100percent for single CPU core).
I'm using Ubuntu 11.10, here is my version of mono:
mono -V
Mono JIT compiler version 2.10.5 (Debian 2.10.5-1)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: amd64
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: Included Boehm (with typed GC and Parallel Mark)
Here is sample program, which causes unexpected high CPU usage:
using System;
using System.Timers;
namespace MonoCPUTest
{
class Program
{
static Timer _refresh = new Timer();
static void Main(string[] args)
{
_refresh.Interval = 2000;
_refresh.AutoReset = true;
_refresh.Elapsed += (x, y) => refresh();
_refresh.Start();
while (true)
{
Console.WriteLine("loop");
System.Threading.Thread.Sleep(10000);
}
}
static void refresh()
{
Console.WriteLine("refresh");
}
}
}
Thank you very much for any help.
I've just tested (by copy pasting, compiling and executing your code) and cannot reproduce the issue, the CPU load is about 0. I'm using newer version of Mono, specifically the one compiled from the git tree couple days ago; so if there was an issue like that, it was fixed.
I guess upgrading your Mono is not possible without external PPA, but this is what should be done here if you are not forced to use this version for some other reason. You can also compile one from the source, which is as easy, as configure, make, make install ;)