jcmvbkbc / crosstool-NG

crosstool-NG with support for Xtensa
Other
108 stars 182 forks source link

Can't compile for arm host #68

Closed 4ntoine closed 4 years ago

4ntoine commented 4 years ago

assume using the following:

created "arm-ndk,xtensa-lx106-elf" sample:

# created by 4ntoine
# this comes from samples/xtensa-lx106-elf:
# ---
CT_EXPERIMENTAL=y
CT_PREFIX_DIR="${CT_TOP_DIR}/builds/arm-ndk-${CT_TARGET}" # `arm-ndk-` added
CT_PATCH_BUNDLED_LOCAL=y
CT_LOCAL_PATCH_DIR="${CT_TOP_DIR}/local-patches"
CT_ARCH_xtensa=y
CT_XTENSA_CUSTOM=y
CT_ARCH_XTENSA_CUSTOM_NAME="lx106"
CT_ARCH_XTENSA_CUSTOM_OVERLAY_LOCATION="${CT_TOP_DIR}/overlays"
CT_TARGET_VENDOR="lx106"
CT_LIBC_NEWLIB_V_2_0_0=y
# CT_LIBC_NEWLIB_ENABLE_TARGET_OPTSPACE is not set
CT_CC_LANG_CXX=y
# CT_CC_STATIC_LIBSTDCXX is not set
CT_DEBUG_gdb=y
# CT_GDB_CROSS_PYTHON is not set
CT_GDB_V_7_5_1=y
# ---
# added by 4ntoine to make canadian cross linked statically:
CT_ISL_V_0_18_0=y
CT_CC_V_8_3_0=y
CT_ISL_VERSION="0.18"
CT_CLOOG_VERSION="0.18.4"
CT_CC_VERSION="9.2.0"
CT_CANADIAN=y
CT_HOST="arm-linux-androideabi"
CT_CONFIGURE_has_static_link=y
CT_WANTS_STATIC_LINK=y
CT_WANTS_STATIC_LINK_CXX=y
CT_STATIC_TOOLCHAIN=y
CT_STRIP_HOST_TOOLCHAIN_EXECUTABLES=y
CT_TOOLCHAIN_TYPE="cross"

and created configuration from it:

./ct-ng arm-ndk,xtensa-lx106-elf

and manually edited .configuration to have the versions above (it seems ./ct-ng overwrote them to default)

It results into the following:

checking for the value of EOF... configure: error: computing EOF failed
make[2]: ** [configure-target-libstdc++-v3] Error 1
4ntoine commented 4 years ago

config.zip

4ntoine commented 4 years ago

build.zip

4ntoine commented 4 years ago

CT_TOOLCHAIN_TYPE="cross" seems to be wrong, trying CT_TOOLCHAIN_TYPE="canadian"..

4ntoine commented 4 years ago

Nope, did not help, still having:

[INFO ]  =================================================================
[INFO ]  Installing C library
[INFO ]  Installing C library: done in 24.33s (at 07:57)
[INFO ]  =================================================================
[INFO ]  Installing final compiler for build
[ERROR]    checking for the value of EOF... configure: error: computing EOF failed
[ERROR]    make[2]: *** [configure-target-libstdc++-v3] Error 1
[ERROR]   
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing final compiler for build'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@257]
[ERROR]  >>        called from: do_cc_core_backend[scripts/build/cc/gcc.sh@483]
[ERROR]  >>        called from: do_cc_for_build[scripts/build/cc/gcc.sh@558]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@638]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      'share/doc/crosstool-ng/ct-ng.1.20.0/B - Known issues.txt'
[ERROR]   
[ERROR]  (elapsed: 10:20.16)
[10:20] / ct-ng:148: recipe for target 'build' failed
make[1]: *** [build] Error 2
ct-ng:151: recipe for target 'build.8' failed
make: *** [build.8] Error 2

config.zip build.zip

4ntoine commented 4 years ago

Same error if trying with CT_HOST="arm-unknown-linux-gnueabi" (and toolchain compiled with upstream crosstool-ng, installed and added to PATH)

nolange commented 4 years ago

Dont think this is related to #1188, do a google search on "checking for the value of EOF", I think you have some directories mixed up. look into the config.log in /opt/Espressif/crosstool-NG-android/.build/xtensa-lx106-elf/build/build-cc-final-build-x86_64-build_unknown-linux-gnufor more clues.

