Closed vmagnin closed 8 months ago
$ gfortran -static toy.f90 $(pkg-config --cflags --libs forcolormap)
I didn't test it yet, maybe need to add forimage as well? --libs forimage forcolormap
This works on my system:
cd forcolormap
mkdir build && cd build
cmake -D BUILD_SHARED_LIBS=false ..
make
sudo make install
cd mytest
gfortran -static toy.f90 -L/usr/local/lib -I/usr/local/include -lforcolormap -lforimage
Thanks a lot @gha3mi ,
I have advanced a lot thanks to your message. The following compilation commands works:
gfortran -static toy.f90 -L/usr/local/lib -I/usr/local/include -lforcolormap -lforimage
gfortran -static toy.f90 $(pkg-config --cflags --libs forcolormap forimage)
The following compilation commands fails:
gfortran -static toy.f90 $(pkg-config --cflags --libs forcolormap)
gfortran -static toy.f90 $(pkg-config --cflags --libs forimage forcolormap)
gfortran -static toy.f90 -L/usr/local/lib -I/usr/local/include -lforimage -lforcolormap
I had tried to use --libs forimage forcolormap
with pkg-config
. This order seemed intuitive (first the dependency, then the library itself), although I also thought it was not important. But it fails. And the reverse order works: --libs forcolormap forimage
(and same remark with your detailed command).
fpm makes me forget all knowledge about that :)
I have added an uninstall target to CMake, providing the ability to use make uninstall
. Perhaps you could also add it for forcolormap. See https://github.com/gha3mi/forimage/issues/17 and the corresponding changes: https://github.com/gha3mi/forimage/commit/f1b4056fa0fb62727844faaa6aa61e2891df1941. The same approach can be applied to forcolormap.
I have added an uninstall target to CMake, providing the ability to use
make uninstall
. Perhaps you could also add it for forcolormap. See gha3mi/forimage#17 and the corresponding changes: gha3mi/forimage@f1b4056. The same approach can be applied to forcolormap.
Good idea! I put it in my TODO list. There is also such a functionality in gtk-fortran: https://github.com/vmagnin/gtk-fortran/blob/gtk4/cmake/cmake_uninstall.cmake.in
@jchristopherson @gha3mi
System: Ubuntu 23.10, FreeBSD 14.0 Compiler: GFortran 13.2.0
I am now trying to use ForColormap as a static library (
.a
under Linux). I have written atoy.f90
minimalist program:ForColormap was configured with
cmake -D BUILD_SHARED_LIBS=false ..
before building and installing. The.mod
files are all in/usr/local/include/
and the two.a
are in/usr/local/lib/
.But I can not compile my toy program with the
-static
option: