Skip to content

Is there a way to disable the implicit -L/usr/lib64 with architecture "x86_64" #2612

@Emily-TTG

Description

@Emily-TTG

What's your question?
When building a project with the architecture set to x86_64 and the compiler being either GCC or Clang (only tested with gmake, unsure about other backends), premake adds a -L/usr/lib64 near the start of the linker command line. This leads to the linker preferring system libraries over ones specified in linkoptions that appear later in the command line.

Some of my library paths are specified via. linkoptions as I am consuming pkg-config output.

Is there a way to disable this behaviour while still having the architecture set? It is undesirable for me as I want to ensure my project draws from local dependencies during linkage instead of whatever system ones the user may or may not have installed.

Anything else we should know?
A basic reproduction of this issue can be achieved by the following:

-- premake5.lua
workspace "Workspace"
	configurations { "Debug", "Release" }

	project "Test"
		kind "ConsoleApp"
		architecture "x86_64"

		files { "test.c" }
		linkoptions { "-Lwhatever" }
$ premake5 gmake
$ make verbose=1
...
g++ -o "bin/Debug/Test" obj/Debug/test.o   -L/usr/lib64 -m64 -s -Lwhatever

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions