TOPDIR env causes LD to not find required files
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 27
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
I faced this issue while making a custom embedded OS with the help of Buildroot, due to Buildroot setting a TOPDIR env for the build process. Verified this issue by locally building gun-efi (master) using "TOPDIR=~/topdir make" command. When executed, the build rocess fails with the following error :
ld -nostdlib --warn-common --no-undefined --fatal-warnings --build-id=sha1 -z nocombreloc -shared -Bsymbolic -L/home/neel/gnu-efi//apps/../x86_64/lib -L/home/neel/gnu-efi//apps/../x86_64/gnuefi /home/neel/gnu-efi//apps/../x86_64/gnuefi/crt0-efi-x86_64.o t.o -o t.so -lefi -lgnuefi /usr/lib/gcc/x86_64-linux-gnu/11/libgcc.a -T /home/neel/gnu-efi//apps/../gnuefi/elf_x86_64_efi.lds
ld: cannot find /home/neel/gnu-efi//apps/../x86_64/gnuefi/crt0-efi-x86_64.o: No such file or directory
ld: cannot find -lefi: No such file or directory
ld: cannot find -lgnuefi: No such file or directory
make[1]: * [/home/neel/gnu-efi//apps/../Make.rules:51: t.so] Error 1
make[1]: Leaving directory '/home/neel/testtesttest/x86_64/apps'
make: * [Makefile:82: apps] Error 2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Make.rules:51 and Makefile:82, then reproduce the failure using "TOPDIR=~/topdir make" while building gun-efi. Trace how TOPDIR changes the paths passed to ld and compare them with the generated build paths. Done means the build completes with TOPDIR set and required EFI files and libraries are found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100