Building ndk under cygwin

88 views
Skip to first unread message

Dmitry.Skiba

unread,
Nov 7, 2009, 11:19:50 AM11/7/09
to android-ndk
Is ndk supposed to build under cygwin?
I hope I'm doing something wrong, because it is my first attempt to
build something that big.
So, I downloaded android-ndk-toolchain-20090323.tar.bz2 and unpacked
it to NDK\out\arm-eabi-4.2.1\toolchain\src. Then I commented out calls
to download_package and unpack_package in build-toolchain.sh

And build failed at pex-unix.c:

pex-unix.c: In function `pex_wait':
pex-unix.c:223: warning: implicit declaration of function `wait'
pex-unix.c: At top level:
pex-unix.c:356: warning: function declaration isn't a prototype
pex-unix.c: In function `pex_unix_exec_child':
pex-unix.c:375: warning: implicit declaration of function `fork'
pex-unix.c:378: warning: implicit declaration of function `sleep'
pex-unix.c:428: warning: passing arg 2 of `execvp' from incompatible
pointer type
pex-unix.c:433: warning: passing arg 2 of `execv' from incompatible
pointer type
pex-unix.c: In function `pex_unix_wait':
pex-unix.c:484: warning: implicit declaration of function `kill'
pex-unix.c: In function `pex_unix_pipe':
pex-unix.c:502: warning: implicit declaration of function `pipe'
pex-unix.c: In function `pex_unix_fdopenw':
pex-unix.c:518: warning: implicit declaration of function `fcntl'
pex-unix.c:518: error: `F_SETFD' undeclared (first use in this
function)
pex-unix.c:518: error: (Each undeclared identifier is reported only
once
pex-unix.c:518: error: for each function it appears in.)
pex-unix.c:518: error: `FD_CLOEXEC' undeclared (first use in this
function)

As I understand fcntl.h and unistd.h were included from usr\include
\mingw32, because of no-cygwin switch in ndk-common.sh? What should I
do to build correctly working ndk?

David Turner

unread,
Nov 7, 2009, 12:18:43 PM11/7/09
to andro...@googlegroups.com
Yes, you should be able to build it under Cygwin. However, please use build/tools/build-toolchain.sh to rebuild the toolchain,
and build/tools/make-release.sh to make a new release package.

These script contain all the voodoo necessary to properly configure / build / install the toolchain binaries and make a decent
package. Trying to build the toolchain yourself is extremely prone to error (though I invite you to experiment if you wish so,
look at what built-toolchain.sh does for hints)

Hope this helps


--

You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.



Dmitry.Skiba

unread,
Nov 7, 2009, 12:44:11 PM11/7/09
to android-ndk
Yes, I'm using build/tools/build-toolchain.sh to build it.
And it seems that I succeeded in building it, after I commented out
setting "-mno-cygwin" to HOST_CFLAGS and HOST_LDFLAGS in ndk-
common.sh.
I guess that it should not be there anyways, because original binaries
(from 1.5) were dependent on cygwin1.dll too.

On 7 ноя, 23:18, David Turner <di...@android.com> wrote:
> Yes, you should be able to build it under Cygwin. However, please use
> build/tools/build-toolchain.sh to rebuild the toolchain,
> and build/tools/make-release.sh to make a new release package.
>
> These script contain all the voodoo necessary to properly configure / build
> / install the toolchain binaries and make a decent
> package. Trying to build the toolchain yourself is extremely prone to error
> (though I invite you to experiment if you wish so,
> look at what built-toolchain.sh does for hints)
>
> Hope this helps
>

David Turner

unread,
Nov 7, 2009, 1:18:13 PM11/7/09
to andro...@googlegroups.com
Yes, the flags are there because I tried to build the binaries without Cygwin dependencies.
Unfortunately, this doesn't work, the configure script don't seem to pass the correct flags
to the sub-configure ones where it matters. All of this is really frisky and annoying.

I hope that some day we'll be able to ditch the Cygwin dependency completely from
the Windows NDK, but we're not there yet.

On the other hand, the script should work with -mno-cygwin if you have the mingw32
packages installed.

Dmitry.Skiba

unread,
Nov 8, 2009, 1:27:10 PM11/8/09
to android-ndk
BTW, I noticed gcc 4.3.1 in toolchain's src, but building it via --
target=arm-eabi-4.3.1 produced 4.2.1 version (arm-eabi-gcc.exe -v in
bin shows that). Can you give me some pointers how to build it?
(Because in the end I want to build my special 4.3.1 version. I will
apply android's patches too, of course).

David Turner

unread,
Nov 9, 2009, 11:44:04 AM11/9/09
to andro...@googlegroups.com
Sorry, I don't know how to build it. The toolchain scripts are a maze of nasty little passages with booby traps everywhere.
You will have to experiment with the various configure scripts.

Dmitry.Skiba

unread,
Nov 11, 2009, 7:53:19 AM11/11/09
to android-ndk
Ok, I build it! :)
But I have a question - is 4.3.1 patched enough to produce valid
binaries for android? I mean, I tried it and at a first glance
everything works. But README.android for 4.3.1 shows that last
modification was on 2009-02-20, while 4.2.1 was last modified on
2009-03-19. Also 4.2.1 is used by default, should I take it as an
indication that there are problems with 4.3.1?

On 9 ноя, 22:44, David Turner <di...@android.com> wrote:
> Sorry, I don't know how to build it. The toolchain scripts are a maze of
> nasty little passages with booby traps everywhere.
> You will have to experiment with the various configure scripts.
>
Reply all
Reply to author
Forward
0 new messages