4ntoine commented 4 years ago

@nolange i did googled before obviously, but unfortunately at the moment i don't have enough understanding on what's wrong and how to fix it. Will continue, any advice is appreciated

4ntoine commented 4 years ago

hmm, config.log in /opt/Espressif/crosstool-NG-android/.build/xtensa-lx106-elf/build/build-cc-final-build-x86_64-build_unknown-linux-gnu has configure: exit 0, no mentions of "EOF issue" there

4ntoine commented 4 years ago

this is from "/opt/Espressif/crosstool-NG-android/.build/xtensa-lx106-elf/build/build-cc-final-build-x86_64-build_unknown-linux-gnu/xtensa-lx106-elf/libstdc++-v3/config.log" due to missing header:

...
configure:20638:  /opt/Espressif/crosstool-NG-android/.build/xtensa-lx106-elf/build/build-cc-final-build-x86_64-build_unknown-linux-gnu/./gcc/xgcc -B/opt/Espressif/crosstool-NG-android/.build/xtensa-lx106-elf/build/build-cc-final-build-x86_64-build_unknown-linux-gnu/./gcc/ -B/opt/Espressif/crosstool-NG-android/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/bin/ -B/opt/Espressif/crosstool-NG-android/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/lib/ -isystem /opt/Espressif/crosstool-NG-android/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/include -isystem /opt/Espressif/crosstool-NG-android/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/sys-include    -c -g -O2 -g -Os  conftest.c >&5
In file included from /opt/Espressif/crosstool-NG-android/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/include/_ansi.h:16,
                 from /opt/Espressif/crosstool-NG-android/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/include/stdio.h:29,
                 from conftest.c:14:
/opt/Espressif/crosstool-NG-android/.build/xtensa-lx106-elf/buildtools/xtensa-lx106-elf/include/sys/config.h:170:10: fatal error: xtensa/config/core-isa.h: No such file or directory
  170 | #include <xtensa/config/core-isa.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
configure:20638: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "package-unused"
| #define PACKAGE_TARNAME "libstdc++"
| #define PACKAGE_VERSION "version-unused"
| #define PACKAGE_STRING "package-unused version-unused"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define LT_OBJDIR ".libs/"
| #define _GLIBCXX_HOSTED 1
| #define _GLIBCXX_VERBOSE 1
| #define _GLIBCXX_USE_LONG_LONG 1
| #define _GLIBCXX_FULLY_DYNAMIC_STRING 0
| /* end confdefs.h.  */
| #include <stdio.h>
| int
| main ()
| {
| static int test_array [1 - 2 * !((EOF) < 0)];
| test_array [0] = 0;
| return test_array [0];
| 
|   ;
|   return 0;
| }
configure:20641: error: computing EOF failed
...
4ntoine commented 4 years ago

Question on SO: https://stackoverflow.com/questions/62457315/how-to-make-canadian-cross-for-xtensa-lx106-elf-for-android-arm-host-with-crosst

jcmvbkbc commented 4 years ago

I've pushed a branch xtensa-1.24.x with a defconfig aarch64-linux-gnu,xtensa-lx106-elf that I used to build a static toolchain for aarch64-linux host, xtensa-lx106-elf target. Please give it a try. It may need more configuration tweaks to match the toolchain built by the esp-open-sdk as I did the simplest config possible from the top of my head just to see if it builds.

4ntoine commented 4 years ago

Hi, @jcmvbkbc. Thanks for looking into it!

I had to change host to "aarch64-linux-android" to use it with standalone toolchain from Android NDK 21b (received it using "./build/tools/make_standalone_toolchain.py --arch arm64 --api 21 --install-dir /home/anton/x-tools/arm64-ndk").

config.zip

Eventually i get the following:

[INFO ]  =================================================================
[INFO ]  Installing gettext for host
[EXTRA]    Configuring gettext
[EXTRA]    Building gettext
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_addclose.c:50:19: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_addclose.c:50:42: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_addclose.c:59:24: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_addclose.c:59:47: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_addclose.c:64:19: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_adddup2.c:50:19: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_adddup2.c:50:42: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_adddup2.c:59:24: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_adddup2.c:59:47: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_adddup2.c:65:19: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    make[6]: *** [Makefile:2962: spawn_faction_addclose.lo] Error 1
[ERROR]    make[6]: *** Waiting for unfinished jobs....
[ERROR]    make[6]: *** [Makefile:2962: spawn_faction_adddup2.lo] Error 1
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_init.c:34:30: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_init.c:35:39: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_init.c:42:15: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_init.c:43:15: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    make[6]: *** [Makefile:2962: spawn_faction_init.lo] Error 1
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_addopen.c:51:19: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_addopen.c:51:42: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_addopen.c:60:24: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_addopen.c:60:47: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_addopen.c:68:19: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    make[6]: *** [Makefile:2962: spawn_faction_addopen.lo] Error 1
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawn_faction_destroy.c:29:21: error: member reference base type 'posix_spawn_file_actions_t' (aka 'struct __posix_spawn_file_actions *') is not a structure or union
[ERROR]    make[6]: *** [Makefile:2962: spawn_faction_destroy.lo] Error 1
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawnattr_setflags.c:42:7: error: member reference base type 'posix_spawnattr_t' (aka 'struct __posix_spawnattr *') is not a structure or union
[ERROR]    make[6]: *** [Makefile:2962: spawnattr_setflags.lo] Error 1
[ERROR]    /opt/Espressif/crosstool-NG/.build/HOST-aarch64-linux-android/xtensa-lx106-elf/src/gettext/gettext-tools/gnulib-lib/spawnattr_setsigmask.c:30:16: error: member reference base type 'posix_spawnattr_t' (aka 'struct __posix_spawnattr *') is not a structure or union
[ERROR]    make[6]: *** [Makefile:2962: spawnattr_setsigmask.lo] Error 1
[ERROR]    make[5]: *** [Makefile:2618: all] Error 2
[ERROR]    make[4]: *** [Makefile:2028: all-recursive] Error 1
[ERROR]    make[3]: *** [Makefile:1894: all] Error 2
[ERROR]    make[2]: *** [Makefile:414: all-recursive] Error 1
[ERROR]    make[1]: *** [Makefile:370: all] Error 2
[ERROR]   
[ERROR]  >>
[ERROR]  >>  Build failed in step 'Installing gettext for host'
[ERROR]  >>        called in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@376]
[ERROR]  >>        called from: do_gettext_backend[scripts/build/companion_libs/330-gettext.sh@134]
[ERROR]  >>        called from: do_gettext_for_host[scripts/build/companion_libs/330-gettext.sh@51]
[ERROR]  >>        called from: do_companion_libs_for_host[scripts/build/companion_libs.sh@36]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@694]
[ERROR]  >>
[ERROR]  >>  For more info on this error, look at the file: 'build.log'
[ERROR]  >>  There is a list of known issues, some with workarounds, in:
[ERROR]  >>      https://crosstool-ng.github.io/docs/known-issues/
[ERROR]  >>
[ERROR]  >> NOTE: Your configuration includes features marked EXPERIMENTAL.
[ERROR]  >> Before submitting a bug report, try to reproduce it without enabling
[ERROR]  >> any experimental features. Otherwise, you'll need to debug it
[ERROR]  >> and present an explanation why it is a bug in crosstool-NG - or
[ERROR]  >> preferably, a fix.
[ERROR]  >>
[ERROR]  >>  If you feel this is a bug in crosstool-NG, report it at:
[ERROR]  >>      https://github.com/crosstool-ng/crosstool-ng/issues/
[ERROR]  >>
[ERROR]  >>  Make sure your report includes all the information pertinent to this issue.
[ERROR]  >>  Read the bug reporting guidelines here:
[ERROR]  >>      http://crosstool-ng.github.io/support/
[ERROR]   
[ERROR]  (elapsed: 9:47.10)
[09:48] / make: *** [ct-ng:261: build] Error 2

build.zip

What toolchain should be used for "aarch64-linux-gnu"? I've tried "./ct-ng aarch64-linux-gnu" but it was not found. Am i missing anything else?

4ntoine commented 4 years ago

Worked for me if compiling with toolchain from the following ubuntu packages (NOT from NDK):

sudo apt install g++-aarch64-linux-gnu
sudo apt install gcc-aarch64-linux-gnu