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

ld: Error: unable to disambiguate: -nodefaultlibs (did you mean --nodefaultlibs ?) #9

Closed
anta40 opened this issue Oct 11, 2022 · 3 comments

Comments

@anta40
Copy link

anta40 commented Oct 11, 2022

I'm trying to build xv6-x86_64 on Debian testing 64 (gcc 12 is already installed)
Running make xv6.img yield this:

No rule to make target /.d
gcc -fno-builtin -fno-pic -m32 -nostdinc -Iinclude -Os -o out/bootmain.o -c kernel/bootmain.c
gcc -fno-builtin -fno-pic -m32 -nostdinc -Iinclude -o out/bootasm.o -c kernel/bootasm.S
ld -m elf_i386 -nodefaultlibs --omagic -e start -Ttext 0x7C00
-o out/bootblock.o out/bootasm.o out/bootmain.o
ld: Error: unable to disambiguate: -nodefaultlibs (did you mean --nodefaultlibs ?)
make: *** [Makefile:137: out/bootblock] Error 1

@Li-Guangda
Copy link
Contributor

Li-Guangda commented Jul 17, 2023

Fix it by replacing the -nodefaultlibs with -z nodefaultlib.

@jserv
Copy link
Owner

jserv commented Jul 17, 2023

@Li-Guangda, Thanks for this information. Can you please send a pull request?

@anta40
Copy link
Author

anta40 commented Jul 17, 2023

@Li-Guangda Thanks. At least it fixed 1 issue. There are more issues, though.

Running make again gave you this:

user/sh.c: In function ‘runcmd’:
user/sh.c:58:1: error: infinite recursion detected [-Werror=infinite-recursion]

Whoops. Hmm quick Google search told me to remove -Werror from CFLAFS. Let's run make again. Got different error:

out/mkfs fs.img .fs/README .fs/cat .fs/chmod .fs/echo .fs/forktest .fs/grep .fs/init .fs/kill .fs/ln .fs/ls .fs/mkdir .fs/rm .fs/sh .fs/stressfs .fs/usertests .fs/wc .fs/zombie
nmeta 29 (boot, super, inode blocks 26, bitmap blocks 1) blocks 941 log 30 total 1000
mkfs: tools/mkfs.c:268: iappend: Assertion `fbn < MAXFILE' failed.
make: *** [Makefile:247: fs.img] Aborted
make: *** Deleting file 'fs.img'

Li-Guangda added a commit to Li-Guangda/xv6-x86_64 that referenced this issue Jul 17, 2023
Replace all -nodefaultlibs option for ld with -z nodefaultlib.
@jserv jserv closed this as completed in 117208b Jul 22, 2023
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