Skip to content
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

mimalloc.o not available in vcpkg #907

Open
muhammadhamzasajjad opened this issue Jun 5, 2024 · 4 comments
Open

mimalloc.o not available in vcpkg #907

muhammadhamzasajjad opened this issue Jun 5, 2024 · 4 comments

Comments

@muhammadhamzasajjad
Copy link

muhammadhamzasajjad commented Jun 5, 2024

According to the docs for static override we should do

> gcc -o myprogram mimalloc.o  myfile1.c ...

I am using mimalloc from vcpkg. But the mimalloc.o file is not built by the vcpkg configuration of mimalloc as the target mimalloc-obj is also not built. In fact, MIMALLOC_OBJECT_DIR is not available which is supposed to be used for obtaining mimalloc.o.

How can we use mimalloc.o in vcpkg? Ideally I would want to be able to access mimalloc.o via CMake and then link it with the target. #532 seems similar but vcpkg build process for mimalloc doesn't make mimalloc-obj target available.

@imsharukh1994
Copy link

imsharukh1994 commented Dec 25, 2024

To use mimalloc.o with vcpkg, follow these steps:
1. Install mimalloc via vcpkg:

vcpkg install mimalloc

2.	Build mimalloc.o manually:
•	Clone the mimalloc repository:

git clone https://github.com/microsoft/mimalloc.git
cd mimalloc

•	Build mimalloc and generate mimalloc.o:

mkdir build
cd build
cmake ..
cmake --build . --target mimalloc

3.	Link mimalloc.o in your CMake project:

In your CMakeLists.txt, add:


target_sources(my_target PRIVATE ${CMAKE_SOURCE_DIR}/path/to/mimalloc/build/src/mimalloc.o)
4.	Build your project:

cmake --build .

This ensures you can use mimalloc.o with static overriding and link it manually in your project.

This summary highlights the main actions required and keeps it concise for easy reading.

@res2k
Copy link
Contributor

res2k commented Dec 25, 2024

To use mimalloc.o with vcpkg, follow these steps: 1. Install mimalloc via vcpkg:
2. Build mimalloc.o manually:

This does not make sense. Why build mimalloc manually in step 2 when you already installed it in step 1?

This comment, like any of yours recently, look like it's copied mostly straight out of the answer from some AI.
What's the point here?
To me, the utility of those comments is, at best, doubtful - they typically contain a lot of explanation, which overshadows any useful answer, if there even is any.

I'm not really important here, but as someone who reads the discussions & issues around mimalloc out of interest:
Please Stop.

@daanx
Copy link
Collaborator

daanx commented Dec 25, 2024

I'm not really important here,

But you are Frank :-) Thank you for all your help and insightful comments over time!

With regards to vcpkg -- I am not maintaining this as those scripts are part of the vcpkg repo. It would be good though if it would build the mimalloc.o file too -- not sure why that would be disabled?

(ps. I am hesitant to start maintaining the vcpkg part of mimalloc but maybe someone can help out the current maintainer? I recently updated the CMakeFiles.txt for windows as well to generate mimalloc.dll instead of mimalloc-override.dll to be consistent across platforms; that might affect vcpkg as well)

@res2k
Copy link
Contributor

res2k commented Dec 26, 2024

But you are Frank :-) Thank you for all your help and insightful comments over time!

Thanks for the kind words!

(ps. I am hesitant to start maintaining the vcpkg part of mimalloc but maybe someone can help out the current maintainer? I recently updated the CMakeFiles.txt for windows as well to generate mimalloc.dll instead of mimalloc-override.dll to be consistent across platforms; that might affect vcpkg as well)

While I'm not using mimalloc through vcpkg myself, I took a quick look at it's "port":

  • mimalloc-override.dll doesn't seem to be mentioned at all by name, so any change to it's name would probably not affect the port.
  • Generally, I think the version used by the vcpkg port has to be updated manually, so I don't think you have to worry about any git changes etc. surprisingly affecting the vcpkg side.
  • It looks as if the vcpkg package will be assembled using cmake install... don't know if mimalloc.o is included in the set of installed files, but maybe that's worth considering?

And judging from the git log for mimallloc in vcpkg (https://github.com/microsoft/vcpkg/commits/master/ports/mimalloc) there's no singular maintainer...

That said, it looks like the "organic" approach - someone has an issue with the port, writes an issue and/or provides a patch - seemed to work out okay in the past; maybe hope it continues to do so?
There's also vcpkg's own issue tracker, so if you think anyone needs a heads-up for the next port update, maybe that could be a suitable place as well to at least leave some info for whoever may pick it up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants