-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
The make install instruction will place shared library into ${CMAKE_INSTALL_PREFIX} which on Ubuntu is usr/local/lib.
I think the header files need to place in /usr/local/include so that the gcc #include can find these file properly without explicitly set argument -I (or in readme.md "> sudo make install (install the library and header files in /usr/local/lib and /usr/local/include" should be update). I found #223 discussed about this but in #89 said this is fine. Are there any other consideration about this?
Also, libmimalloc.so is used to link the shared library in compile time. However, when run the program(without any arguments like LD_LIBRARY_PATH or LD_PRELOAD), it will cause No such file or directory error in finding libmimalloc.so.{version}, which is the soname of shared library.
$ gcc myprogram.c -lmimalloc
$ ldd a.out
linux-vdso.so.1 (0x00007fff45feb000)
libmimalloc.so.2.0 => not found
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f849292c000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8492b45000)
This is because ld cannot search the path under usr/local/lib likes usr/local/lib/mimallc-2.0.
I think we can place libmimalloc.so.{major-version} in /usr/local/lib and add symbolic link to shared library.
Something like these:
/usr/local
├── include
│ ├── mimalloc-2.0
│ │ ├── mimalloc.h
│ │ ├── mimalloc-new-delete.h
│ │ └── mimalloc-override.h
├── lib
│ ├── libmimalloc.so -> libmimalloc.so.2 (symbolic link)
│ ├── libmimalloc.so.2 -> mimalloc-2.0/libmimalloc.so.2.0 (symbolic link)
│ ├── mimalloc-2.0
│ │ ├── cmake
│ │ │ ├── mimalloc.cmake
│ │ │ ├── mimalloc-config.cmake
│ │ │ ├── mimalloc-config-version.cmake
│ │ │ └── mimalloc-release.cmake
│ │ ├── include
│ │ │ ├── mimalloc.h
│ │ │ ├── mimalloc-new-delete.h
│ │ │ └── mimalloc-override.h
│ │ ├── libmimalloc.a
│ │ ├── libmimalloc.so -> libmimalloc.so.2.0
│ │ ├── libmimalloc.so.2.0
│ │ └── mimalloc.o
and then this all can be linked properly by ldconfig.