Replies: 16 comments 40 replies
-
Hmm... @BillyONeal what do you think about? |
Beta Was this translation helpful? Give feedback.
-
We choose static linking on the POSIX-ish platforms because dynamic linking generally forces you to use the system-provided libraries (e.g. those acquired through apt). It doesn't matter if you want to use the vcpkg version of boost in general, for example, because all the operating system's default load library paths are going to look in places owned by apt or dnf or similar. Windows is different because on Windows your app can use version 1 of a shared library, and someone else can use version 2 of that shared library, and as long as those versions have different DLL names, a program can use both versions, since all symbols from that library are namespaced into the DLL in question. In contrast, in POSIX world, all the names go into the shared process symbol table, so trying to load multiple versions of a library into the same process will usually result in memory corruption. (This is part of the problem domain and affects all non-system-wide package management solutions, so our ability to influence this is limited) |
Beta Was this translation helpful? Give feedback.
-
Yes, you are indeed right. However, checking, at least, that the package build correctly on the CI would still increase the quality of the dynamic linkage packages. I guess the package must build out-of-the-box, in all case, even if static linking is the default (which I can live with it). In the posix world, you have some mean to control where the dynamic loader finds their libraries (most notably by setting LD_LIBRARY_PATH to VCPKG 'installed' lib path). Another option, but this is harder, would be to use Agree, this is not easy, but other package management (Conan for stance) are able to (or they claim to) somewhat ensure that. |
Beta Was this translation helpful? Give feedback.
-
While it's true that other package managers have decided to make dynamic linking on the POSIX platforms a more first class citizen, we believe that leads customer confusion; hence our strong recommendation of static linking on those platforms, and that triplet's community status. We do have x64-linux-dynamic, and we do accept PRs that improve the experience for that triplet. However, even for folks who only use vcpkg locally, we believe it is too easy to accidentally get runtime libraries from the system at runtime resulting in "impossible" memory corruption, and we don't want to handle that support burden right now. For anything targeting wider distribution, those issues are much worse, since it's it might work due to Despite the above, if some work is contributed to improve the experience for dynamic on those platforms, such as copying the right |
Beta Was this translation helpful? Give feedback.
-
Yes, we already know the implication of this linkage type. However, it's not a matter of taste for us. The licence and the GPL contamination is a no go, as, even if most of our work are free and open (take a look at https://github.com/IRCAD-IHU/sight), some external part, are proprietary (just because it uses confidencial hardware, software, stuff that waits for a publication in a medical journal, ..) and we have no way to change that. Using for example static Qt (or any LGPL libraries) would mean we cannot go further than private and confidential prototype. No way to use our software in a OP room. If your strong recommendations stays on static linkage, that's fair and understandable. We only beg for a CI support, to be sure that things compiles and that a submission doesn't break everything. We are in the process to evaluate VCPKG as a replacement for conan, and that is a real concern for us. Anyway, thanks for listening :) |
Beta Was this translation helpful? Give feedback.
-
Correction, we don't have that 😳 |
Beta Was this translation helpful? Give feedback.
-
UPD:
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
# set rpath for libraries
if(PORT MATCHES "fribidi|harfbuzz|pkgconf")
# Meson, nuff said
set(pretty_ORIGIN_name "\$ORIGIN")
set(VCPKG_LINKER_FLAGS "-Wl,-rpath,${pretty_ORIGIN_name}:${pretty_ORIGIN_name}/../lib")
elseif(PORT MATCHES "python2")
# setting rpath here breaks build and I have no idea how to fix it.
# But since python2 has no dependencies, not setting rpath is ok
else()
set(VCPKG_LINKER_FLAGS "-Wl,-rpath,'$ORIGIN':'$ORIGIN/../lib'")
endif() |
Beta Was this translation helpful? Give feedback.
-
@BillyONeal I think there are new options today with |
Beta Was this translation helpful? Give feedback.
-
To add dynamic UNIX support, we must first deal with the default behavior of the system to find dynamic libraries. |
Beta Was this translation helpful? Give feedback.
-
Hummm...🤔
Enviado do Email<https://go.microsoft.com/fwlink/?LinkId=550986> para Windows
De: ***@***.***>
Enviado:domingo, 29 de agosto de 2021 13:07
Para: ***@***.***>
***@***.***>; ***@***.***>
Assunto: Re: [microsoft/vcpkg] Make Linux dynamic linkage a first class citizen (#19127)
@MrBolt2005<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMrBolt2005&data=04%7C01%7C%7C8c5e030d293541c75d1708d96b0727ba%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637658500742941343%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Er64CIE1SrW7LYcFAT7AA7PySR9g4bC17wA8RCjb8ls%3D&reserved=0> because they use meson, which is an "extraordinary
special kind of flower". There is a bug somewhere when you pass strings with quotes and I really don't want to dig in it.
|
Beta Was this translation helpful? Give feedback.
-
As the POC shows, you can use One other possibility would be to install shared libraries as With respect to the original motivation, note that the LGPL does not 'forbid static linking.' and it is categorically not true that 'Using static linking means your code will be GPL licensed.' I am not a lawyer and neither is the original poster, please talk to a lawyer if you need advice about software licensing. |
Beta Was this translation helpful? Give feedback.
-
We are also running into this issue. We primarily develop on linux, and while we appreciate the initial decision to mainly use static linking and agree with the reasoning behind it, LGPL and GPL really screw us over on Linux, is there not even a workaround for these issues? We've had to basically halt all VCPKG work in our group because of this, and try to shift gears to Conan because this is such a big legal issue for us. |
Beta Was this translation helpful? Give feedback.
-
I haven't yet understood what exactly the problem is. Is it that Linux also searches its system provided libraries? Link the programs with Is it that Linux shared libraries have a single global namespace for all globally visible symbols? That's by design. Why would that be a problem if you take the first two measures? I'm not experienced with VCPKG, but why do you want to forbid loading of system libraries? If VCPKG is building a self-contained system, then it sounds to me the correct choice would be to execute the binaries in its own container/chroot instead. |
Beta Was this translation helpful? Give feedback.
-
There is now |
Beta Was this translation helpful? Give feedback.
-
@BillyONeal @dg0yt What if the Consider a .NET app which has So, I'm building
|
Beta Was this translation helpful? Give feedback.
-
Not having dynamic linking supported as a first-class citizen on Linux is a problem for my company's project as well. One of our products alone consists of 30+ executables. Many of them use Qt libraries which are large libraries so this would make our installation many times larger. We also use Qt Webengine which cannot be built as a static library. Finally we use Qt under the LGPL license, which makes static linking a problem. @BillyONeal wrote:
With the proper RUNPATH set this is a manageable problem. Yes, there are caveats and dragons with dynamic linking but as I have pointed out above it is simply required for a lot of projects. |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
Currently, and on the contrary to Windows platform, the official triplet on Linux is the one with static linkage. There are many problems with that:
Proposed solution
Beta Was this translation helpful? Give feedback.
All reactions