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

x86_64-elf-ld: error: linker script file 'linker_script' appears multiple times #1536

Open
quantumsheep opened this issue Jul 13, 2021 · 7 comments

Comments

@quantumsheep
Copy link
Contributor

I'm having this error when building on macOS:

$ make run-noaccel                                            
[Some building logs...]
LD      /Users/qtmsheep/Development/nanos/output/platform/pc/boot/bin/stage2.elf
x86_64-elf-ld: error: linker script file 'linker_script' appears multiple times
make[2]: *** [/Users/qtmsheep/Development/nanos/output/platform/pc/boot/bin/stage2.elf] Error 1
make[1]: *** [boot] Error 2
make: *** [image] Error 2
@quantumsheep
Copy link
Contributor Author

Running a dry-run using make run-noaccel -n, here's the concerned command:

echo "LD	/Users/qtmsheep/Development/nanos/output/platform/pc/boot/bin/stage2.elf"; x86_64-elf-ld -L/usr/local/opt/ncurses/lib -L/usr/local/opt/qt/lib -L/usr/local/opt/gstreamer/lib -L/usr/local/opt/gst-plugins-base/lib -L/usr/local/opt/freeglut/lib -L/usr/local/opt/openssl/lib --gc-sections -n --undefined=_start -T linker_script --gc-sections -n -T linker_script   /Users/qtmsheep/Development/nanos/output/platform/pc/boot/platform/pc/boot/stage2.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/platform/pc/boot/service32.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/drivers/ata.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/kernel/elf.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/kernel/kvm_platform.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/kernel/pagecache.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/runtime/buffer.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/runtime/extra_prints.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/runtime/format.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/runtime/memops.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/runtime/range.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/runtime/rbtree.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/runtime/runtime_init.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/runtime/pqueue.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/runtime/sg.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/runtime/symbol.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/runtime/table.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/runtime/timer.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/runtime/tuple.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/runtime/merge.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/runtime/string.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/x86_64/page.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/x86_64/serial.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/tfs/tfs.o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/src/tfs/tlog.o   -o /Users/qtmsheep/Development/nanos/output/platform/pc/boot/bin/stage2.elf

As we can see we have two -T linker_script in the same command:

--undefined=_start -T linker_script --gc-sections -n -T linker_script

@quantumsheep
Copy link
Contributor Author

I got it building by changing LDFLAGS+= to LDFLAGS= here:

LDFLAGS+= $(KERNLDFLAGS) -T linker_script

It will need further reviewing as it doesn't seem like a great way of solving the issue 🙃

@sanderssj
Copy link
Collaborator

What's your version of OS X? I haven't seen this on 10.14.

@quantumsheep
Copy link
Contributor Author

quantumsheep commented Jul 13, 2021

@sanderssj Big Sur 11.4

@sanderssj
Copy link
Collaborator

I tried to build on a Big Sur machine and still can't duplicate. Can you give me the output of these commands?

pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
pkgutil --pkg-info=com.apple.pkg.CLTools_SDK_macOS110
xcode-select -p
which make
make --version

@quantumsheep
Copy link
Contributor Author

pkgutil --pkg-info=com.apple.pkg.CLTools_Executables

No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.

pkgutil --pkg-info=com.apple.pkg.CLTools_SDK_macOS110

No receipt for 'com.apple.pkg.CLTools_SDK_macOS110' found at '/'.

xcode-select -p

/Applications/Xcode.app/Contents/Developer

which make

/usr/bin/make

make --version

GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0

@sanderssj
Copy link
Collaborator

Thanks for the information. I'm still not able to duplicate the problem, and I'm not sure where a second expansion would be happening. Would you mind trying to install the xcode command line tools and switching to those and trying to build a freshly cloned repo?

xcode-select --install
sudo xcode-select -s /Library/Developer/CommandLineTools

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

2 participants