Re: [racket-dev] Building Racket 8.2 on Termux/Android

2021-10-19 Thread wesley bitomski
Thanks! The Termux docs did mention that dlopen was "different":

> Symbol visibility when opening shared libraries using dlopen() works
differently. On a normal linker, when an executable linking against a
shared library libA dlopen():s another shared library libB, the symbols of
libA are exposed to libB without libB needing to link against libA
explicitly. This does not work with the Android linker, which can break
plug-in systems where the main executable dlopen():s a plug-in which does
not explicitly link against some shared libraries already linked to by the
executable. See the relevant NDK issue
 for more information.

I have no qualms about digging around in the sources. I was sort of hoping
I'd have to do that.

Anyway, removing the noted vesdigital code just caused a failure in
ffi/unsafe, specifically in the body of get-ffi-obj*. I'll start messing
around with linker flags tomorrow.


On Tue, Oct 19, 2021, 19:37 Matthew Flatt  wrote:

> At Tue, 19 Oct 2021 16:25:33 -0700 (PDT), Wesley Bitomski wrote:
> > ffi-lib: could not load foreign library
> >   path: [all opened]
> >   system error: unknown error
>
> The "[all opened]" here means that
>
>  (define libmz (ffi-lib #f))
>
> failed in "racket/collects/openssl/mzssl.rkt".
>
> That line, plus
>
>  (define-ffi-definer define-mzscheme libmz)
>
> are leftovers that can just be removed, and I'll get rid of them.
>
> If deleting those lines is not an option for some reason, or in case
> you run into the same problem somewhere else: I think the cause of the
> underlying error is a `dlopen` call with `NULL` as its first argument.
> Unless that's just disallowed on Android, you might be able to work
> around the problem with a linker flag like `-rdynamic`.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/CAF-8S4FN5WCiwJNueWVHijzS-JQ7ZqxwyycnUvoJJhxW65iNbg%40mail.gmail.com.


Re: [racket-dev] Building Racket 8.2 on Termux/Android

2021-10-19 Thread Matthew Flatt
At Tue, 19 Oct 2021 16:25:33 -0700 (PDT), Wesley Bitomski wrote:
> ffi-lib: could not load foreign library
>   path: [all opened] 
>   system error: unknown error

The "[all opened]" here means that

 (define libmz (ffi-lib #f))

failed in "racket/collects/openssl/mzssl.rkt".

That line, plus

 (define-ffi-definer define-mzscheme libmz)

are leftovers that can just be removed, and I'll get rid of them.

If deleting those lines is not an option for some reason, or in case
you run into the same problem somewhere else: I think the cause of the
underlying error is a `dlopen` call with `NULL` as its first argument.
Unless that's just disallowed on Android, you might be able to work
around the problem with a linker flag like `-rdynamic`.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/20211019173705.398%40sirmail.smtps.cs.utah.edu.


[racket-dev] Building Racket 8.2 on Termux/Android

2021-10-19 Thread Wesley Bitomski
OK. I'm pretty deep in this rabbithole, but forgive me if I'm skipping some 
details.

I've spent a good portion of yesterday, and a unreasonable chunk of today, 
trying to build Racket for aarch64 on Android using Termux for the build 
environment (yes, I'm building this on the target (a phone), so no 
cross-compilation shenanigans). Recently, I've been able to reliably 
produce a working `racket` binary, but `raco` fails to build on account of 
`ffi-lib` not being able to find where the system libraries are (this is 
what I think is happening).

So, question: how to I point out where the system libs live in such that 
ffi-lib can find them?

Steps to reproduce:
0. download source bundle with prebuilt packages 
(downloads.racket-lang.org).
1. run configure from tarball root: `src/configure --enable-csonly 
--enable-sysroot=$PREFIX --prefix=$PREFIX --exec-prefix=$PREFIX`
2. `make` -- works flawlessly
3. `make install` -- errors:
make[4]: Entering directory 
'/data/data/com.termux/files/home/racket-8.2/cs/c'
/data/data/com.termux/files/usr/bin/racket -Z ../../../../../build/config 
-X "/data/data/com.termux/files/usr/share/racket/collects" -G 
"/data/data/com.termux/files/usr/etc/racket"  -Z 
../../../../../build/config  -N "raco" -l- setup 
--no-user   
  

ffi-lib: could not load foreign library
  path: [all opened] 
  system error: unknown error
  
context...: 
 
body of 
"/data/data/com.termux/files/usr/share/racket/collects/openssl/mzssl.rkt"   

body of 
"/data/data/com.termux/files/usr/share/racket/collects/setup/main.rkt"
4. Hypothesis: ffi-lib can't find libssl, located in $PREFIX/lib. `raco` 
needs this to securely communicate with package catalogs.
5. Result: no `raco`, but `racket` works just fine.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/f6f931d9-d67b-494b-ace0-c8692358c691n%40googlegroups.com.