-
-
Notifications
You must be signed in to change notification settings - Fork 616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Build Premake5] How to tell it to use system libraries #2386
Comments
If you're on Linux, you need to run the build script like: PLATFORM=x64 CONFIG=release PREMAKE_OPTS="--lib-src=system --cc=gcc" ./Bootstrap.sh As for Windows, I don't think we've built that in at the moment. @samsinsane I know you were the last one to touch the build matrices, do you know what would be required to get system libraries up and running for mingw? I think that may be easier than the MSVC builds. |
This is what is required for any system:
As for MinGW specifically, I have no idea what's required to get it working. I know of MinGW, but that's kind of where my knowledge about it ends. |
packages should normally be: |
I'm trying under MSYS2 shell (all dependencies are installed). PLATFORM=x64 CONFIG=release PREMAKE_OPTS="--lib-src=system --cc=gcc" ./Bootstrap.sh results in:
So I tried CC=gcc PLATFORM=x64 CONFIG=release PREMAKE_OPTS="--lib-src=system" ./Bootstrap.sh which results in:
|
It seems you don't have the latest source, there was a bug than On my side, I'm trying to improve mingw CI to add the matrix for dependency (https://github.com/Jarod42/premake-core/tree/CI_mingw_depsrc). |
@Jarod42 might be due to this line:
The original builds used |
Indeed, that what that... |
@chadchoi Can you confirm if the latest sources work as depicted in the CI file? |
|
To resume: For 64 bits:
For 32 bits, in case you prefer:
|
I'm using an environment where I build all dependencies from source (rather than MSYS2's When I ran: PLATFORM=x64 CONFIG=release PREMAKE_OPTS="--lib-src=system" ./Bootstrap.sh I got:
But when I ran: CC=gcc PLATFORM=x64 CONFIG=release PREMAKE_OPTS="--lib-src=system" ./Bootstrap.sh I got:
Which makes sense because that's not where sed -i.bak -e "s?\(#include <\)lua5.3/?\1?" src/host/premake.h src/host/curl_utils.h Then the result was:
To get past that (as it's only for displaying an error) I did this dirty fix: patch -ulbf src/host/debug_prompt.c << EOF
@@ -37,3 +37,3 @@
l_message(progname, lua_pushfstring(L,
- "error calling " LUA_QL("print") " (%s)",
+ "error calling print (%s)",
lua_tostring(L, -1))
EOF Finally, there was a linker error:
which I fixed with: sed -i.bak -e "s/\(links.*lua\)[0-9.]*/\1/" premake5.lua but this should really be properly configured with Anyway, this did give me a Then I tries 32-bit, but this gave the following errors:
The reason for the indefined sed -i.bak -e '1i #if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600\n#undef _WIN32_WINNT\n#define _WIN32_WINNT 0x0600\n#endif' src/host/os_linkdir.c src/host/os_linkfile.c But maybe (if possible) the symbolic link stuff should just be skipped when building for older Windows versions. |
Additional question: What should |
For the Lua version, I think the answer is to install a matching version of Lua or patch like you did and hope for the best. |
I have successfully built and deployed my project with the target arch being ARM and ARM64, while using premake as the build system. One thing I learned along the way that wasn't apparent in the beginning is that platform doesn't need to be set unless you plan to target a platform other than the host you are compiling on, which came as a surprise to me. I also ran into issues with finding and using system libs first for some edge case linux scenarios, but not once had a problem on windows (and I'm using the ancient windows 10) I will share here my premake5.lua in case it is of any help to someone workspace "Black-Tek-Server"
configurations { "Debug", "Release"}
platforms { "64", "ARM64", "ARM" }
location ""
editorintegration "On"
project "Black-Tek-Server"
kind "ConsoleApp"
language "C++"
cppdialect "C++20"
targetdir "%{wks.location}"
objdir "build/%{cfg.buildcfg}/obj"
location ""
files { "src/**.cpp", "src/**.h" }
flags {"MultiProcessorCompile"}
enableunitybuild "On"
intrinsics "On"
editandcontinue "Off"
newoption {
trigger = "lua",
description = "Specific Lua library to use. For example lua5.4. Useful if the packaged lua does not provide a symbolic liblua.so",
value = "libname",
category = "BlackTek", -- Group options together
default = "lua",
allowed = {
{"lua", "Default"},
{"lua5.4", "Use Lua 5.4"},
{"lua5.3", "Use Lua 5.3"},
}
}
newoption {
trigger = "custom-includes",
description = "A comma separated list of custom include paths.",
value = "include paths",
category = "BlackTek", -- Group options together
}
newoption {
trigger = "custom-libs",
description = "A comma separated list of custom library paths.",
value = "library paths",
category = "BlackTek", -- Group options together
}
newoption {
trigger = "verbose",
description = "Show warnings during compilation.",
category = "BlackTek" -- Group options together
}
if _OPTIONS["custom-includes"] then
includedirs { string.explode(_OPTIONS["custom-includes"], ",") }
end
if _OPTIONS["custom-libs"] then
libdirs { string.explode(_OPTIONS["custom-libs"], ",") }
end
filter "configurations:Debug"
defines { "DEBUG" }
runtime "Debug"
symbols "On"
optimize "Debug"
flags {"NoIncrementalLink"}
filter {}
filter "configurations:Release"
defines { "NDEBUG" }
runtime "Release"
symbols "Off"
optimize "Full"
filter {}
filter "platforms:64"
architecture "x86_64"
filter {}
filter "platforms:ARM64"
architecture "ARM64"
filter {}
filter "platforms:ARM"
architecture "ARM"
filter {}
filter "system:not windows"
buildoptions { "-Wall", "-Wextra", "-pedantic", "-pipe", "-fvisibility=hidden", "-Wno-unused-local-typedefs" }
linkoptions{"-flto=auto"}
flags {}
filter {}
filter "system:windows"
openmp "On"
characterset "MBCS"
linkoptions {"/IGNORE:4099"}
buildoptions {"/bigobj"}
vsprops { VcpkgEnableManifest = "true" }
symbolspath '$(OutDir)$(TargetName).pdb'
filter {}
filter "architecture:amd64"
vectorextensions "AVX"
filter{}
filter {"system:linux", "options:verbose"}
linkoptions { "-v" }
warnings "Extra"
filter {}
filter { "system:linux", "not options:verbose" }
warnings "Off"
filter {}
filter { "system:linux", "architecture:ARM" }
-- Paths to vcpkg installed dependencies
libdirs { "vcpkg_installed/arm-linux/lib", "/usr/arm-linux-gnueabihf" }
includedirs { "vcpkg_installed/arm-linux/include", "/usr/arm-linux-gnueabihf" }
filter{}
filter { "system:linux", "architecture:ARM64" }
-- Paths to vcpkg installed dependencies
libdirs { "vcpkg_installed/arm64-linux/lib", "/usr/arm-linux-gnueabi" }
includedirs { "vcpkg_installed/arm64-linux/include", "/usr/arm-linux-gnueabi" }
filter{}
filter { "system:linux", "architecture:amd64" }
-- Paths to vcpkg installed dependencies
libdirs { "vcpkg_installed/x64-linux/lib" }
includedirs { "vcpkg_installed/x64-linux/include" }
filter{}
filter "system:linux"
-- Common Linux paths
libdirs { "/usr/lib" }
includedirs { "/usr/include", "/usr/include/lua5.*" }
links { "pugixml", _OPTIONS["lua"], "fmt", "mariadb", "cryptopp", "boost_iostreams", "zstd", "z", "curl", "ssl", "crypto" }
filter{}
filter "toolset:gcc"
buildoptions { "-fno-strict-aliasing" }
filter {}
filter "toolset:clang"
buildoptions { "-Wimplicit-fallthrough", "-Wmove" }
filter {}
filter { "system:macosx", "action:gmake" }
buildoptions { "-fvisibility=hidden" }
filter {} |
It sounds like all questions have been answered and issues resolved. I'm going to close this off as it has greatly deviated from the original question. If there are any other questions or issues, please feel free to open a new issue. |
instead of building its own libraries from the source code it included in
contrib
.brechtsanders/winlibs_mingw#244
The text was updated successfully, but these errors were encountered: