Cross compiling build instructions

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Cross compiling build instructions

Robert Dailey-2
Hello,

I am trying to cross-compile the subversion library for Android using
the Android NDK. I have the toolchain properly set up, I think, but
I'm getting a strange error during `./configure`:

```
checking build system type... x86_64-unknown-linux-gnu
checking host system type... configure: error: /bin/bash
build/config.sub --prefix=/_install/armeabi-v7a/subversion failed
configure: WARNING: cache variable ac_cv_host contains a newline
```

I'm not sure how to interpret this error message. Here is how I'm
running the configure command:

```
./configure --host --prefix=/_install/armeabi-v7a/subversion
--with-zlib=/_install/armeabi-v7a/zlib
```

I dug around in the subversion tarball for instructions more specific
to building in a cross-compiled environment, but I did not find
anything. Would the developers be so kind as to guide me to the
information required to get a working build?

My goal is to compile static libraries for the SVN client library so I
can check out code on an ARM device from my own C++ code base. Thanks
in advance.
Reply | Threaded
Open this post in threaded view
|

Re: Cross compiling build instructions

Julian Foad-5
Robert Dailey wrote:
> I am trying to cross-compile the subversion library for Android using
> the Android NDK.

I would love to see a successful Android build of svn client (and/or of
a svn server).

Just to set your expectations: as far as I am aware, nobody has
previously been talking about it here.

(The only FOSS Android svn client I know of is the still functioning but
primitive and long-abandoned "OASVN" [1][2] which, IIRC is built on (an
old version of) SvnKit rather than on the svn C libraries.)

[1] https://github.com/briangormanly/oasvn
[2] https://play.google.com/store/apps/details?id=com.valleytg.oasvn.android

> I have the toolchain properly set up, I think, but
> I'm getting a strange error during `./configure`:
>
> ```
> checking build system type... x86_64-unknown-linux-gnu
> checking host system type... configure: error: /bin/bash
> build/config.sub --prefix=/_install/armeabi-v7a/subversion failed
> configure: WARNING: cache variable ac_cv_host contains a newline
> ```

Seems likely we should be able to diagnose that.

> I'm not sure how to interpret this error message. Here is how I'm
> running the configure command:
>
> ```
> ./configure --host --prefix=/_install/armeabi-v7a/subversion
> --with-zlib=/_install/armeabi-v7a/zlib
> ```

Don't you need to specify "--host=<SOMETHING>" rather than just "--host"?

Yes... My quick test on Linux gives the same error you see.  It is
interpreting "--prefix=/_install/armeabi-v7a/subversion" as the host
name argument to the "--host" option.  :-)

- Julian
Reply | Threaded
Open this post in threaded view
|

Re: Cross compiling build instructions

Nathan Hartman
In reply to this post by Robert Dailey-2
On Tue, Oct 15, 2019 at 4:00 PM Robert Dailey <[hidden email]> wrote:
> I am trying to cross-compile the subversion library for Android using
> the Android NDK.

Hello Robert,

Were you successful in getting the SVN client library to build?

Thanks
Nathan
Reply | Threaded
Open this post in threaded view
|

Re: Cross compiling build instructions

Robert Dailey-2
On Thu, Oct 17, 2019 at 10:34 AM Nathan Hartman
<[hidden email]> wrote:
> Hello Robert,
>
> Were you successful in getting the SVN client library to build?

Hey Nathan,

Sorry for the late response. No, I eventually got a bit further but I
am thinking I might give up. The end goal is to compile Subversion
client lib in my product but there are so many dependencies that I
could spend weeks on this and probably still not have it working. I
just don't have that kind of time. My feeling at this point is that
the lion's share of the problems are build-system related, rather than
code. The build system does not appear to be well implemented for
cross compilation support. So far this is what I have:

```
# Useful links:
#   - https://stackoverflow.com/a/1605497
compile_apache_lib() {
    library=$1
    version=$2
    package=$library-$version

    clone_or_update $library trunk https://github.com/apache/${library}.git
    cd $library
    #download_and_untar $package \
    #    http://mirror.metrocast.net/apache/${library}/${package}.tar.gz
    #cd $package

    autoconf && ./configure \
        --prefix=$INSTALL_DIR/apache \
        --host=${TOOLCHAIN_COMPILER_PREFIX} \
        --disable-shared \
        --enable-static \
        ac_cv_file__dev_zero="yes" \
        ac_cv_func_setpgrp_void="yes" \
        apr_cv_process_shared_works="yes" \
        apr_cv_mutex_robust_shared="no" \
        apr_cv_tcp_nodelay_with_cork="yes" \
        ac_cv_sizeof_struct_iovec="8" \
        apr_cv_mutex_recursive="yes" \
        "${@:3}"

    # make -j8 && make install
}

compile_apache_lib apr 1.7.0 \
    --with-libxml2=/usr
```

I tried with trunk, and I tried with the latest released version. I
got neither working. I just keep hitting problem after problem. Add
onto this that I'm horribly unfamiliar with makefiles and autoconf.
Reply | Threaded
Open this post in threaded view
|

Re: Cross compiling build instructions

Nathan Hartman
On Fri, Oct 18, 2019 at 11:07 AM Robert Dailey <[hidden email]> wrote:
On Thu, Oct 17, 2019 at 10:34 AM Nathan Hartman
<[hidden email]> wrote:
> Hello Robert,
>
> Were you successful in getting the SVN client library to build?

Hey Nathan,

Sorry for the late response. No, I eventually got a bit further but I
am thinking I might give up. The end goal is to compile Subversion
client lib in my product but there are so many dependencies that I
could spend weeks on this and probably still not have it working. I
just don't have that kind of time. My feeling at this point is that
the lion's share of the problems are build-system related, rather than
code. The build system does not appear to be well implemented for
cross compilation support. So far this is what I have:

[snip] 

I tried with trunk, and I tried with the latest released version. I
got neither working. I just keep hitting problem after problem. Add
onto this that I'm horribly unfamiliar with makefiles and autoconf.

I'm sorry to hear that. That's certainly frustrating. :-(

This might be a dumb question but could you use a native ARM toolchain rather than cross-compiling? I know that depends on having a ARMv7-a device that can run the toolchain, but perhaps that could be achieved with emulation (e.g., QEMU).

Just a thought...

Reply | Threaded
Open this post in threaded view
|

Re: Cross compiling build instructions

Robert Dailey-2
On Fri, Oct 18, 2019 at 10:19 AM Nathan Hartman
<[hidden email]> wrote:
> I'm sorry to hear that. That's certainly frustrating. :-(
>
> This might be a dumb question but could you use a native ARM toolchain rather than cross-compiling? I know that depends on having a ARMv7-a device that can run the toolchain, but perhaps that could be achieved with emulation (e.g., QEMU).
>
> Just a thought...

Sadly, no. Android isn't running on native ARM. The sysroot is
completely different, and the Android NDK changes the c & C++ standard
libs to be compatible with different Android OS versions. It's really
complicated from what little I know.

If the intent is for the code to function in an Android environment,
the only option is cross compiling via Android NDK. Literally every
other OSS library we use can be built this way. OpenSSL, Boost, etc.

It's not the answer the developers want to hear, I'm sure, but the
build system just needs to be fixed. But of course, if there's rarely
a use case for SVN on Android, then there may not be much of a case to
make it a priority or worth the effort. That's likely the status quo.
Reply | Threaded
Open this post in threaded view
|

Re: Cross compiling build instructions

Nathan Hartman
On Fri, Oct 18, 2019 at 1:55 PM Robert Dailey <[hidden email]> wrote:
> This might be a dumb question but could you use a native ARM toolchain rather than cross-compiling? I know that depends on having a ARMv7-a device that can run the toolchain, but perhaps that could be achieved with emulation (e.g., QEMU).
>
> Just a thought...

Sadly, no. Android isn't running on native ARM. The sysroot is
completely different, and the Android NDK changes the c & C++ standard
libs to be compatible with different Android OS versions. It's really
complicated from what little I know.

If the intent is for the code to function in an Android environment,
the only option is cross compiling via Android NDK. Literally every
other OSS library we use can be built this way. OpenSSL, Boost, etc.

It's not the answer the developers want to hear, I'm sure, but the
build system just needs to be fixed. But of course, if there's rarely
a use case for SVN on Android, then there may not be much of a case to
make it a priority or worth the effort. That's likely the status quo.
I think there is a use case for SVN on Android and iOS, namely native apps to monitor repositories, view and make changes, etc. I have wished for such an app myself and haven't found one I like.

It has to be possible to build the sources without the build system. Perhaps in an IDE project, if NDK comes with an IDE?

Maybe someone who knows more about cross compiling and/or building without './configure && make' would like to comment? I know we aren't using this build system on Windows.

Nathan 


Reply | Threaded
Open this post in threaded view
|

Re: Cross compiling build instructions

Robert Dailey-2
On Fri, Oct 18, 2019 at 1:26 PM Nathan Hartman <[hidden email]> wrote:
> I think there is a use case for SVN on Android and iOS, namely native apps to monitor repositories, view and make changes, etc. I have wished for such an app myself and haven't found one I like.
>
> It has to be possible to build the sources without the build system. Perhaps in an IDE project, if NDK comes with an IDE?
>
> Maybe someone who knows more about cross compiling and/or building without './configure && make' would like to comment? I know we aren't using this build system on Windows.

CMake is really versatile and great for cross compiling. I see that
some repos use it (like libapr) but not subversion itself. If SVN +
all apache dependencies used CMake and it all tied together, then
cross compilation is a non-issue. The Android NDK comes with a CMake
toolchain file for this purpose. That's the only reasonable solution I
see at this point. But it means that Subversion and potentially more
dependencies need to implement CMake scripts.
Reply | Threaded
Open this post in threaded view
|

Re: Cross compiling build instructions

Nathan Hartman
On Fri, Oct 18, 2019 at 2:40 PM Robert Dailey <[hidden email]> wrote:
On Fri, Oct 18, 2019 at 1:26 PM Nathan Hartman <[hidden email]> wrote:
> I think there is a use case for SVN on Android and iOS, namely native apps to monitor repositories, view and make changes, etc. I have wished for such an app myself and haven't found one I like.
>
> It has to be possible to build the sources without the build system. Perhaps in an IDE project, if NDK comes with an IDE?
>
> Maybe someone who knows more about cross compiling and/or building without './configure && make' would like to comment? I know we aren't using this build system on Windows.

CMake is really versatile and great for cross compiling. I see that
some repos use it (like libapr) but not subversion itself. If SVN +
all apache dependencies used CMake and it all tied together, then
cross compilation is a non-issue. The Android NDK comes with a CMake
toolchain file for this purpose. That's the only reasonable solution I
see at this point. But it means that Subversion and potentially more
dependencies need to implement CMake scripts.

I'm copying Brane because I recall some mention about CMake. Is it
already being used with the Windows build? But I do not see any
CMakeLists.txt file in trunk, nor a branch that looks like it's for
this purpose. Is CMake being used, and if so how?

Reply | Threaded
Open this post in threaded view
|

Re: Cross compiling build instructions

Branko Čibej
On 18.10.2019 21:39, Nathan Hartman wrote:
On Fri, Oct 18, 2019 at 2:40 PM Robert Dailey <[hidden email]> wrote:
On Fri, Oct 18, 2019 at 1:26 PM Nathan Hartman <[hidden email]> wrote:
> I think there is a use case for SVN on Android and iOS, namely native apps to monitor repositories, view and make changes, etc. I have wished for such an app myself and haven't found one I like.
>
> It has to be possible to build the sources without the build system. Perhaps in an IDE project, if NDK comes with an IDE?
>
> Maybe someone who knows more about cross compiling and/or building without './configure && make' would like to comment? I know we aren't using this build system on Windows.

CMake is really versatile and great for cross compiling. I see that
some repos use it (like libapr) but not subversion itself. If SVN +
all apache dependencies used CMake and it all tied together, then
cross compilation is a non-issue. The Android NDK comes with a CMake
toolchain file for this purpose. That's the only reasonable solution I
see at this point. But it means that Subversion and potentially more
dependencies need to implement CMake scripts.

I'm copying Brane because I recall some mention about CMake. Is it
already being used with the Windows build? But I do not see any
CMakeLists.txt file in trunk, nor a branch that looks like it's for
this purpose. Is CMake being used, and if so how?

You're probably confusing Subversion and Serf -- I added a CMake build for Serf a while ago (yes, yes, not released yet). AFAIK no-one has yet attempted anything like that for Subversion.

-- Brane

Reply | Threaded
Open this post in threaded view
|

Re: Cross compiling build instructions

Nathan Hartman
On Fri, Oct 18, 2019 at 5:00 PM Branko Čibej <[hidden email]> wrote:
> On 18.10.2019 21:39, Nathan Hartman wrote:
>> On Fri, Oct 18, 2019 at 2:40 PM Robert Dailey <[hidden email]> wrote:
>>> CMake is really versatile and great for cross compiling.
>>>
>> I'm copying Brane because I recall some mention about CMake. Is it
>> already being used with the Windows build? But I do not see any
>> CMakeLists.txt file in trunk, nor a branch that looks like it's for
>> this purpose. Is CMake being used, and if so how? 
>
> You're probably confusing Subversion and Serf -- I added a CMake
> build for Serf a while ago (yes, yes, not released yet). AFAIK
> no-one has yet attempted anything like that for Subversion.

Thanks.

I did remember some mention of CMake but not when / where or in
regards to what.