public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Build a cross compiler for Android target (arm)
@ 2011-10-15  9:41 BERTRAND Joel
  2011-10-17  6:33 ` Kai Ruottu
  0 siblings, 1 reply; 6+ messages in thread
From: BERTRAND Joel @ 2011-10-15  9:41 UTC (permalink / raw)
  To: gcc-help

	Hello,

	I'm trying to build a cross compiler for Android target as I want to 
obtain a Fortran compiler.

	I have downloaded gcc-4.6.1 sources and configured build tree with :

   $ ../gcc-4.6.1/configure 
--prefix=/home/bertrand/android/ndk/compilers --disable-libquadmath 
--target=arm-android-eabi --with-gnu-as --with-gnu-ld 
--enable-languages=c,c++,fortran 
--with-mpfr=/home/bertrand/android/ndk/compilers 
--with-gmp=/home/bertrand/android/ndk/compilers 
--with-mpc=/home/bertrand/android/ndk/compilers --disable-libssp 
--enable-threads --disable-nls --disable-libgomp --disable-shared 
--disable-tls --with-float=soft --with-fpu=vfp --with-arch=armv5te 
--enable-target-optspace 
--with-sysroot=/home/bertrand/android/ndk/sysroot/ 
--host=x86_64-unknown-linux-gnu

	Of course, I have installed android ndk to have sysroot.
Build process stops with :

checking whether the 
/home/bertrand/android/ndk/compilers/gcc-build/./gcc/xgcc 
-B/home/bertrand/android/ndk/compilers/gcc-build/./gcc/ 
-B/home/bertrand/android/ndk/compilers/arm-android-eabi/bin/ 
-B/home/bertrand/android/ndk/compilers/arm-android-eabi/lib/ -isystem 
/home/bertrand/android/ndk/compilers/arm-android-eabi/include -isystem 
/home/bertrand/android/ndk/compilers/arm-android-eabi/sys-include 
linker (/home/bertrand/android/ndk/compilers/gcc-build/./gcc/collect-ld) 
supports shared libraries... yes
checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
checking for shl_load... configure: error: Link tests are not allowed 
after GCC_NO_EXECUTABLES.
make[1]: *** [configure-target-libstdc++-v3] Erreur 1
make[1]: quittant le répertoire « 
/home/bertrand/android/android-ndk-r6b/compilers/gcc-build »
make: *** [all] Erreur 2

	Faulty config.log contains :

configure:9038: checking whether the 
/home/bertrand/android/ndk/compilers/gcc-build/./gcc/xgcc 
-B/home/bertrand/android/ndk/compilers/gcc-build/./gcc/ 
-B/home/bertrand/android/ndk/compilers/arm-android-eabi/bin/ 
-B/home/bertrand/android/ndk/compilers/arm-android-eabi/lib/ -isystem 
/home/bertrand/android/ndk/compilers/arm-android-eabi/include -isystem 
/home/bertrand/android/ndk/compilers/arm-android-eabi/sys-include 
linker (/home/bertrand/android/ndk/compilers/gcc-build/./gcc/collect-ld) 
supports shared libraries
configure:10118: result: yes
configure:10363: checking dynamic linker characteristics
configure:11039: result: no
configure:11146: checking how to hardcode library paths into programs
configure:11171: result: immediate
configure:11268: checking for shl_load
configure:11268: error: Link tests are not allowed after GCC_NO_EXECUTABLES.

	I have found several posts with google, but no one gives me a solution. 
If I add --disable-libstdc__-v3 from configure command line, I obtain 
running C and Fortran compilers, but C++ compiler is not able to compile 
any program that uses standard libc++.

	Any idea ?

	Regards,

	JKB

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Build a cross compiler for Android target (arm)
  2011-10-15  9:41 Build a cross compiler for Android target (arm) BERTRAND Joel
@ 2011-10-17  6:33 ` Kai Ruottu
  2011-10-17  6:45   ` Jeffrey Walton
  2011-10-17  7:44   ` BERTRAND Joel
  0 siblings, 2 replies; 6+ messages in thread
From: Kai Ruottu @ 2011-10-17  6:33 UTC (permalink / raw)
  To: gcc-help

15.10.2011 12:41, BERTRAND Joel kirjoitti:

> I'm trying to build a cross compiler for Android target as I want to
> obtain a Fortran compiler.
>
> Of course, I have installed android ndk to have sysroot.
> Build process stops with :
>
> checking whether the
> /home/bertrand/android/ndk/compilers/gcc-build/./gcc/xgcc
> -B/home/bertrand/android/ndk/compilers/gcc-build/./gcc/
> -B/home/bertrand/android/ndk/compilers/arm-android-eabi/bin/
> -B/home/bertrand/android/ndk/compilers/arm-android-eabi/lib/ -isystem
> /home/bertrand/android/ndk/compilers/arm-android-eabi/include -isystem
> /home/bertrand/android/ndk/compilers/arm-android-eabi/sys-include linker
> (/home/bertrand/android/ndk/compilers/gcc-build/./gcc/collect-ld)
> supports shared libraries... yes
> checking dynamic linker characteristics... no
> checking how to hardcode library paths into programs... immediate
> checking for shl_load... configure: error: Link tests are not allowed
> after GCC_NO_EXECUTABLES.
> make[1]: *** [configure-target-libstdc++-v3] Erreur 1

Ok, you have the GCC binaries ready (in $build/gcc) and also
libgcc (in $build/libgcc) and then your build crashes when
trying to configure libstdc++-v3 ... The C parts are OK, but
getting the C++ library fails. So what would be the sane
reaction in this situation?

For me it would be to try to compile and link a simple "Hello
World" app with the new GCC... But maybe Android is too weird
for this, no experience about whether it even supports simple
"console" apps in a terminal window, requiring some really
complex application as that "Hello World".  The very common
Windows 3.1 and its 32-bit extension "Win32s" hadn't any
console for running "text-mode Windows applications" :(

In any case installing only the GCC binaries and the libgcc
happens with :

    make install-gcc
    make install-target-libgcc

after which you can try compiling and linking that "Hello
World" and can see what errors you will get when linking...

The typical mistake is to not allow the self-made gmp, mpfr
or mpc shared libs being found by the new GCC binaries but
then the crash should happen already during the libgcc
configure - that the new 'xgcc' and 'cc1' can be started is
a sanity test there... So a "sanity test for the builder"
could be whether one is capable to try tests like :

     ./xgcc -v
     ./xgcc --help
     ./cc1 --help

in the $build/gcc directory without installing anything
there first, in order to see whether the new GCC executables
can be run in the cross host system...


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Build a cross compiler for Android target (arm)
  2011-10-17  6:33 ` Kai Ruottu
@ 2011-10-17  6:45   ` Jeffrey Walton
       [not found]     ` <4E9BDC91.4010801@systella.fr>
  2011-10-17  8:05     ` BERTRAND Joel
  2011-10-17  7:44   ` BERTRAND Joel
  1 sibling, 2 replies; 6+ messages in thread
From: Jeffrey Walton @ 2011-10-17  6:45 UTC (permalink / raw)
  To: Kai Ruottu; +Cc: gcc-help

On Mon, Oct 17, 2011 at 2:32 AM, Kai Ruottu <kai.ruottu@wippies.com> wrote:
> 15.10.2011 12:41, BERTRAND Joel kirjoitti:
>
>> I'm trying to build a cross compiler for Android target as I want to
>> obtain a Fortran compiler.
>>
>> Of course, I have installed android ndk to have sysroot.
>> Build process stops with :
>>
>> checking whether the
>> /home/bertrand/android/ndk/compilers/gcc-build/./gcc/xgcc
>> -B/home/bertrand/android/ndk/compilers/gcc-build/./gcc/
>> -B/home/bertrand/android/ndk/compilers/arm-android-eabi/bin/
>> -B/home/bertrand/android/ndk/compilers/arm-android-eabi/lib/ -isystem
>> /home/bertrand/android/ndk/compilers/arm-android-eabi/include -isystem
>> /home/bertrand/android/ndk/compilers/arm-android-eabi/sys-include linker
>> (/home/bertrand/android/ndk/compilers/gcc-build/./gcc/collect-ld)
>> supports shared libraries... yes
>> checking dynamic linker characteristics... no
>> checking how to hardcode library paths into programs... immediate
>> checking for shl_load... configure: error: Link tests are not allowed
>> after GCC_NO_EXECUTABLES.
>> make[1]: *** [configure-target-libstdc++-v3] Erreur 1
>
> Ok, you have the GCC binaries ready (in $build/gcc) and also
> libgcc (in $build/libgcc) and then your build crashes when
> trying to configure libstdc++-v3 ... The C parts are OK, but
> getting the C++ library fails. So what would be the sane
> reaction in this situation?
>
> For me it would be to try to compile and link a simple "Hello
> World" app with the new GCC... But maybe Android is too weird
> for this, no experience about whether it even supports simple
> "console" apps in a terminal window, requiring some really
> complex application as that "Hello World".
Google has their own stdc and stdc++, which has some compilation
problems. Search the Android NDK group
(http://groups.google.com/group/android-ndk) and the Android Issue
List (http://code.google.com/p/android/issues/list). See, for example,
http://code.google.com/p/android/issues/detail?id=14559.

Jeff

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Build a cross compiler for Android target (arm)
  2011-10-17  6:33 ` Kai Ruottu
  2011-10-17  6:45   ` Jeffrey Walton
@ 2011-10-17  7:44   ` BERTRAND Joel
  1 sibling, 0 replies; 6+ messages in thread
From: BERTRAND Joel @ 2011-10-17  7:44 UTC (permalink / raw)
  To: gcc-help

Kai Ruottu a écrit :
> 15.10.2011 12:41, BERTRAND Joel kirjoitti:
>
>> I'm trying to build a cross compiler for Android target as I want to
>> obtain a Fortran compiler.
>>
>> Of course, I have installed android ndk to have sysroot.
>> Build process stops with :
>>
>> checking whether the
>> /home/bertrand/android/ndk/compilers/gcc-build/./gcc/xgcc
>> -B/home/bertrand/android/ndk/compilers/gcc-build/./gcc/
>> -B/home/bertrand/android/ndk/compilers/arm-android-eabi/bin/
>> -B/home/bertrand/android/ndk/compilers/arm-android-eabi/lib/ -isystem
>> /home/bertrand/android/ndk/compilers/arm-android-eabi/include -isystem
>> /home/bertrand/android/ndk/compilers/arm-android-eabi/sys-include linker
>> (/home/bertrand/android/ndk/compilers/gcc-build/./gcc/collect-ld)
>> supports shared libraries... yes
>> checking dynamic linker characteristics... no
>> checking how to hardcode library paths into programs... immediate
>> checking for shl_load... configure: error: Link tests are not allowed
>> after GCC_NO_EXECUTABLES.
>> make[1]: *** [configure-target-libstdc++-v3] Erreur 1
>
> Ok, you have the GCC binaries ready (in $build/gcc) and also
> libgcc (in $build/libgcc) and then your build crashes when
> trying to configure libstdc++-v3 ... The C parts are OK, but
> getting the C++ library fails. So what would be the sane
> reaction in this situation?
>
> For me it would be to try to compile and link a simple "Hello
> World" app with the new GCC... But maybe Android is too weird
> for this, no experience about whether it even supports simple
> "console" apps in a terminal window, requiring some really
> complex application as that "Hello World". The very common
> Windows 3.1 and its 32-bit extension "Win32s" hadn't any
> console for running "text-mode Windows applications" :(

	I have tested that my gcc/gfortran can compile and link android 
applications. I haven't tested if I can run these applications on a real 
android system.

> In any case installing only the GCC binaries and the libgcc
> happens with :
>
> make install-gcc
> make install-target-libgcc
>
> after which you can try compiling and linking that "Hello
> World" and can see what errors you will get when linking...
>
> The typical mistake is to not allow the self-made gmp, mpfr
> or mpc shared libs being found by the new GCC binaries but
> then the crash should happen already during the libgcc
> configure - that the new 'xgcc' and 'cc1' can be started is
> a sanity test there... So a "sanity test for the builder"
> could be whether one is capable to try tests like :
>
> ./xgcc -v

cauchy:[~/android/ndk/compilers/gcc-build/gcc] > ./xgcc -v
Using built-in specs.
COLLECT_GCC=./xgcc
Target: arm-android-eabi
Configured with: ../gcc-4.6.1/configure 
--prefix=/home/bertrand/android/ndk/compilers --disable-libquadmath 
--target=arm-android-eabi --with-gnu-as --with-gnu-ld 
--enable-languages=c,c++,fortran 
--with-mpfr=/home/bertrand/android/ndk/compilers 
--with-gmp=/home/bertrand/android/ndk/compilers 
--with-mpc=/home/bertrand/android/ndk/compilers --disable-libssp 
--enable-threads --disable-nls --disable-libgomp --disable-shared 
--disable-tls --with-float=soft --with-fpu=vfp --with-arch=armv5te 
--enable-target-optspace 
--with-sysroot=/home/bertrand/android/ndk/sysroot/ 
--host=x86_64-unknown-linux-gnu
Thread model: single
gcc version 4.6.1 (GCC)

> ./xgcc --help

	Works.

> ./cc1 --help

	Works too.

> in the $build/gcc directory without installing anything
> there first, in order to see whether the new GCC executables
> can be run in the cross host system...

	Regards,

	JKB

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Build a cross compiler for Android target (arm)
       [not found]     ` <4E9BDC91.4010801@systella.fr>
@ 2011-10-17  7:44       ` BERTRAND Joel
  0 siblings, 0 replies; 6+ messages in thread
From: BERTRAND Joel @ 2011-10-17  7:44 UTC (permalink / raw)
  To: gcc-help

BERTRAND Joel a écrit :
> Jeffrey Walton a écrit :
>> On Mon, Oct 17, 2011 at 2:32 AM, Kai Ruottu<kai.ruottu@wippies.com>
>> wrote:
>>> 15.10.2011 12:41, BERTRAND Joel kirjoitti:
>>>
>>>> I'm trying to build a cross compiler for Android target as I want to
>>>> obtain a Fortran compiler.
>>>>
>>>> Of course, I have installed android ndk to have sysroot.
>>>> Build process stops with :
>>>>
>>>> checking whether the
>>>> /home/bertrand/android/ndk/compilers/gcc-build/./gcc/xgcc
>>>> -B/home/bertrand/android/ndk/compilers/gcc-build/./gcc/
>>>> -B/home/bertrand/android/ndk/compilers/arm-android-eabi/bin/
>>>> -B/home/bertrand/android/ndk/compilers/arm-android-eabi/lib/ -isystem
>>>> /home/bertrand/android/ndk/compilers/arm-android-eabi/include -isystem
>>>> /home/bertrand/android/ndk/compilers/arm-android-eabi/sys-include
>>>> linker
>>>> (/home/bertrand/android/ndk/compilers/gcc-build/./gcc/collect-ld)
>>>> supports shared libraries... yes
>>>> checking dynamic linker characteristics... no
>>>> checking how to hardcode library paths into programs... immediate
>>>> checking for shl_load... configure: error: Link tests are not allowed
>>>> after GCC_NO_EXECUTABLES.
>>>> make[1]: *** [configure-target-libstdc++-v3] Erreur 1
>>>
>>> Ok, you have the GCC binaries ready (in $build/gcc) and also
>>> libgcc (in $build/libgcc) and then your build crashes when
>>> trying to configure libstdc++-v3 ... The C parts are OK, but
>>> getting the C++ library fails. So what would be the sane
>>> reaction in this situation?
>>>
>>> For me it would be to try to compile and link a simple "Hello
>>> World" app with the new GCC... But maybe Android is too weird
>>> for this, no experience about whether it even supports simple
>>> "console" apps in a terminal window, requiring some really
>>> complex application as that "Hello World".
>> Google has their own stdc and stdc++, which has some compilation
>> problems. Search the Android NDK group
>> (http://groups.google.com/group/android-ndk) and the Android Issue
>> List (http://code.google.com/p/android/issues/list). See, for example,
>> http://code.google.com/p/android/issues/detail?id=14559.
>
> Thanks a lot for your answer, but I have search a long time before
> posting here... And I have found no real solution. Some people seem to
> have the same problem and I'm not able to find any solution.
>
> Regards,
>
> JKB


-- 
Dr. BERTRAND Joël
SYSTELLA S.A.R.L., 10, place de l'école, 68000 COLMAR, FRANCE
Tél.: +33 (0) 973870201, GSM: +33 (0) 616018060, Fax: +33 (0) 149297395
http://www.systella.fr

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Build a cross compiler for Android target (arm)
  2011-10-17  6:45   ` Jeffrey Walton
       [not found]     ` <4E9BDC91.4010801@systella.fr>
@ 2011-10-17  8:05     ` BERTRAND Joel
  1 sibling, 0 replies; 6+ messages in thread
From: BERTRAND Joel @ 2011-10-17  8:05 UTC (permalink / raw)
  Cc: gcc-help

Jeffrey Walton a écrit :
> On Mon, Oct 17, 2011 at 2:32 AM, Kai Ruottu<kai.ruottu@wippies.com>  wrote:
>> 15.10.2011 12:41, BERTRAND Joel kirjoitti:
>>
>>> I'm trying to build a cross compiler for Android target as I want to
>>> obtain a Fortran compiler.
>>>
>>> Of course, I have installed android ndk to have sysroot.
>>> Build process stops with :
>>>
>>> checking whether the
>>> /home/bertrand/android/ndk/compilers/gcc-build/./gcc/xgcc
>>> -B/home/bertrand/android/ndk/compilers/gcc-build/./gcc/
>>> -B/home/bertrand/android/ndk/compilers/arm-android-eabi/bin/
>>> -B/home/bertrand/android/ndk/compilers/arm-android-eabi/lib/ -isystem
>>> /home/bertrand/android/ndk/compilers/arm-android-eabi/include -isystem
>>> /home/bertrand/android/ndk/compilers/arm-android-eabi/sys-include linker
>>> (/home/bertrand/android/ndk/compilers/gcc-build/./gcc/collect-ld)
>>> supports shared libraries... yes
>>> checking dynamic linker characteristics... no
>>> checking how to hardcode library paths into programs... immediate
>>> checking for shl_load... configure: error: Link tests are not allowed
>>> after GCC_NO_EXECUTABLES.
>>> make[1]: *** [configure-target-libstdc++-v3] Erreur 1
>>
>> Ok, you have the GCC binaries ready (in $build/gcc) and also
>> libgcc (in $build/libgcc) and then your build crashes when
>> trying to configure libstdc++-v3 ... The C parts are OK, but
>> getting the C++ library fails. So what would be the sane
>> reaction in this situation?
>>
>> For me it would be to try to compile and link a simple "Hello
>> World" app with the new GCC... But maybe Android is too weird
>> for this, no experience about whether it even supports simple
>> "console" apps in a terminal window, requiring some really
>> complex application as that "Hello World".
> Google has their own stdc and stdc++, which has some compilation
> problems. Search the Android NDK group
> (http://groups.google.com/group/android-ndk) and the Android Issue
> List (http://code.google.com/p/android/issues/list). See, for example,
> http://code.google.com/p/android/issues/detail?id=14559.

	I have checked into faulty configure script :

...
   case $host_os in
   beos*)
     lt_cv_dlopen="load_add_on"
     lt_cv_dlopen_libs=
     lt_cv_dlopen_self=yes
     ;;

   mingw* | pw32* | cegcc*)
     lt_cv_dlopen="LoadLibrary"
     lt_cv_dlopen_libs=
     ;;

   cygwin*)
     lt_cv_dlopen="dlopen"
     lt_cv_dlopen_libs=
     ;;

   darwin*)
   # if libdl is installed we need to link against it
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in 
-ldl" >&5
...

   *)
     ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
if test "x$ac_cv_func_shl_load" = x""yes; then :
   lt_cv_dlopen="shl_load"
else
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in 
-ldld" >&5
$as_echo_n "checking for shl_load in -ldld... " >&6; }
if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
   $as_echo_n "(cached) " >&6
else
   ac_check_lib_save_LIBS=$LIBS
LIBS="-ldld  $LIBS"
if test x$gcc_no_link = xyes; then
   as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." 
"$LINENO" 5
fi

	If I add :

   eabi*)
     lt_cv_dlopen="dlopen"
     lt_cv_dlopen_libs=
     ;;

make process continues and stops with :

checking for sys/types.h... (cached) yes
checking for unistd.h... (cached) yes
checking for wchar.h... (cached) yes
checking for wctype.h... (cached) yes
configure: error: No support for this host/target combination.
make[1]: *** [configure-target-libstdc++-v3] Erreur 1
make[1]: quittant le répertoire « 
/home/bertrand/android/android-ndk-r6b/compilers/gcc-build »
make: *** [all] Erreur 2

	I have removed to try to build a minimal libstdc++.

   *)
     //as_fn_error "No support for this host/target combination." 
"$LINENO" > 5
    ;;

	But if I can configure with my modifications libstdc++, process hangs 
in libiberty with the same error :

checking for library containing strerror... configure: error: Link tests 
are not allowed after GCC_NO_EXECUTABLES.
make[1]: *** [configure-target-libiberty] Erreur 1

	I think that eabi case are missing in a lot of configure scripts :-(

	Regards,

	JKB

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-10-17  8:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-15  9:41 Build a cross compiler for Android target (arm) BERTRAND Joel
2011-10-17  6:33 ` Kai Ruottu
2011-10-17  6:45   ` Jeffrey Walton
     [not found]     ` <4E9BDC91.4010801@systella.fr>
2011-10-17  7:44       ` BERTRAND Joel
2011-10-17  8:05     ` BERTRAND Joel
2011-10-17  7:44   ` BERTRAND Joel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).