NyaMisty / AltServer-Linux

AltServer for AltStore, but on-device
GNU Affero General Public License v3.0
997 stars 75 forks source link

error for load so file on openwrt #91

Open zanjie1999 opened 1 year ago

zanjie1999 commented 1 year ago

j4125 with x64 openwrt

i dont know what need to opkg install

./AltServer-x86_64 No argument supplied, if you want for help, please use -h or --help Not supplying ipa, running in server mode! Running python3 command to advertise AltServer: from ctypes import *; dll = CDLL('libdns_sd.so'); sdRef = c_int(); flags = 0; interfaceIndex = 0; name = None; regtype = br'_altserver._tcp'; domain = None; host = None; port = 5518; txtLen = 17; txtRecord = b'\x10\x73\x65\x72\x76\x65\x72\x49\x44\x3D\x31\x32\x33\x34\x35\x36\x37'; ret = dll.DNSServiceRegister(byref(sdRef), flags, interfaceIndex, name, regtype, domain, host, port, txtLen, txtRecord, None, None); print('DNSServiceRegister result: %d' % ret); from threading import Event; Event().wait(); Traceback (most recent call last): File "<string>", line 1, in <module> File "/usr/lib/python3.9/ctypes/__init__.py", line 374, in __init__ OSError: Error loading shared library: No such libdns_sd.sofile or directory

and i try to install libavahi-compat-libdnssd

with:

Configuring libexpat. Configuring libdbus. Configuring dbus. Configuring libavahi-dbus-support. Configuring libdaemon. Configuring avahi-dbus-daemon. Configuring libavahi-client. Configuring libavahi-compat-libdnssd.

then i get

. /AltServer-x86_64 No argument supplied, if you want for help, please use -h or --help Not supplying ipa, running in server mode! Running python3 command to advertise AltServer: from ctypes import *; dll = CDLL('libdns_sd.so'); sdRef = c_int(); flags = 0; interfaceIndex = 0; name = None; regtype = br'_altserver._tcp'; domain = None; host = None; port = 13269; txtLen = 17; txtRecord = b'\x10\x73\x65\x72\x76\x65\x72\x49\x44\x3D\x31\x32\x33\x34\x35\x36\x37'; ret = dll.DNSServiceRegister(byref(sdRef), flags, interfaceIndex, name, regtype, domain, host, port, txtLen, txtRecord, None, None); print('DNSServiceRegister result: %d' % ret); from threading import Event; Event().wait(); *** WARNING *** The program 'python3.9' uses the Apple Bonjour compatibility layer of Avahi. *** WARNING *** Please fix your application to use the native API of Avahi! *** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html> DNSServiceRegister result: -65537

2xsaiko commented 1 year ago

Getting the same error trying to package this for NixOS:

No argument supplied, if you want for help, please use -h or --help
Not supplying ipa, running in server mode!
Running /nix/store/rpri9nb8xpwwqakyrqbg8zdslkjs2hd3-python3-3.10.11/bin/python command to advertise AltServer: from ctypes import *; dll = CDLL('/nix/store/m4qax5fxdfsgwn73k792zrdljfr61lsk-avahi-compat-0.8/lib/libdns_sd.so'); sdRef = c_int(); flags = 0; interfaceIndex = 0; name = None; regtype = br'_altserver._tcp'; domain = None; host = None; port = 59336; txtLen = 17; txtRecord = b'\x10\x73\x65\x72\x76\x65\x72\x49\x44\x3D\x31\x32\x33\x34\x35\x36\x37'; ret = dll.DNSServiceRegister(byref(sdRef), flags, interfaceIndex, name, regtype, domain, host, port, txtLen, txtRecord, None, None); print('DNSServiceRegister result: %d' % ret); from threading import Event; Event().wait(); 
*** WARNING *** The program 'python3.10' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
DNSServiceRegister result: -65537

Error -65537 is kDNSServiceErr_Unknown, which is returned in this function when the sdref_new call here fails. sdref_new has multiple failure points but it's all avahi calls. I'm not familiar with the library and strace doesn't really tell me anything so I might need to debug it. Maybe it's also worth trying to rewrite this part against the native avahi API.

2xsaiko commented 1 year ago

After hours of debugging, I found out that you need to set this in the avahi-daemon config.

[publish]
disable-publishing=no
disable-user-service-publishing=no
jul1u5 commented 1 year ago

Hi @2xsaiko, I am also under NixOS, was wondering how you build the project?

I am getting this error:

AppleAPI+Authentication.cpp:9:10: fatal error: 'corecrypto/ccsrp.h' file not found
#include <corecrypto/ccsrp.h>
         ^~~~~~~~~~~~~~~~~~~~

Not sure how to include this header file. It seems to be in the darwin.Security package, but I can't build it on a Linux system, I think. Do you cross-compile it somehow?

2xsaiko commented 1 year ago

I have it packaged (including dependencies) in my flake here: https://git.dblsaiko.net/systems/tree/packages/misc/altserver/default.nix

corecrypto is available from https://developer.apple.com/security/

nix build git+https://git.dblsaiko.net/systems#altserver

jul1u5 commented 1 year ago

Very cool, thanks a lot!

2xsaiko commented 1 year ago

@jul1u5 I just moved all packages and standalone modules to sourcehut:~dblsaiko/nix-extras, so if you're using the package/overlay, make sure to switch to that flake. There's also a NixOS module for AltServer in there if it's useful to you.

(If you want to reply something, please do via email instead of here, I don't want to spam this issue any more haha)