-
-
Notifications
You must be signed in to change notification settings - Fork 430
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
Runtime double free occurs when using system-installed boost_filesystem
without specifying shared libraries
#6399
Comments
This seems to be a boost issue. Alternatively, you can define BOOST_FILESYSTEM_DYN_LINK yourself via add_cxflags |
Thank you for the suggestion! However, when using |
Apologies, I misidentified the cause of this issue. The problem is not related to the absence of the The issue occurs when we use system-installed add_requires("boost", {configs = {filesystem = true}}) However, if we explicitly specify shared add_requires("boost", {configs = {shared = true, filesystem = true}}) The difference seems to be that additional libraries are linked when using the static version. For example, here are the compile commands for both cases: With
With
It seems that in the static version, additional libraries like |
boost_filesystem
shared lib without BOOST_FILESYSTEM_DYN_LINK=1
defined results in runtime double freeboost_filesystem
without specifying shared libraries
I’ve discovered some additional information regarding this issue: Arch Linux provides both static and shared libraries for most Given that shared libraries generally take priority during linking, it’s possible that the issue arises from mixing these static libraries ( |
Xmake Version
xmake v2.9.8+20250204
Operating System Version and Architecture
Arch Linux
Describe Bug
This issue occurs when using the system-installedboost
libraries. Ifboost
is built from source via XMake, this issue does not occur because XMake automatically definesBOOST_ALL_DYN_LINK
when building shared libraries. However, with system-installed sharedboost
libraries, ifBOOST_FILESYSTEM_DYN_LINK=1
(orBOOST_ALL_DYN_LINK
) is not defined, it results in a runtime error:free(): double free detected in tcache 2
.When using system-installed
boost_filesystem
via:a runtime double free error occurs. The error message is:
However, if we specify
boost
as a shared library with:the issue disappears.
Expected Behavior
If system-installed sharedboost
libraries are being used, XMake should automatically defineBOOST_FILESYSTEM_DYN_LINK=1
(orBOOST_ALL_DYN_LINK
).Project Configuration
Additional Information and Error Logs
The text was updated successfully, but these errors were encountered: