Opened 5 years ago

Last modified 5 years ago

#15197 new bug

gcc2 cross-tools cannot be moved

Reported by: kallisti5 Owned by: bonefish
Priority: normal Milestone: Unscheduled
Component: Build System Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

The gcc2 cross-tools cannot be moved. Moving will result in the following error:

# /toolchains/cross-tools-x86_gcc2/bin/i586-pc-haiku-cpp -v
Using builtin specs.
gcc version 2.95.3-haiku-2017_07_20
 cpp0 -lang-c -v -D__ELF__ -D__HAIKU__ -D__INTEL__ -D_X86_=1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__STDC_ISO_10646__=201103L -D__ELF__ -D__HAIKU__ -D__INTEL__ -D_X86_=1 -D__stdcall=__attribute__((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) -D__declspec(x)=__attribute__((x)) -D__STDC_ISO_10646__=201103L -Asystem(haiku) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di586 -Dpentium -D__i586 -D__i586__ -D__pentium -D__pentium__ -D__PIC__ -D__pic__ -
i586-pc-haiku-cpp: installation problem, cannot exec `cpp0': No such file or directory

The reason is because gcc2 seems to hard-code the path into the binaries:

root@22c9375a89e0:/work/haiku/generated.x86_gcc2# /toolchains/cross-tools-x86_gcc2/bin/i586-pc-haiku-cpp -print-search-dirs
install: /tmp/build/10ff1af8/crosstools.x86_gcc2/cross-tools-x86_gcc2/lib/gcc-lib/i586-pc-haiku/2.95.3-haiku-2017_07_20/
programs: /tmp/build/10ff1af8/crosstools.x86_gcc2/cross-tools-x86_gcc2/lib/gcc-lib/i586-pc-haiku/2.95.3-haiku-2017_07_20/:/tmp/build/10ff1af8/crosstools.x86_gcc2/cross-tools-x86_gcc2/lib/gcc-lib/i586-pc-haiku/:/usr/lib/gcc/i586-pc-haiku/2.95.3-haiku-2017_07_20/:/usr/lib/gcc/i586-pc-haiku/:/tmp/build/10ff1af8/crosstools.x86_gcc2/cross-tools-x86_gcc2/i586-pc-haiku/bin/i586-pc-haiku/2.95.3-haiku-2017_07_20/:/tmp/build/10ff1af8/crosstools.x86_gcc2/cross-tools-x86_gcc2/i586-pc-haiku/bin/
libraries: /tmp/build/10ff1af8/crosstools.x86_gcc2/cross-tools-x86_gcc2/lib/gcc-lib/i586-pc-haiku/2.95.3-haiku-2017_07_20/:/usr/lib/gcc/i586-pc-haiku/2.95.3-haiku-2017_07_20/:/tmp/build/10ff1af8/crosstools.x86_gcc2/cross-tools-x86_gcc2/i586-pc-haiku/lib/i586-pc-haiku/2.95.3-haiku-2017_07_20/:/tmp/build/10ff1af8/crosstools.x86_gcc2/cross-tools-x86_gcc2/i586-pc-haiku/lib/

Prefixing with a new COMPILER_PATH env var seems to fix the issue, however we should likely patch our gcc2 code to be "better"

COMPILER_PATH=/toolchains/cross-tools-x86_gcc2/lib/gcc-lib/ /toolchains/cross-tools-x86_gcc2/bin/i586-pc-haiku-cpp -v

Change History (2)

comment:1 by pulkomandy, 5 years ago

No one is willing to patch gcc2 things. Can we close this? I assume you have a workaround for the new CI?

comment:2 by kallisti5, 5 years ago

it's ugly

 # Hack for https://dev.haiku-os.org/ticket/15197. Please fix me!
 GCC2PATH=$(strings container-context/toolchains/cross-tools-x86_gcc2/bin/i586-pc-haiku-cpp | grep gcc-lib | grep crosstools | cut -d/ -f1,2,3,4,5)
 echo "RUN mkdir -p $GCC2PATH" >> container-context/Dockerfile
 echo "RUN ln -s /toolchains/cross-tools-x86_gcc2 $GCC2PATH/cross-tools-x86_gcc2" >> container-context/Dockerfile
Note: See TracTickets for help on using tickets.