akkartik / mu

Soul of a tiny new machine. More thorough tests → More comprehensible and rewrite-friendly software → More resilient society.
http://akkartik.name/akkartik-convivial-20200607.pdf
Other
1.38k stars 47 forks source link

undefined reference to... #38

Closed krionical closed 4 years ago

krionical commented 4 years ago

First of all, neat project. Second of all, I get the following list of errors:

ld: common.o: in function sprintf_va': common.c:(.text+0x836): undefined reference tostack_chk_fail_local' ld: common.o: in function sprintf': common.c:(.text+0x89b): undefined reference to__stack_chk_fail_local' ld: common.o: in function printkf': common.c:(.text+0x96e): undefined reference tostack_chk_fail_local' ld: common.o: in function getCpuFlags': common.c:(.text+0xa4d): undefined reference tostack_chk_fail_local' ld: fatfilesystem.o: in function initializeFatFileSystem': fatfilesystem.c:(.text+0x96): undefined reference to__stack_chk_fail_local' ld: fatfilesystem.o:fatfilesystem.c:(.text+0x2ef): more undefined references to `stack_chk_fail_local' follow ld: kernel.bin: hidden symbol `__stack_chk_fail_local' isn't defined ld: final link failed: bad value make: *** [Makefile:10: kernel.bin] Error 1

In response to running the command: sudo ./gen_soso_iso init.soso examples/ex6.subx

Operating system is arch derivative.

akkartik commented 4 years ago

Thank you for the report. Let me try to spin up an Arch VM and see what's going on.

Could you try the other steps further down? You can run Mu without an OS so it emits ELF binaries you can run directly atop Linux. I'm curious if those commands all work.

krionical commented 4 years ago

No trouble. Yes, several of the 42 examples worked.

On Fri, Oct 18, 2019 at 5:33 PM Kartik Agaram notifications@github.com wrote:

Thank you for the report. Let me try to spin up an Arch VM and see what's going on.

Could you try the other steps further down? You can run Mu without an OS so it emits ELF binaries you can run directly atop Linux. I'm curious if those commands all work.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/akkartik/mu/issues/38?email_source=notifications&email_token=AE3VKHBNV6666QH6DCTHWX3QPI2UNA5CNFSM4JCMO5F2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBWIXRA#issuecomment-543984580, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE3VKHF5KPR42F5Q5CB5A43QPI2UNANCNFSM4JCMO5FQ .

-- Joe Bill Schirtzinger Beit Eshel Elder/Director http://www.beitesheldonate.org | (270) 681-5728 http://www.theroyalrainbow.com

akkartik commented 4 years ago

I'm trying to reproduce. So far I have an Arch instance that passes ./test_apps.

Now I tried ./gen_soso_iso init.soso examples/ex6.subx and got this:

losetup: cannot find an unused loop device: No such device

Do you happen to know what package I need to pacman -S to install losetup?

akkartik commented 4 years ago

It looks like I may need to compile Soso with -fno-stack-protector somehow:

https://ubuntuforums.org/showthread.php?t=352642&s=b2839b58b613292d57ef7550af87ebca&p=10100263#post10100263

That's the initial hypothesis.

krionical commented 4 years ago

Yep. That's where i got to before I reported it. I'm not sure how to do that. I tried the no flag in conjunction with the command just for fun, and that didn't work.

On Fri, Oct 18, 2019 at 7:31 PM Kartik Agaram notifications@github.com wrote:

It looks like I may need to compile Soso with -fno-stack-protector somehow:

https://ubuntuforums.org/showthread.php?t=352642&s=b2839b58b613292d57ef7550af87ebca&p=10100263#post10100263

That's the initial hypothesis.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/akkartik/mu/issues/38?email_source=notifications&email_token=AE3VKHDZAQVEEPES64PN7PTQPJIOFA5CNFSM4JCMO5F2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBWSJDA#issuecomment-544023692, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE3VKHF3NJTKY6TZY2ZUQFTQPJIOFANCNFSM4JCMO5FQ .

-- Joe Bill Schirtzinger Beit Eshel Elder/Director http://www.beitesheldonate.org | (270) 681-5728 http://www.theroyalrainbow.com

akkartik commented 4 years ago

Ok, I've reproduced the issue after installing the following packages on Arch Linux:

# pacman -S git gcc make nasm util-linux dosfstools

Now trying to fix the error.

akkartik commented 4 years ago

Try it now? I've also updated the Readme with some extra dependencies that Arch Linux needed.

krionical commented 4 years ago

No, it still complains on my system of the same issue after issuing a git pull and making sure all dependencies are installed. If it runs on arch, however, it is likely to be an issue with my specific arch derivative although one would think the dependencies would be fairly consistent. I'm running Magpie in case anyone else has this issue.

On Sat, Oct 19, 2019 at 1:15 AM Kartik Agaram notifications@github.com wrote:

Try it now? I've also updated the Readme with some extra dependencies that Arch Linux needed.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/akkartik/mu/issues/38?email_source=notifications&email_token=AE3VKHAQXJQLTITB7ATKNI3QPKQY7A5CNFSM4JCMO5F2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBXGP6A#issuecomment-544106488, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE3VKHDHGKGVRYDA6GGBDR3QPKQY7ANCNFSM4JCMO5FQ .

-- Joe Bill Schirtzinger Beit Eshel Elder/Director http://www.beitesheldonate.org | (270) 681-5728 http://www.theroyalrainbow.com

akkartik commented 4 years ago

Just to double-check, are you seeing -fno-stack-protector in kernel.soso/Makefile? That's the change I made.

Could you copy a log of the whole build here? Thank you.

krionical commented 4 years ago

Yes, the change is present in the makefile.

Here is the copy of the logging I have:

== building SubX binary === constructing initramfs out of SubX binary 1+0 records in 1+0 records out 8388608 bytes (8.4 MB, 8.0 MiB) copied, 0.39788 s, 21.1 MB/s mkfs.fat 4.1 (2017-01-24) === building soso kernel ld -Tlink.ld -m elf_i386 -o kernel.bin descriptortables.o screen.o common.o fatfilesystem.o spinlock.o systemfs.o mouse.o debugprint.o random.o null.o fatfs_ffunicode.o gfx.o syscalls.o alloc.o fifobuffer.o hashtable.o tty.o timer.o fs.o rootfs.o ttydriver.o framebuffer.o elf.o ramdisk.o keyboard.o vmm.o main.o serial.o sharedmemory.o sleep.o isr.o list.o devfs.o pipe.o message.o process.o fatfs_ff.o task.o utils.o boot.o gdt.o interrupt.o font/font.o ld: common.o: in function sprintf_va': common.c:(.text+0x836): undefined reference tostack_chk_fail_local' ld: common.o: in function sprintf': common.c:(.text+0x89b): undefined reference to__stack_chk_fail_local' ld: common.o: in function printkf': common.c:(.text+0x96e): undefined reference tostack_chk_fail_local' ld: common.o: in function getCpuFlags': common.c:(.text+0xa4d): undefined reference tostack_chk_fail_local' ld: fatfilesystem.o: in function initializeFatFileSystem': fatfilesystem.c:(.text+0x96): undefined reference to__stack_chk_fail_local' ld: fatfilesystem.o:fatfilesystem.c:(.text+0x2ef): more undefined references to `stack_chk_fail_local' follow ld: kernel.bin: hidden symbol `__stack_chk_fail_local' isn't defined ld: final link failed: bad value make: *** [Makefile:12: kernel.bin] Error 1

Do you have some more detailed logging available within the project, or is the sufficient?

On Sat, Oct 19, 2019 at 10:07 AM Kartik Agaram notifications@github.com wrote:

Just to double-check, are you seeing -fno-stack-protector in kernel.soso/Makefile? That's the change I made.

Could you copy a log of the whole build here? Thank you.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/akkartik/mu/issues/38?email_source=notifications&email_token=AE3VKHGCWN2IYRQZJMT2YT3QPMPELA5CNFSM4JCMO5F2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBXS4MI#issuecomment-544157233, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE3VKHECSJV5XLORMRYW7K3QPMPELANCNFSM4JCMO5FQ .

-- Joe Bill Schirtzinger Beit Eshel Elder/Director http://www.beitesheldonate.org | (270) 681-5728 http://www.theroyalrainbow.com

akkartik commented 4 years ago

Ohh, stupid mistake on my part. You need to make clean. These commands should do it:

cd kernel.soso
make clean
cd ..

Then try rerunning gen_soso_iso?

Sorry about the trouble!

krionical commented 4 years ago

By Jove, that got it! Thanks for your help in sorting this issue out.

On Sat, Oct 19, 2019 at 10:51 AM Kartik Agaram notifications@github.com wrote:

Ohh, stupid mistake on my part. You need to make clean. These commands should do it:

cd kernel.soso make clean cd ..

Then try rerunning gen_soso_iso?

Sorry about the trouble!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/akkartik/mu/issues/38?email_source=notifications&email_token=AE3VKHH7EUCXTB2BJEPSFA3QPMUJ7A5CNFSM4JCMO5F2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBXUNYQ#issuecomment-544163554, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE3VKHAQ3R3QATCCU3LTUBLQPMUJ7ANCNFSM4JCMO5FQ .

-- Joe Bill Schirtzinger Beit Eshel Elder/Director http://www.beitesheldonate.org | (270) 681-5728 http://www.theroyalrainbow.com

akkartik commented 4 years ago

Thank you for putting up with this klunky experience! Clearly the bootable images aren't yet mature. But the ELF binary generation should be much more painless. I ended up emphasizing that more in the Readme, based on this thread. So thanks again!