The github-repo https://github.com/LowLevelMahn/build_clfs_tools contains the scripts, files AND complete build-logs (so no need to run the script yourself) separated for each step that i will use here as a "walkable" reference. The Repo Readme.MD better read/clickable then this long email. I'll try to keep the github readme.md up to date if somethings changes.

Short Story:

i think i've found a configure bug in gcc while getting CFLS 3.0 alpha-dec ready

Long Story:

=================== Goal

I want to add alpha dec support to the current stable Cross Linux From Scratch (CLFS clfs.org) 3.0 (which uses gcc 4.8.3 as source base) CLFS 3.0 currently only supports x86/mips/sparc/arm/powerpc. Using a ready-for-use-cross-development-toolkit is not an option for being CLFS conform.

=================== Work so far - the build-script

I've written a bash script (for being consistent in building for the different targets) that is doing the CLFS "5. Constructing Cross-Compile Tools" chapter.

Its based on http://www.clfs.org/view/CLFS-3.0.0-SYSTEMD/sparc64-64/cross-tools/introduction.html and http://www.clfs.org/view/CLFS-3.0.0-SYSTEMD/mips64-64/cross-tools/introduction.html

I've got extra follow up scripts for building kernel, bash, hello world etc. but I haven't included them here to keep the problem report smaller.

The script needs sudo to add /tools and /cross-tools symbolic links to the root - the CLFS gcc patches are directing to them - but thats all

The script checks for every possible error and exits with current step/substep info on any fail, it logs every ./configure, make, make install run and creates some extra info files for searchdirs, paths etc.

Every package is built out of Source-Tree and freshly extracted/removed in every step.

The target configuration (build script line 35-70) is the only part of the script which is target specific. The rest of the script only uses these variables, no target related ifs/switch-cases while configuring/building are present.

This is the essence of the script:

(step(04) starting at line 299 in the build script)

  • step( 4): 5.2. File-5.19
  • step( 5): 5.3. Linux-3.14.21 Headers
  • step( 6): 5.4. M4-1.4.17
  • step( 7): 5.5. Ncurses-5.9
  • step( 8): 5.6. Pkg-config-lite-0.28-1
  • step( 9): 5.7. GMP-6.0.0
  • step(10): 5.8. MPFR-3.1.2
  • step(11): 5.9. MPC-1.0.2
  • step(12): 5.10. ISL-0.12.2
  • step(13): 5.11. CLooG-0.18.2
  • step(14): 5.12. Cross Binutils-2.24
  • step(15): 5.13. Cross GCC-4.8.3 <-- the wrong gcc search-dirs for target alpha
  • step(16): 5.14. Glibc-2.19
  • step(17): 5.15. Cross GCC-4.8.3 <-- alpha fails here

build-logs:

=================== what is working:

Sparc64-64 and mips64-64 are working perfectly - I'm able to compile and run a linux kernel + bash + hello-world in sparc64/mips64-qemu based on the built cross-tools.

=================== the problem:

If building for alpha target the make fails in step(17) with linking crti.o

=================== My findings so far:

The reason for the fail in step(17) is that the built gcc in step(15) got the wrong gcc search-dirs, whereas sparc64-64/mips64-64 got the correct and equal gcc-search-dirs, but the alpha target differs in the last 4 paths.

Logged gcc search-dirs:

gcc_search_dirs.(diffable).out is generated in step(15) Cross GCC-4.8.3, build_clfs_cross_tools.sh, line: 723/726

better readable search-dirs

for being better diffable target replaced by {TARGET}, clfs_target replace by [CLFS_TARGET} etc.

logged c-runtime location:

-the crti.o is the same in all target-folders - that seems correct

crt-path.out is generated in step(16) Glibc-2.19, build_clfs_cross_tools.sh, line: 776

logged ld SEARCHDIR:

the ld searchpath is the same "/tools/lib" for all targets - that seems correct

ld_SEARCHDIR.out is generated in step(14) Cross Binutils-2.24, build_clfs_cross_tools.sh, line: 626

the configure/make differences between the targets:

the mips64/sparc64/alpha Makefile/config.(status|log) for step(15) Cross GCC-4.8.3 are nearly equal for the targets and it doesn't seem that the gcc-search-dirs difference comes from here

see folder step15_build_configure_logs_diffable for being better diffable the target replaced by {TARGET}, the clfs_target replace by [CLFS_TARGET} etc. so its easier to diff localy with the prefered tool

=================== My suspicions so far :

First idea: The also alpha targeting (but not supported) CLFS gcc patching does not "change" enough for alpha

gcc-4.8.3-pure64_specs-1.patch

gcc patching in step(15) Cross GCC-4.8.3, build_clfs_cross_tools.sh in line: 680-685

The patching only changes files in /gcc/config

I've copyied the original and patched /gcc/config tree into the gcc-4.8.3.patch.files folder - so its easier to diff localy with the prefered tool

Second and better idea:

i think gcc ./configure does not treat the parameters --prefix=/cross-tools and --with-local-prefix=/tools in step(15) Cross GCC-4.8.3, the same way for alpha as for mips/sparc targets because the CLFS gcc patch does not patch /cross-tools into the sources at all so /cross-tools from the gcc-search-dirs must come through gcc configure parameters - but are just partialy missing with target alpha

so mips/sparc respecting --prefix=/cross-tools, but alpha only partialy - seems to be a bug in gcc/configuration

===================

Any idea/hint where/how to find/correct the gcc-search-dirs differences for the alpha target to be CLFS conform and buildable?

Thanks,

Dennis