premake / premake/premake-core

os.findlib is not architecture aware

Open
#542 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
C
Stars
3.6k
Forks
654
Avg merge
1d 1h
Merged PRs (30d)
13

Description

os.findlib may return the path to a 32bit lib even if the current project is configured to use the x86_64 architecture.

I am not really familiar with this but it seems to be possible to check for a compatible architecture/bitness by inspecting the file header.

Unix fifth byte of the ELF header

Value Bitness
1 32 bit
2 64 bit

Windows first two bytes of COFF header

Value Architecture
0x014c x86
0x8664 x64

Therefore one possibiliy would be to ignore incompatible files (and removing their path) until os.pathsearch returns a compatible file or nil.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation of os.findlib and the os.pathsearch path-searching logic. Review how library files are identified on Unix and Windows, then use the ELF and COFF header values described in the issue to define the compatibility check; done means incompatible libraries are skipped and a compatible path or nil is returned.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, lua
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.