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 fail in ubuntu 22.04 c-stack.c:55:26: error: missing binary operator before token "(" #19

Open
fanghuaqi opened this issue Dec 22, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@fanghuaqi
Copy link
Member

fanghuaqi commented Dec 22, 2023

如下图所示

make[5]: Entering directory '/work/work/evalsoc/buildroot_initramfs/build/host-m4-1.4.18/lib'
  CC       binary-io.o
  CC       gl_avltree_oset.o
  CC       c-ctype.o
  CC       c-stack.o
  CC       c-strcasecmp.o
  CC       cloexec.o
  CC       c-strncasecmp.o
  CC       clean-temp.o
  CC       closeout.o
  CC       close-stream.o
  CC       closein.o
  CC       basename.o
  CC       dirname.o
  CC       dirname-lgpl.o
  CC       basename-lgpl.o
  CC       stripslash.o
  CC       execute.o
  CC       exitfail.o
In file included from /usr/include/signal.h:328,
                 from ./signal.h:52,
                 from c-stack.c:49:
c-stack.c:55:26: error: missing binary operator before token "("
   55 | #elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
      |                          ^~~~~~~~
  CC       fd-safer-flag.o
  CC       fatal-signal.o
  CC       fd-hook.o
  CC       dup-safer-flag.o
make[5]: *** [Makefile:1915: c-stack.o] Error 1
make[5]: *** Waiting for unfinished jobs....
  CC       filenamecat.o

image

@fanghuaqi
Copy link
Member Author

fanghuaqi commented Dec 22, 2023

上面是ubuntu 的版本不对,需要使用 ubuntu 20.04才行, 如果需要使用 22.04,请切到 dev_nuclei_5.10_v2 分支测试,参见 #19 (comment)

@fanghuaqi
Copy link
Member Author

fanghuaqi commented Dec 22, 2023

似乎是这个bug导致的 https://bugs.buildroot.org/show_bug.cgi?id=13721

修复的commit参见 https://git.buildroot.org/buildroot/commit/?id=5a9504831f3fa1ef3be334036c93da30150fde55

dev_nuclei_next的分支的buildroot版本刚好是2020.11.2 这个版本, 在这个修复之前,因此会有这个bug,建议切到 dev_nuclei_5.10_v2 这个分支测试。

关于分支介绍参见 #2

@fanghuaqi
Copy link
Member Author

如果使用root账户构建(例如docker下的root)可能会报如下错误

checking whether mkdir handles trailing slash... yes
checking whether mkdir handles trailing dot... yes
checking for mkdtemp... yes
checking whether mkfifo rejects trailing slashes... yes
checking whether mknod can create fifo without root privileges... configure: error: in `/work/work/evalsoc/buildroot_initramfs/build/host-tar-1.29':
configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
See `config.log' for more details
make[1]: *** [package/pkg-generic.mk:240: /work/work/evalsoc/buildroot_initramfs/build/host-tar-1.29/.stamp_configured] Error 1

解决方案 就是 运行 export FORCE_UNSAFE_CONFIGURE=1

但是不建议使用 root账户,强烈反对root和普通用户混用,会带来一堆问题。

@fanghuaqi
Copy link
Member Author

fanghuaqi commented Dec 22, 2023

测试ubuntu 22.04 的docker,下载代码,切换到 dev_nuclei_5.10_v2 分支,并获取最新代码,构建freeloader和bootimages,且运行qemu,没有问题

测试 commit为 ff7509e

# in host
docker run -it ubuntu:22.04
# in docker now, default is root account
# not recommend to use root account in normal non-docker environment
# update apt package index
apt update
git clone -b dev_nuclei_5.10_v2 --depth 5 https://github.com/Nuclei-Software/nuclei-linux-sdk
cd nuclei-linux-sdk
git submodule update --init --depth=5
# please make sure source code cloned and updated successfully without any error 
# install required packages
xargs apt install -y < .github/apt.txt
# file is also required
apt install file
#  you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
export FORCE_UNSAFE_CONFIGURE=1
# build freeloader and bootimages
make freeloader bootimages
# install qemu via wget
wget https://nucleisys.com/upload/files/toochain/qemu/nuclei-qemu-2023.10-linux-x64.tar.gz
tar -xzf nuclei-qemu-2023.10-linux-x64.tar.gz
export PATH=$(pwd)/qemu/bin:$PATH
# check required libraries are installed or not for qemu
ldd `which qemu-system-riscv64`
# Fix gdb missing libgmp.so.3, see https://github.com/Nuclei-Software/nuclei-linux-sdk/issues/5
ln -s /lib/x86_64-linux-gnu/libgmp.so /lib/x86_64-linux-gnu/libgmp.so.3
# run in qemu
make run_qemu
  • 查看Ubuntu版本信息

image

  • make freeloader bootimages

image

  • make run_qemu

image

@fanghuaqi fanghuaqi changed the title Build fail in ubuntu 22.04 c-stack.c error missinbg binrary operator before token Build fail in ubuntu 22.04 c-stack.c:55:26: error: missing binary operator before token "(" Dec 22, 2023
@fanghuaqi
Copy link
Member Author

You can try dev_nuclei_next and dev_nuclei_5.10 branch using Ubuntu 22.04 now, I think it is supported now, just try like #19 (comment)

@fanghuaqi fanghuaqi self-assigned this Jan 22, 2024
@fanghuaqi fanghuaqi added the bug Something isn't working label Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant