ghaerr / elks

Embeddable Linux Kernel Subset - Linux for 8086
Other
1.02k stars 108 forks source link

Elks fails to compile on Debian 12 due to libc failing to compile. typo maybe? #2042

Open sparky4 opened 1 month ago

sparky4 commented 1 month ago

Description

Configuration

How to reproduce ?

Raw data

Cleaning all... make -C libc clean make[1]: Entering directory '/home/sparky4/p/elks/libc' for DIR in asm ctype debug error gcc getent malloc math misc net regex stdio string system termcap termios time ; do make -C $DIR clean || exit 1; done make[2]: Entering directory '/home/sparky4/p/elks/libc/asm' Makefile:23: target pattern contains no '%'. Stop. make[2]: Leaving directory '/home/sparky4/p/elks/libc/asm' make[1]: [Makefile:240: clean] Error 1 make[1]: Leaving directory '/home/sparky4/p/elks/libc' make: *** [Makefile:36: clean] Error 2 Build script has terminated with error 4



**Additional information**
Add any other context information about the problem here.
sparky4 commented 1 month ago

I am compiling for ibm pc

ghaerr commented 1 month ago

It seems there may be an incompatibility with the make you are running? Can you run make --version? My version of make is GNU v3.81. It seems the error is occurring quite quickly during make clean. Try that alone to confirm.

sparky4 commented 1 month ago

C:\home\sparky4\p\elks> make --version GNU Make 4.3 Built for x86_64-pc-linux-gnu Copyright (C) 1988-2020 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

ghaerr commented 1 month ago

This is quite strange; have you tried building before using exactly this method? I am trying to ascertain whether this is a new issue, or perhaps something to do with Debian 12.

Are you running Debian or Windows? I see your path is C:\home\sparky4\p\elks: that's Windows isn't it? The ELKS build is completely untested on Windows. I found the following post explaining that having a backslash in your PATH can cause this problem.

Can you try a simple make clean, then make, to see if that works? If not, then we're likely dealing with incompatibility with your system using Windows-style pathnames separated with backslashes; I won't have a fix for that.

sparky4 commented 1 month ago

oh the prompt thing is a custom one dont worry the actual pwd is

C:\home\sparky4\p\elks> pwd
/home/sparky4/p/elks
sparky4 commented 1 month ago

i think it's a new issue. i was able to compile it before. i dont know what happened the last few months. i just cannot make libc anymore

toncho11 commented 1 month ago

If this is a fresh install of Debian then you need to do something like that in the beginning: apt install build-essential or remove your old copy of elks source and git clone again.

toncho11 commented 1 month ago

I am using WSL (Windows Subsystem for Linux)/Ubuntu 20. I did git pull and I managed to compile ELKS on the second time. First time there was some error, but it works for me.

floriangit commented 1 month ago

I'm on Debian 12 as well. Same make version as well. Works. It does not look like ELKS build uses your (exotic) $PS1 to set something odd, but I'm not sure about it much, so maybe try to change it to debian default (and have a clean git clone of ELKS as toncho11 mentioned).

ghaerr commented 1 month ago

It does not look like ELKS build uses your (exotic) $PS1 to set something odd, but I'm not sure about it much, so maybe try to change it to debian default

Agree, I would try changing the prompt, just in case.

sparky4 commented 1 month ago

oh ok ill do that

sparky4 commented 1 month ago

image nope still not compiling

ghaerr commented 1 month ago

Are you running ./build.sh or make clean? The latter is preferred. It also looks like perhaps you may not have configured ELKS. The preferred way to do this is:

$ make menuconfig
(check that .config exists)
$ make clean
$ make

Don't run ./build.sh, it may be contributing to the problem?

ghaerr commented 1 month ago

I would also run the above without any fancy prompt - it looks like you may be running a prompt with a linefeed in it? Try with standard PS1= to eliminate variables, since both @toncho11 and @floriangit are saying this is working fine for them.

I see you got an earlier "ELKS is not configured yet" as well as an error in "Keymaps" directory... it appears as though the build.sh script is continuing and not stopping with errors, which will contribute to the problem. You might want to do as @toncho11 suggested and remove everything and start with a git clone or git pull from scratch, and then only use "make" as described above, no shell scripts.

sparky4 commented 1 month ago

ok ill do that

sparky4 commented 1 month ago

image

sparky4 commented 1 month ago

image

ghaerr commented 1 month ago

You're still running a shell script. That's not 'make clean' by itself.

ghaerr commented 1 month ago

Nonetheless, something is definitely wrong with the build environment. I don't know what it is, and I cannot duplicate it since I don't have a Windows or Linux box.

ghaerr commented 1 month ago

The screenshots don't show enough history for me to see what you are doing. I will need a complete execution history in order to debug more. It is possible that the cross development environment is improper, because that is more closely connected to the C library build. You might try 'make kimage' to attempt a kernel only build. I also need you to tell me the results of the explicit instructions that I gave you a couple posts ago.

tyama501 commented 1 month ago

I had a chance to download debian-12.7.0-amd64-DVD-1.iso. I may try to install it later.

tyama501 commented 1 month ago

Hello from Debian 12.7. OK, I got the system up. I will try to get elks environment later this week.

sparky4 commented 1 month ago

let me build the kernel then

sparky4 commented 1 month ago

it is working! :D

ghaerr commented 1 month ago

If it is now working, I suspect the problem was/is that you were running ./build.sh, a shell script that doesn't work with WSL, while make, make clean or make kimage works. Please confirm.

sparky4 commented 1 month ago

make and make clean never worked but make kimage works just fine

tyama501 commented 1 month ago

make kimage is only for kernel, right?

sparky4 commented 1 month ago

yeah it seems

tyama501 commented 1 month ago

Hi @sparky4

Are you using build.sh in the repository root or are you using tools/build.sh?

I am now following steps here that uses tools/build.sh https://github.com/ghaerr/elks/blob/master/BUILD.md

tyama501 commented 1 month ago

I am still building the compiler but it seems that mtool in my Debian is v4.0.33. That may not work for PC-98. https://github.com/ghaerr/elks/pull/1463

tyama501 commented 1 month ago

I could build gcc and started building elks.

I got xxd: not found. I think I have seen this error before (on FreeBSD) image

tyama501 commented 1 month ago

OK I could apt-get it.

tyama501 commented 1 month ago

I got error in elkscmd/sys_utils.

image

default .config creating by build.sh seems old. I'll try make after copying ibmpc-1440.config to .config.

ghaerr commented 1 month ago

The makeboot.c compilation error is because xxd failed creating the autogenerate header file mbr_autogen.c earlier in elks-master/bootblocks/Makefile:

mbr.bin: mbr.S
    $(CC) $(INCLUDES) -E -o mbr.tmp mbr.S
    $(AS) $(ASFLAGS) -o mbr.o mbr.tmp
    $(LD) $(LDFLAGS) -M -o mbr.bin mbr.o > mbr.map
    xxd -i mbr.bin > mbr_autogen.c

You'll probably have to make clean after installing xxd then restart.

If you've gotten this far, that's farther than @sparky4 got, since make clean is where he's getting his error, and I really don't know why.

tyama501 commented 1 month ago

OK. Done. The following worked.

cp -a ibmpc-1440.config .config make menuconfig make clean make

image

I could make fd1440.img.

So, basically it can be built with Debian 12.7 on native PC, if correct .config is used.

ghaerr commented 1 month ago

Thanks for the full build test on Debian 12/WSL @tyama501. I am glad to know see that it works well, and that one should copy the ibmpc-1440.config to .config first. We will see whether @sparky4 can make this work on his repo, or whether a fresh git clone might have to be performed. It appears that @sparky4 built the entire toolchain at one time using tools/build.sh but that ./build.sh doesn't work and now a simple make clean doesn't work on his system.

@sparky4: you might also do a git diff to show if any files have been modified. Also, have you ever built ELKS previously on WSL/Debian?

floriangit commented 1 month ago

since make clean is where he's getting his error

@sparky4

just copy & paste:

make clean 1>my.log 2>&1 ; make 1>>my.log 2>&1

and post the my.log file here would help indeed. I've used build.sh on Debian12 as well and it worked.

sparky4 commented 1 month ago

ok let me try

sparky4 commented 1 month ago

git diff is empty and here is the log my.log

sparky4 commented 1 month ago

yes i previously built elks on both debian systems and they worked before the git pull/git clone

sparky4 commented 1 month ago

/home/sparky4/p/elks/libc/asm/Makefile:23: *** target pattern contains no '%'. Stop. this is the error

ghaerr commented 1 month ago

@sparky4, can you try editing libc/asm/Makefile and replacing the following line:

clean:
        $(RM) *.[aod]

with

clean:
        rm -f *.o *.a *.d

Note that the rm -f must be preceded with a TAB character, so don't edit to the left of $(RM), just replace $(RM) with rm -f.

If that doesn't work, can you run printenv or env and post the results or screenshot?

ghaerr commented 1 month ago

Finally if the above three don't work, take the date/time out of your PS1= prompt. make gets confused when it runs into colons and this could cause the issue. You should try running with a standard PS1= prompt, not your custom version.

sparky4 commented 1 month ago

i think it's a synthax error

printenv
OWDOCBUILD=1
SHELL=Bourne
SESSION_MANAGER=local/compy4:@/tmp/.ICE-unix/2942,unix/compy4:/tmp/.ICE-unix/2942,inet6/compy4:43337,inet/compy4:38331
WINDOWID=41943077
QT_ACCESSIBILITY=1
COLORTERM=truecolor
PALMDEV=/home/sparky4/p/palmdev_V3
XDG_CONFIG_DIRS=/etc/xdg
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
HISTCONTROL=ignoreboth
XDG_MENU_PREFIX=xfce-
GTK_IM_MODULE=ibus
PKG_CONFIG_PATH=/home/sparky4/install/lib/pkgconfig/:/home/sparky4/install/share/pkgconfig/
TOPDIR=/home/sparky4/p/elks
SSH_AUTH_SOCK=/tmp/ssh-XXXXXXUTXFtI/agent.2942
OWGUINOBUILD=1
OS=LINUX
DEV_HOME=/home/sparky4/p/nouveau/
WIPFC=/dos/fdos/watcom/wipfc
XMODIFIERS=@im=ibus
DESKTOP_SESSION=xfce
SSH_AGENT_PID=3166
ACLOCAL=aclocal -I /home/sparky4/install/share/aclocal
GTK_MODULES=gail:atk-bridge
XDG_SEAT=seat0
ENV=LINUX
PWD=/home/sparky4/p/elks
LOGNAME=sparky4
XDG_SESSION_DESKTOP=xfce
NVD=/home/sparky4/install
XDG_SESSION_TYPE=x11
REXX=/usr/bin/rexx
XAUTHORITY=/home/sparky4/.Xauthority
XDG_GREETER_DATA_DIR=/var/lib/lightdm/data/sparky4
GDM_LANG=en_US.utf8
HOME=/home/sparky4
LANG=en_US.UTF-8
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.swp=00;90:*.tmp=00;90:*.dpkg-dist=00;90:*.dpkg-old=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:
XDG_CURRENT_DESKTOP=XFCE
VTE_VERSION=7006
OWOBJDIR=binbuild
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
CROSSDIR=/home/sparky4/p/elks/cross
CLUTTER_IM_MODULE=ibus
WATCOM=/dos/fdos/watcom
XDG_SESSION_CLASS=user
TERM=xterm-16color
USER=sparky4
ROOT=/home/sparky4/p/osfree
DISPLAY=:0.0
INCLUDE=/usr/include/
MESA_INSTALLDIR=/home/sparky4/p/mesa/
SHLVL=1
TOOLS=/home/sparky4/p/osfree/bin/tools
QT_IM_MODULE=ibus
XDG_VTNR=7
XDG_SESSION_ID=1
LD_LIBRARY_PATH=/home/sparky4/install/lib
XDG_RUNTIME_DIR=/run/user/1000
PS1=\[\033[1;32m\]\[\033[45m\]\[\033[1;35m\]\[\033[45m\][\[\033[1;32m\]\[\033[45m\]\t\[\033[1;35m\]\[\033[45m\]]\[\033[1;34m\]\[\033[45m\][\[\033[1;32m\]\[\033[45m\]\w\[\033[1;34m\]\[\033[45m\]]\[\033[40m\]\[\033[1;32m\]\n\[\033[40m\]\[\033[1;34m\][\[\033[40m\]\[\033[1;32m\]\u\[\033[40m\]\[\033[1;35m\]@\[\033[40m\]\[\033[1;32m\]\h\[\033[40m\]\[\033[1;34m\]]\[\033[40m\]\[\033[1;32m\]$\[\033[1;32m\]\[\033[40m\]\[\033[1;32m\] 
OWDOSBOX=dosbox
OWROOT=/home/sparky4/p/watcom2
WD_PATH=/dos/fdos/watcom/binl
XDG_DATA_DIRS=/usr/share/xfce4:/home/sparky4/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop:/usr/share
PATH=/home/sparky4/p/elks/elks/tools/bin:/home/sparky4/p/elks/cross/bin:/usr/lib/firefox:/home/sparky4/.local/bin:/dos/fdos/watcom/binl:/home/sparky4/p/osfree/bin/tools:/home/sparky4/p/osfree:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
GDMSESSION=xfce
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
OWTOOLS=GCC
LIB=
_=/usr/bin/printenv
tyama501 commented 1 month ago

Hi @sparky4

Are you in master branch? If you got trouble after git pull you might not in master. git branch can check it.

Also git diff HEAD show nothing right?

tyama501 commented 1 month ago

Have you tried this? cp -a ibmpc-1440.config .config make menuconfig make clean make

tyama501 commented 1 month ago

One more thing.

git status

can show modified files.

Some files may failed while merging when git pull.

sparky4 commented 1 month ago

yeah i did the copy the config file i am compiling it rn!

ghaerr commented 1 month ago

Thanks for the printenv output @sparky4. I was hoping to see something abnormal in PATH=, but it looks OK.

yeah i did the copy the config file i am compiling it rn!

I take that to mean you can compile with make kimage but not make clean?

clean:
        rm -f *.o *.a *.d

Did you try the above change, detailed in my post above?

Can you try changing your prompt using export PS1=sparky and then running make clean?

The only other item that is a unfamiliar is SHELL=Bourne, rather than SHELL=/bin/sh or something like that. Can you change to BASH Shell somehow, or is Bourne the WSL option?

sparky4 commented 1 month ago

hmmm i think it is make itself being problematic.. i tried on both machines