premake / premake/premake-core

link shared project with wrong *.so file path

Open
#160 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

here is my directory tree

.
├── build
│   └── debug
├── libs
│   ├── extstr
│   │   ├── src [shared lib]
│   │   └── test [execute each file]
├── prj
│   └── obj
│       └── debug
│           ├── extstr
│           ├── extstr_main
└── utils
    └── describe
solution "framework"
        location "prj"
        language "C" 
        configurations {"debug", "release"}

        filter "configurations:debug"
                defines { "DEBUG" }
                flags { "Symbols" }
                targetdir "build/debug"

        filter "configurations:release"
                defines { "NDEBUG" }
                optimize "On"
                targetdir "build/release"

libs = os.matchdirs("libs/*")
for _, lib in pairs(libs) do
        libname = path.getbasename(lib)
        project (libname)
        kind "SharedLib"
        files ("libs/"..libname.."/src/*.c")

        tests = os.matchfiles("libs/"..libname.."/test/*.c")
        print(tests)
        for _, test in pairs(tests) do
                print ("test file:", test)
                testname = path.getbasename(test)
                project(libname.."_"..testname)
                kind "ConsoleApp"
                includedirs {lib.."/src", "utils/describe"}
                print ("*** lib name is", libname)
                links {libname}
                files (test)
        end 
end
[root@localhost framework]# tree build/
build/
└── debug
    ├── extstr_main
    └── libextstr.so

[root@localhost debug]# ldd extstr_main 
        linux-vdso.so.1 =>  (0x00007fff003e6000)
        ../build/debug/libextstr.so => not found
        libc.so.6 => /lib64/libc.so.6 (0x00007f33fb9da000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f33fbdad000)
[root@localhost debug]# 

am i wrong ?

how can't link the shared project correctly?

thanks!

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

Reproduce the issue with the provided Premake Lua script and inspect the generated projects and build/debug outputs. Run ldd on extstr_main and compare its recorded shared-library path with the location of libextstr.so; done means the executable resolves the shared project without the incorrect relative path.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, lua
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.