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 issues with alternate c compiler. #4

Open
TimJSwan89 opened this issue Nov 17, 2017 · 0 comments
Open

Build issues with alternate c compiler. #4

TimJSwan89 opened this issue Nov 17, 2017 · 0 comments

Comments

@TimJSwan89
Copy link

After running make linux CC=my_cc LD=my_cc, I ran this:
VirtualBox:~/Desktop/busybox$ make CC=my_cc LD=my_cc

/home/Desktop/busybox/scripts/gcc-version.sh: line 12: printf: __GNUC__: invalid number
  SPLIT   include/autoconf.h -> include/config/*
  GEN     include/bbconfigopts.h
  GEN     include/common_bufsiz.h
  HOSTCC  applets/usage
applets/usage.c: In function ‘main’:
applets/usage.c:52:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write(STDOUT_FILENO, usage_array[i].usage, strlen(usage_array[i].usage) + 1);
   ^
  GEN     include/usage_compressed.h
  HOSTCC  applets/applet_tables
  GEN     include/applet_tables.h include/NUM_APPLETS.h
  GEN     include/applet_tables.h include/NUM_APPLETS.h
  CC      applets/applets.o
fixdep: applets/.applets.o.d: No such file or directory
scripts/Makefile.build:197: recipe for target 'applets/applets.o' failed
make[1]: *** [applets/applets.o] Error 2
Makefile:372: recipe for target 'applets_dir' failed
make: *** [applets_dir] Error 2

The following immediate source code may be useful since it is referred to in the error:

applets/usage.c:52:
write(STDOUT_FILENO, usage_array[i].usage, strlen(usage_array[i].usage) + 1);

scripts/Makefile.build:196-198:

%.o: %.c FORCE
        $(call cmd,force_checksrc)
        $(call if_changed_rule,cc_o_c)

Makefile:371-372:

applets_dir: scripts_basic gen_build_files
        $(Q)$(MAKE) $(build)=applets

I don't know much about what fixdep is doing, but I think that stands for "fix dependencies," right? It doesn't seem to have that missing file error when compiling with gcc, so either it doesn't usually run that or the file is there

okuoku pushed a commit to okuoku/wasmlinux-busybox that referenced this issue Nov 12, 2023
When I planned to print the command in read_line_input, I found that after
the system started, the command printed for the first time was always
garbled.

After analysis, it is found that in the init() function of ash, the
variable basepf.buf is not initialized after applying for memory, resulting
in garbled initial data. Then assign it to the global variable
g_parsefile->buf in ash.c, and then pass g_parsefile->buf to the parameter
command of the function read_line_input in the function preadfd(), and
finally cause it to be garbled when the command is printed by
read_line_input.

The call stack is as follows:
 #0  read_line_input (st=0xb6fff220, prompt=0xb6ffc910 "\\[\\033[32m\\]\\h \\w\\[\\033[m\\] \\$ ", command=command@entry=0xb6ffc230 "P\325\377\266P\325\377\266", maxsize=maxsize@entry=1024) at libbb/lineedit.c:2461
 mirror#1  0x0043ef8c in preadfd () at shell/ash.c:10812
 mirror#2  preadbuffer () at shell/ash.c:10914
 mirror#3  pgetc () at shell/ash.c:10997
 mirror#4  0x00440c20 in pgetc_eatbnl () at shell/ash.c:11039
 mirror#5  0x00440cbc in xxreadtoken () at shell/ash.c:13157
 mirror#6  0x00440f40 in readtoken () at shell/ash.c:13268
 mirror#7  0x00441234 in list (nlflag=nlflag@entry=1) at shell/ash.c:11782
 mirror#8  0x004420e8 in parsecmd (interact=<optimized out>) at shell/ash.c:13344
 mirror#9  0x00442c34 in cmdloop (top=top@entry=1) at shell/ash.c:13549
 mirror#10 0x00444e4c in ash_main (argc=<optimized out>, argv=0x444e4c <ash_main+1328>) at shell/ash.c:14747
 mirror#11 0x00407954 in run_applet_no_and_exit (applet_no=9, name=<optimized out>, argv=0xbefffd34) at libbb/appletlib.c:1024
 mirror#12 0x00407b68 in run_applet_and_exit (name=0xbefffe56 "ash", argv=0x9) at libbb/appletlib.c:1047
 mirror#13 0x00407f88 in main (argc=<optimized out>, argv=0xbefffd34) at libbb/appletlib.c:1181

Fixes: 82dd14a ("ash: use CONFIG_FEATURE_EDITING_MAX_LEN")

Signed-off-by: zhuyan <zhuyan34@huawei.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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

1 participant