enwi / dartzmq

A simple dart zeromq implementation/wrapper around the libzmq C++ library
https://pub.dev/documentation/dartzmq/latest/
MIT License
26 stars 17 forks source link

run in android failed. #1

Closed gaobaiq closed 2 years ago

gaobaiq commented 2 years ago

Failed to load dynamic library 'liblibzmq-v142-mt-4_3_5.so': dlopen failed: library "liblibzmq-v142-mt-4_3_5.so" not found

enwi commented 2 years ago

For Android you need to support libzmq yourself. I have made some changes (which are not published yet), which support other dll/lib names other than liblibzmq-v142-mt-4_3_5 (e.g. libzmq).

But essentially you need to follow these steps, which will get you a libzmq.so. Which you need to include in your project following these steps

enwi commented 2 years ago

I hope to get a new version out, where the mentioned steps are not needed anymore

gaobaiq commented 2 years ago

Very good. I'm trying to do the same. Now I build an so file and try to run the project.

enwi commented 2 years ago

Very good. I'm trying to do the same. Now I build an so file and try to run the project.

Also for now you will need to rename libzmq.so to libzmq-v142-mt-4_3_5.so

gaobaiq commented 2 years ago

Very good. I'm trying to do the same. Now I build an so file and try to run the project.

Also for now you will need to rename libzmq.so to libzmq-v142-mt-4_3_5.so

yes,i did.

enwi commented 2 years ago

@gaobaiq I have pushed/released a new version, which has some changes and also adresses an issue with loading the share library. Now it should be possible to just have the library named libzmq.so

gaobaiq commented 2 years ago

@gaobaiq I have pushed/released a new version, which has some changes and also adresses an issue with loading the share library. Now it should be possible to just have the library named libzmq.so

It's so beautiful.I also want to run my project and share it with you later.

enwi commented 2 years ago

Does it work for you? I am also trying to get a simple example running on Android, but it does not find/load the native library

enwi commented 2 years ago

Ahh so it seems libc++_shared.so is also needed for this to work https://developer.android.com/ndk/guides/cpp-support#shared_runtimes

enwi commented 2 years ago

Luckily the Android ndk includes compiled versions of these for all platforms

gaobaiq commented 2 years ago

Ahh so it seems libc++_shared.so is also needed for this to work https://developer.android.com/ndk/guides/cpp-support#shared_runtimes

I failed to build so.

enwi commented 2 years ago

Ahh so it seems libc++_shared.so is also needed for this to work https://developer.android.com/ndk/guides/cpp-support#shared_runtimes

I failed to build so.

You don't have to. There are compiled versions of it inside the ndk (ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib)

gaobaiq commented 2 years ago

You don't have to. There are compiled versions of it inside the ndk (ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\lib)

I have many problems compiling with r23

enwi commented 2 years ago

Ohh gotcha, you need to use r21e for now, newer versions are not supported (https://github.com/zeromq/libzmq/issues/4276)

gaobaiq commented 2 years ago

Ohh gotcha, you need to use r21e for now, newer versions are not supported (zeromq/libzmq#4276)

OKey, i try it. thx!

gaobaiq commented 2 years ago

Do you have a compiled so file? Can you share it? My email is baiqianggao@gmail.com or gaobaiqandroid@126.com

enwi commented 2 years ago

This zip includes all needed files for android native-libraries.zip

gaobaiq commented 2 years ago

Ok, thanks!

enwi commented 2 years ago

Does it work now?

enwi commented 2 years ago

I also just noticed that my compiled version of libzmq does not have support for pgm, tipc, norm, curve, gssapi and draft, but for ipc. So I will have to compile with curv support again (because I need it). I also implemented the zmq_has function so this can be checked during run-time.

gaobaiq commented 2 years ago

Yes, I also found that the so file you provided does not support the TiCP protocol. And I also tried to run it with my own compiled so file, but it also failed.Now I'm trying to deal with it.

enwi commented 2 years ago

I also have no clue how to get it to compile with support for pgm, tipc, norm, gssapi and draft. But lets see what the curve binary has to offer

gaobaiq commented 2 years ago

I also have no clue how to get it to compile with support for pgm, tipc, norm, gssapi and draft. But lets see what the curve binary has to offer

Yes, we can start with this

enwi commented 2 years ago

As you might have noticed I released a new version, now containing checks for different capabilities. Also my new shared binary just has curve support. No pgm, tipc, norm, gssapi and draft.

enwi commented 2 years ago

@gaobaiq Do you really need tipc on a mobile platform/Android? I don't see the use case there

gaobaiq commented 2 years ago

@gaobaiq Do you really need tipc on a mobile platform/Android? I don't see the use case there

The company happened to have this server, so I tried it.

enwi commented 2 years ago

But isn't tipc used for interprocess cluster communication? I would say that you would use a normal tcp socket for communication with your frontend/app

gaobaiq commented 2 years ago

Yes, there is no problem with TCP, but I happen to have a scene that needs it. And I can't use it now.

enwi commented 2 years ago

@gaobaiq So I can close this issue now? I think you will have to figure out how to get a compiled version with tipc yourself. If you manage to get it working I would be happy if you could share your findings. Then I can include them in the readme for others.