bootlin / toolchains-builder

http://toolchains.free-electrons.com
89 stars 27 forks source link

ARC toolchain comes with bison that fails to relocate with relocate-sdk.sh #17

Open dezgeg opened 5 years ago

dezgeg commented 5 years ago

Both arcle-hs38--glibc--stable-2018.02-2 and arcle-hs38--glibc--bleeding-edge-2018.07-3 seem to come with a bison binary that is still looking in the original installation path for its internal files even after I've run relocate-sdk.sh:

+bison: /opt/arcle-hs38--glibc--stable-2018.02-2/share/bison/m4sugar/m4sugar.m4: cannot open: No such file or directory
+make[2]: *** [scripts/Makefile.lib:228: scripts/kconfig/zconf.tab.c] Error 1
+make[1]: *** [Makefile:492: tb100_defconfig] Error 2
+make: *** [Makefile:148: sub-make] Error 2

and

+bison: /opt/arcle-hs38--glibc--bleeding-edge-2018.07-3/share/bison/m4sugar/m4sugar.m4: cannot open: No such file or directory
+make[2]: *** [scripts/Makefile.lib:228: scripts/kconfig/zconf.tab.c] Error 1
+make[1]: *** [Makefile:492: nsim_hs38be_defconfig] Error 2
+make: *** [Makefile:148: sub-make] Error 2

As far as I can tell, the other toolchains that I tried didn't come with bison (or flex for that matter) at all. So just removing bison would 'fix' this and make the ARC toolchains consistent with the other toolchains.

tpetazzoni commented 5 years ago

Thanks for your report! Indeed the host directory is currently "polluted" with various build utilities that are needed for the toolchain build, but not for using the toolchain. We should clean them up. I think we should use the package-file-list.txt file to keep only the files that are installed by the toolchain packages.

However, what you're pointing about Bison is a real Buildroot bug: a SDK with host-bison installed is not properly fixed after relocate-sdk.sh.

dezgeg commented 5 years ago

Thanks for your report! Indeed the host directory is currently "polluted" with various build utilities that are needed for the toolchain build, but not for using the toolchain. We should clean them up. I think we should use the package-file-list.txt file to keep only the files that are installed by the toolchain packages.

Yes, makes sense.

However, what you're pointing about Bison is a real Buildroot bug: a SDK with host-bison installed is not properly fixed after relocate-sdk.sh.

Ah, I wasn't sure to which extent Buildroot toolchains support relocation since it gets complicated quite fast... but in the case of Bison it would seem enough to replace the bison binary with a wrapper script that sets BISON_PKGDATADIR based on this in src/output.c:

char const *
pkgdatadir (void)
{
  char const *cp = getenv ("BISON_PKGDATADIR");
  return cp ? cp : PKGDATADIR;
}