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

Build fails on mac while compiling readline #36

Open
vs-pp opened this issue Nov 5, 2021 · 2 comments
Open

Build fails on mac while compiling readline #36

vs-pp opened this issue Nov 5, 2021 · 2 comments

Comments

@vs-pp
Copy link

vs-pp commented Nov 5, 2021

I am compiling on MacOS Catalina...10.15.7

Cloned toolchain from.

git clone --recursive https://github.com/pulp-platform/pulp-riscv-gnu-toolchain

Configured using..

./configure --prefix=/opt/riscv --with-arch=rv32imc --with-cmodel=medlow --enable-multilib

Build fails during compiling readline

..
gcc -c -DHAVE_CONFIG_H    -I. -I/Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline -DRL_LIBRARY_VERSION='"6.2"' -g -O2 /Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline/readline.c
rm -f vi_mode.o
gcc -c -DHAVE_CONFIG_H    -I. -I/Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline -DRL_LIBRARY_VERSION='"6.2"' -g -O2 /Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline/vi_mode.c
rm -f funmap.o
gcc -c -DHAVE_CONFIG_H    -I. -I/Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline -DRL_LIBRARY_VERSION='"6.2"' -g -O2 /Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline/funmap.c
rm -f keymaps.o
gcc -c -DHAVE_CONFIG_H    -I. -I/Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline -DRL_LIBRARY_VERSION='"6.2"' -g -O2 /Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline/keymaps.c
rm -f parens.o
gcc -c -DHAVE_CONFIG_H    -I. -I/Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline -DRL_LIBRARY_VERSION='"6.2"' -g -O2 /Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline/parens.c
rm -f search.o
gcc -c -DHAVE_CONFIG_H    -I. -I/Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline -DRL_LIBRARY_VERSION='"6.2"' -g -O2 /Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline/search.c
rm -f rltty.o
gcc -c -DHAVE_CONFIG_H    -I. -I/Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline -DRL_LIBRARY_VERSION='"6.2"' -g -O2 /Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline/rltty.c
/Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline/rltty.c:83:7: error: implicit declaration of function 'ioctl' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
  if (ioctl (tty, TIOCGWINSZ, &w) == 0)
      ^
/Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline/rltty.c:720:3: error: implicit declaration of function 'ioctl' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
  ioctl (fildes, TIOCSTART, 0);
  ^
/Users/venkat/work/pp/vega/tool_chain_build2/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline/rltty.c:759:3: error: implicit declaration of function 'ioctl' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
  ioctl (fildes, TIOCSTOP, 0);
  ^
3 errors generated.
make[3]: *** [rltty.o] Error 1
make[2]: *** [all-readline] Error 2
make[1]: *** [all] Error 2
@lukamac
Copy link

lukamac commented Nov 21, 2021

<sys/ioctl.h> doesn't get included since the #if surrounding it doesn't check for compilation on MacOS.
Quick fix - add || __APPLE__ to each #if condition.

Files that need changes:

  • riscv-binutils-gdb/readline/rltty.c:40
  • riscv-binutils-gdb/readline/terminal.c:55

But after that I get another error:

build/genautomata /Users/lukamac/repos/pulp-riscv-gnu-toolchain/build/../riscv-gcc/gcc/common.md /Users/lukamac/repos/pulp-riscv-gnu-toolchain/build/../riscv-gcc/gcc/config/riscv/riscv.md \
	  insn-conditions.md > tmp-automata.c
/Users/lukamac/repos/pulp-riscv-gnu-toolchain/build/../riscv-gcc/gcc/config/riscv/riscv.md:3146:1: unknown value `V1SF' for attribute `mode'
/Users/lukamac/repos/pulp-riscv-gnu-toolchain/build/../riscv-gcc/gcc/config/riscv/riscv.md:3146:1: unknown value `V1SF' for attribute `mode'
/Users/lukamac/repos/pulp-riscv-gnu-toolchain/build/../riscv-gcc/gcc/config/riscv/riscv.md:3137:1: unknown value `V1SF' for attribute `mode'
/Users/lukamac/repos/pulp-riscv-gnu-toolchain/build/../riscv-gcc/gcc/config/riscv/riscv.md:3137:1: unknown value `V1SF' for attribute `mode'
make[2]: *** [s-attrtab] Error 1
make[2]: *** Waiting for unfinished jobs....
/bin/sh /Users/lukamac/repos/pulp-riscv-gnu-toolchain/build/../riscv-gcc/gcc/../move-if-change tmp-automata.c insn-automata.c
echo timestamp > s-automata
rm cpp.pod gcov-dump.pod gcov.pod gcov-tool.pod gpl.pod gfdl.pod fsf-funding.pod gcc.pod
make[1]: *** [all-gcc] Error 2
make: *** [stamps/build-gcc-newlib-stage1] Error 2

@tewarid
Copy link

tewarid commented Sep 6, 2022

I get the following error before build fails with the error above

pulp-riscv-gnu-toolchain/riscv-binutils-gdb/gdb/python/python.c:1744:3: error: no matching function for call to '_PyImport_FixupBuiltin'
  _PyImport_FixupBuiltin (gdb_module, "_gdb");

Untested patch for above based on code in cpython repo

  PyObject *modules = PyDict_New();
  if (modules == NULL)
    fprintf (stderr, "_initialize_python: can't make modules dictionary");

  _PyImport_FixupBuiltin (gdb_module, "_gdb", modules);

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

3 participants