Re: Segmentation fault using rsync client on Android device

2019-11-07 Thread Robert Dailey via rsync
So I went through the effort of setting up gdbserver on my Android
device and using gdb to break when a segfault happens. The issue was
because if iconv. Apparently when cross compiling rsync, it
automatically picks up the iconv on the *HOST* system instead of
throwing an error. There's also apparently no explicit method of
telling the configure script where to find a cross-compiled iconv
library, so I had to manipulate CFLAGS / LDFLAGS to get it to work.
Here's the script I ran:

```
RSYNC_VERSION=rsync-3.1.3
download_and_untar $RSYNC_VERSION \
https://rsync.samba.org/ftp/rsync/$RSYNC_VERSION.tar.gz
cd $RSYNC_VERSION

./prepare-source
./configure \
   --prefix=$INSTALL_ROOT/rsync \
   --host=$AUTOCONF_PLATFORM \
   CFLAGS="-I$INSTALL_ROOT/iconv/include $CFLAGS" \
   LDFLAGS="-L$INSTALL_ROOT/iconv/lib $LDFLAGS"
make -j8 && make install
cd -
```

Prior to running the build for rsync, I cross-compiled iconv library
and installed it to `$INSTALL_ROOT/iconv`. From there, all I had to do
was tell rsync (via compiler flags) where to find it. I think an
option to autoconf would be better, something like
`--with-iconv=$INSTALL_ROOT/iconv` so it knows where to find the
includes & libs.

I'm able to run rsync on my device now without crashes.

On Tue, Nov 5, 2019 at 3:29 PM Robert Dailey  wrote:
>
> I've compiled rsync for my rooted Android (armeabi-v7a, 32-bit) device
> using these instructions:
>
> ```
> clone_or_update rsync master git://git.samba.org/rsync.git
> cd rsync
> ./prepare-source
> ./configure \
>--prefix=$INSTALL_ROOT/rsync \
>--host=$AUTOCONF_PLATFORM \
>CFLAGS="$CFLAGS -static"
> make -j8 && make install
> cd -
> ```
>
> Best place for instructions to build I could find were here:
> https://stackoverflow.com/a/18032833/157971
>
> I didn't get any compiler or linker errors. It seemed to work.
>
> I copied the `bin/rsync` executable to the device in the `/data`
> directory. I then executed this command:
>
> ```
> ./rsync - --stats --progress -rdt rsync://192.168.1.205:12000
> ```
>
> I get this output:
>
> ```
> opening tcp connection to 192.168.1.205 port 12000
> Connected to 192.168.1.205 (192.168.1.205)
> Segmentation fault
> ```
>
> Not much to go on. I tried running the same command via rsync in
> cygwin and it worked fine:
>
> ```
> FILE_STRUCT_LEN=24, EXTRA_LEN=4
> opening tcp connection to 192.168.1.205 port 12000
> Connected to 192.168.1.205 (192.168.1.205)
> msg checking charset: UTF-8
> sending daemon args: --server --sender -tre.iLsfxC . /  (5 args)
> ziosk   Ziosk Content Files
> ```
>
> Can anyone help me understand why rsync is crashing on Android? Note
> that I compiled rsync using the Android NDK (r20). I set up the
> environment (CC, LD, etc) to point to the correct toolchain in the
> NDK. It's how I build all of my third party libraries as well, so I
> know at least as far as the environment goes, it's all set up
> correctly.
>
> Are there dependencies missing that could cause this problem? I did
> not provide any dependencies to rsync when I compiled it.
>
> Thanks in advance for any help. I'm stuck.

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Segmentation fault using rsync client on Android device

2019-11-05 Thread Robert Dailey via rsync
I've compiled rsync for my rooted Android (armeabi-v7a, 32-bit) device
using these instructions:

```
clone_or_update rsync master git://git.samba.org/rsync.git
cd rsync
./prepare-source
./configure \
   --prefix=$INSTALL_ROOT/rsync \
   --host=$AUTOCONF_PLATFORM \
   CFLAGS="$CFLAGS -static"
make -j8 && make install
cd -
```

Best place for instructions to build I could find were here:
https://stackoverflow.com/a/18032833/157971

I didn't get any compiler or linker errors. It seemed to work.

I copied the `bin/rsync` executable to the device in the `/data`
directory. I then executed this command:

```
./rsync - --stats --progress -rdt rsync://192.168.1.205:12000
```

I get this output:

```
opening tcp connection to 192.168.1.205 port 12000
Connected to 192.168.1.205 (192.168.1.205)
Segmentation fault
```

Not much to go on. I tried running the same command via rsync in
cygwin and it worked fine:

```
FILE_STRUCT_LEN=24, EXTRA_LEN=4
opening tcp connection to 192.168.1.205 port 12000
Connected to 192.168.1.205 (192.168.1.205)
msg checking charset: UTF-8
sending daemon args: --server --sender -tre.iLsfxC . /  (5 args)
ziosk   Ziosk Content Files
```

Can anyone help me understand why rsync is crashing on Android? Note
that I compiled rsync using the Android NDK (r20). I set up the
environment (CC, LD, etc) to point to the correct toolchain in the
NDK. It's how I build all of my third party libraries as well, so I
know at least as far as the environment goes, it's all set up
correctly.

Are there dependencies missing that could cause this problem? I did
not provide any dependencies to rsync when I compiled it.

Thanks in advance for any help. I'm stuck.

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html