premake/premake-4.x

Incorrect linking of shared libraries for gmake

stevegee58 opened this issue · 2 comments

With gmake, when I build a shared library and an executable that links to it, the resulting makefile uses static linking to the .so file instead of using "-l" to link to it. The resulting executable will work with the .so file but only under very specific conditions. If I hand edit the makefile to use "-l" and move the .so file somewhere in my search path the executable works then.
Sorry if this isn't clear but it's a little hard to explain.

I have a tar.gz file with a complete project with source files to demonstrate this problem. Unfortunately I can't attach it here. I'll send it via email if you want.

There has been some work done on this recently premake-core (Premake 5). If you get a chance can you try with the latest code from there and see if it behaves any better?

I just tried premake5 and it does the same thing. The generated .make file for the executable is using the statically linked syntax on the ld command instead of using the "-l" switch.

Also, in my example I'm building both the shared lib and the executable in the same premake4.lua file. Each is its own project within the top level solution.

As a science experiment I split it up into 2 premake4.lua files, one for the executable and the other for the shared library. In that case the executable was linked correctly with the "-l" ld switch.