Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make build fails (again) with error #7

Open
jbrunk1966 opened this issue May 9, 2023 · 5 comments
Open

make build fails (again) with error #7

jbrunk1966 opened this issue May 9, 2023 · 5 comments

Comments

@jbrunk1966
Copy link

according to a closed issue this error should be solved by updating the sub-modules, but it doesn't help...

updated all build tools and source before

$ cd xuantie-gnu-toolchain
$ git pull --force
$ git submodule update --remote  --force --recursive  
$ make distclean
$ ./configure --prefix=/opt/riscv-toolchain/xuantie --with-cmodel=medany --enable-multilib --disable-gdb
$ make newlib -j$(nproc)

but the build still fails somewhere

g++   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -fno-strict-aliasing -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H  -DGENERATOR_FILE -fno-PIE  -no-pie -o build/genautomata \
    build/genautomata.o build/rtl.o build/read-rtl.o build/ggc-none.o build/vec.o build/min-insn-modes.o build/gensupport.o build/print-rtl.o build/hash-table.o build/sort.o build/read-md.o build/errors.o ../build-arm-apple-darwin22.4.0/libiberty/libiberty.a -lm
clang: warning: argument unused during compilation: '-no-pie' [-Wunused-command-line-argument]
ld: warning: -no_pie is deprecated when targeting new OS versions
ld: warning: -no_pie ignored for arm64
build/genautomata ../.././riscv-gcc/gcc/common.md ../.././riscv-gcc/gcc/config/riscv/riscv.md \
  insn-conditions.md > tmp-automata.c
/bin/sh ../.././riscv-gcc/gcc/../move-if-change tmp-automata.c insn-automata.c
automatav=$(echo $(LC_MESSAGES=C csplit insn-automata.c /parallel\ compilation/ -k -s {20} -f insn-automata -b "%d.c" 2>&1));\
[ ! "$automatav" ] || grep "match not found" <<< $automatav
make[2]: *** [Makefile:2411: s-automata] Error 1
make[2]: Leaving directory '/Users/jbrunk/Development/riscv/xuantie-gnu-toolchain/build-gcc-newlib-stage1/gcc'
make[1]: *** [Makefile:4429: all-gcc] Error 2
make[1]: Leaving directory '/Users/jbrunk/Development/riscv/xuantie-gnu-toolchain/build-gcc-newlib-stage1'
make: *** [Makefile:553: stamps/build-gcc-newlib-stage1] Error 2
@Cooper-Qu
Copy link
Collaborator

Hello, can you confirm whether the csplit tool is installed in your system, if the ubuntu system, you can use "apt-get install coreutils" to install.

@jbrunk1966
Copy link
Author

yes, csplit ist installed on my System (Apple MacBookAir M2, MacOS 13.3.1a:

macbook-air:xuantie-gnu-toolchain jbrunk$ which csplit
/usr/bin/csplit
macbook-air:xuantie-gnu-toolchain jbrunk$ csplit
usage: csplit [-ks] [-f prefix] [-n number] file args ...

@jbrunk1966
Copy link
Author

jbrunk1966 commented May 12, 2023

anyway, i managed to get it working by using the Toolchain provided via brew on MacOS. Even if they do the same it compiles from GIT w/o above issue 🤷

https://github.com/riscv-software-src/homebrew-riscv/blob/HEAD/riscv-gnu-toolchain.rb

@warrenm
Copy link

warrenm commented Sep 18, 2023

This is due to inconsistencies between GNU csplit and BSD csplit. The Makefile assumes GNU-style messages, so pattern-matching on the string match not found fails when BSD csplit outputs no match. At least as importantly, BSD csplit expects all options to precede the pattern and filename. Finally, it doesn't support the -b flag.

A possible workaround would be to use GNU coreutils rather than system-provided tools to ensure that the assumed output matches the actual output (e.g. by installing coreutils with brew and then prepending the resulting gnubin directory to the front of your path when calling make). I can't vouch that this fixes the build completely on Apple Silicon, but it's a step in that direction.

@OctopusET
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants