Mediapipe exist for python or js, but I would like to use it with unsupported native language. Usualy I use dll and export function.
With the current source of mediapipe, does it's possible to generate a dll ?
I try to generate dll from py but I got an error, don't know if I need to do it to all mediapipe files ?
python -m nuitka --module my_mediapipe_module.py
I identify one module to use, selfie_segmentation and only two method, SelfieSegmentation (__init__) and process.
That look not so difficult, but I don't really know where to start.
Thanks
Related
I have to make some functions that will use different lanaguages (python, R, js).
I got stuck at the part of generating random numbers in Python to initialize a list with random elements. I looked up on ways of initializing random lists, and then I decided to use result = polyglot.eval("python", "[random.randint(0,10) for i in range(20)];").
The problem that I face now is that I need to import the "random" library from python, or whatever libraries will I need from different languages. I heard that it might be a problem with the dependencies, but I am not sure...
What am I supposed to do? Is it even possible to import libraries from more languages in a single project? What other alternatives do I have?
Note that solution for different dynamic languages may differ.
Also js component is stable, while python (as of 2021) is still experimental.
Here is example for Python with modules
https://github.com/paulvi/java-python-graalvm-template
And if you really do polyglot (using Python object in Java code),
see https://github.com/hpi-swa-lab/graalpython-java-example
There is still issue how to actually deploy this in production
https://github.com/hpi-swa-lab/graalpython-java-example/issues/6
as just bundling venv subfolder into jar, will just work.
One solution is in ttps://github.com/paulvi/java-python-graalvm-template
Also randon, i.e. any library with graalvm is still big issue, as different packages have different issues, see https://github.com/oracle/graalpython/issues/228
I suggest, that before really mixing a lot of languages, just try one, e.g. js that is more stable, make it work, and then try next.
BTW PyCharm does not yet support graalpython.
If you do any open source, or later find somethin new, please let me know via GitHub issue
So I'm trying to use stb_image in my Kotlin/Native project and I am having trouble trying to include it in my project. It's a header only library and konan seems to expect a compiled object file anyways so I was wondering if there is any way of just generating the cstubs and then using the header for linking unless I have to compile a basic translation file since stb_image only requires you to have a translation unit that defines STB_IMAGE_IMPLEMENTATION however I have that defined in my compilerOpts -GSTB_IMAGE_IMPLEMENTATION. Would it be easier to just compile a translation unit, create the static object, and then link against it or does K/N have some way of doing that for me?
I am using Gradle Multiplatform so if there is some gradle script I can run then please let me know.
My -GSTB_IMAGE_IMPLEMENTATION is supposed to be -DSTB_IMAGE_IMPLEMENTATION and I needed to put my -I switch in my compilerOpts not linkerOpts.
I recommend actually creating a translation file but it's not required.
You can just give the header file with the compileropts as you've done and that should work.
You can look at this as a reference. I'm working on a wrapper in my free time.
I'm making a perl6 package which contains some c source files that will be compiled into a dynamic link library. I found that the name of the library, such as libperl.so, will be changed into something like "A858A3D6EC5363B3D3F59B1.so" after "zef install". However, the name is used in python code as a module name(libperl). After the change, it is no longer a valid identifier. So, is it possible to prevent the change? If it is, what should I do?
I am not sure if it's possible to do that. Maybe it is.
Inspired by #raiph's link, however, I decided to create a soft link. Now the package works well.
I have installed the "mipsel tuxbox" compile suite for crosscompile
Host system is x86_64 slackware
destination is mipsel32bit "vuduo+"
For example,I want to compile a program, I use this script
make clean
export TOOLCHAIN=/opt/mipsel-tuxbox-linux-gnu
export PATH="$TOOLCHAIN/bin:$PATH"
export CC=/opt/mipsel-tuxbox-linux-gnu/mipsel-tuxbox-linux-gnu/bin/gcc
export RANLIB=/opt/mipsel-tuxbox-linux-gnu/mipsel-tuxbox-linux-gnu/bin/ranlib
make
Compile and executable is..x86_64!
If I use this line give me a lot of error about includes not found
make CC=/opt/mipsel-tuxbox-linux-gnu/mipsel-tuxbox-linux-gnu/bin/gcc STRIP=/opt/mipsel-tuxbox-linux-gnu/mipsel-tuxbox-linux-gnu/bin/strip CPPFLAGS="-I/opt/mipsel-tuxbox-linux-gnu/mipsel-tuxbox-linux-gnu/sysroot/usr/include/linux/ -I/opt/mipsel-tuxbox-linux-gnu/mipsel-tuxbox-linux-gnu/sysroot/usr/include/sys/"
What's wrong?
You should also take a look at http://code.vuplus.com/index.php?action=repo
These systems are based on https://github.com/openembedded which use the https://github.com/openembedded/bitbake build system.
Besides the original vu+ from above there are many others like
https://github.com/OpenPLi
https://github.com/oe-alliance
https://www.vuplus-support.org/wbb4/vtisoftware/
that let you build and integrate simple applications to full blown system images with consistent dependencies.
Other options are
to use gcc/llvm/etc. and make (https://www.linux-mips.org/wiki/Toolchains).
create a Go compiler with crossdev (https://wiki.gentoo.org/wiki/Crossdev) or build and manage your software with crossdev.
use RUST (https://www.rust-lang.org/tools/install) with the mipsel-unknown-linux-gnu toolchain.
build an Erlang-Runtime with https://github.com/joaohf/meta-erlang and the above mentioned OpenEmbedded build system, then use it directly on your Box.
cross compile D with GDC or LDC (https://wiki.dlang.org/Compilers).
Solutions found, a script like that compile fine
make clean
export TOOLCHAIN=/opt/mipsel-tuxbox-linux-gnu
export PATH=$PATH:/opt/mipsel-tuxbox-linux-gnu/libexec/gcc/mipsel-tuxbox-linux-gnu/4.8.1/:/opt/mipsel-tuxbox-linux-gnu/bin
export LDCFLAGS=/opt/mipsel-tuxbox-linux-gnu/lib
export LD_LIBRARY_PATH=/opt/mipsel-tuxbox-linux-gnu/lib
make CC=mipsel-tuxbox-linux-gnu-gcc LD=mipsel-tuxbox-linux-gnu-ld
How to use SQLite3 library in D language program on Windows?
I found a similar question with Ubuntu, but it didn't work in my case.
import std.stdio, std.string, etc.c.sqlite3;
void main () {
sqlite3* db;
auto ret = sqlite3_open (toStringz("mydb.s3db"), &db);
writeln (ret);
}
As I assume, the sqlite3.d is some kind of header to the real SQLite3 library. I've got an sqlite3.dll, but I have no idea about how to link it with my program. pragma works only with lib formate (like pragma(lib, "sqlite3")).
Maybe I should use the SQLite sources, but how is it possible to compile it together with D code? Or is it better to find some way to convert dll to lib?
What is a general method to solve such problems in D?
Or is it better to find some way to convert dll to lib?
Yes. From the question Statically linking SQLite with DMD (Windows x86), just run the .dll file through implib with the /system switch (linking with the resulting .lib file will still result in dynamic linkage and a dependency on the .dll file).
You can also compile the sqlite source (with modification) using Digital Mars C copmiler which will then give you an object file you can statically link.