Feature request: Combining `libsc`, `libp4est` and `libt8` into one shared (and static?) library.
For some scenarios it would be helpfull to have one big libt8.so combing the three libs libsc, libp4est and libt8 into one shared (and also static?) library.
This should be optional and might be acitvated by an additional configure option --enable-big-lib.
Alternative ideas on how to properly name this option are welcome.
It seems that autotools does not support such a use case.
It seems that
autotoolsdoes not support such a use case.
What about building the three libraries with libtool, as usual, libsc.la and friends, and then build the big library, also as an .la whose sources are the three .la libraries? Then automake will create the .a and .so files.
We do not even need the command line option then.
I tried this approach. But for some reason it gave me a shared library without symbols simply linking against the three libs. But maybe I did something wrong. I can try to recreate my steps and you could take a look at that.
@cburstedde
I opened an associated PR https://github.com/DLR-AMR/t8code/pull/568.
This gives me the following:
$ pwd
/home/mark_jo/scratch/install/t8code/feature-big-lib/lib
$ ls -l -h
total 4,6M
-rw-r--r-- 1 mark_jo dlr_mark_jo_p 1,5M Mai 26 10:38 libp4est.a
-rwxr-xr-x 1 mark_jo dlr_mark_jo_p 1,1K Mai 26 10:38 libp4est.la
lrwxrwxrwx 1 mark_jo dlr_mark_jo_p 17 Mai 26 10:38 libp4est.so -> libp4est.so.2.0.0
lrwxrwxrwx 1 mark_jo dlr_mark_jo_p 17 Mai 26 10:38 libp4est.so.2 -> libp4est.so.2.0.0
-rwxr-xr-x 1 mark_jo dlr_mark_jo_p 960K Mai 26 10:38 libp4est.so.2.0.0
-rw-r--r-- 1 mark_jo dlr_mark_jo_p 400K Mai 26 10:38 libsc.a
-rwxr-xr-x 1 mark_jo dlr_mark_jo_p 966 Mai 26 10:38 libsc.la
lrwxrwxrwx 1 mark_jo dlr_mark_jo_p 14 Mai 26 10:38 libsc.so -> libsc.so.2.0.0
lrwxrwxrwx 1 mark_jo dlr_mark_jo_p 14 Mai 26 10:38 libsc.so.2 -> libsc.so.2.0.0
-rwxr-xr-x 1 mark_jo dlr_mark_jo_p 257K Mai 26 10:38 libsc.so.2.0.0
lrwxrwxrwx 1 mark_jo dlr_mark_jo_p 37 Mai 26 10:38 libt8-1.2.0.203-a68e2a-dirty.so.2 -> libt8-1.2.0.203-a68e2a-dirty.so.2.0.0
-rwxr-xr-x 1 mark_jo dlr_mark_jo_p 597K Mai 26 10:38 libt8-1.2.0.203-a68e2a-dirty.so.2.0.0
-rw-r--r-- 1 mark_jo dlr_mark_jo_p 897K Mai 26 10:38 libt8.a
lrwxrwxrwx 1 mark_jo dlr_mark_jo_p 40 Mai 26 10:38 libt8big-1.2.0.203-a68e2a-dirty.so.2 -> libt8big-1.2.0.203-a68e2a-dirty.so.2.0.0
-rwxr-xr-x 1 mark_jo dlr_mark_jo_p 16K Mai 26 10:38 libt8big-1.2.0.203-a68e2a-dirty.so.2.0.0
-rw-r--r-- 1 mark_jo dlr_mark_jo_p 8 Mai 26 10:38 libt8big.a
-rwxr-xr-x 1 mark_jo dlr_mark_jo_p 1,9K Mai 26 10:38 libt8big.la
lrwxrwxrwx 1 mark_jo dlr_mark_jo_p 40 Mai 26 10:38 libt8big.so -> libt8big-1.2.0.203-a68e2a-dirty.so.2.0.0
-rwxr-xr-x 1 mark_jo dlr_mark_jo_p 1,7K Mai 26 10:38 libt8.la
lrwxrwxrwx 1 mark_jo dlr_mark_jo_p 37 Mai 26 10:38 libt8.so -> libt8-1.2.0.203-a68e2a-dirty.so.2.0.0
drwxr-xr-x 2 mark_jo dlr_mark_jo_p 58 Mai 26 10:38 pkgconfig
$ ldd libt8big.so
linux-vdso.so.1 (0x00007ffd94f63000)
libsc.so.2 => /localdata2/mark_jo/install/t8code/feature-big-lib/lib/libsc.so.2 (0x00007f004d7de000)
libp4est.so.2 => /localdata2/mark_jo/install/t8code/feature-big-lib/lib/libp4est.so.2 (0x00007f004d6fc000)
libt8-1.2.0.204-2259.so.2 => /localdata2/mark_jo/install/t8code/feature-big-lib/lib/libt8-1.2.0.204-2259.so.2 (0x00007f004d67f000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f004d639000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f004d4e8000)
libstdc++.so.6 => /tools/modulesystem/tools/gcc/gcc-10.1.0/install/sled12.x86_64.gcc-4.8.5.release.combinedTree/lib64/libstdc++.so.6 (0x00007f004d313000)
libmpi.so.40 => /tools/modulesystem/tools/openmpi/openmpi-4.0.3/install/sled12.x86_64.gcc-10.1.0.release/lib/libmpi.so.40 (0x00007f004d1ed000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f004d1ca000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f004cfd8000)
libgcc_s.so.1 => /tools/modulesystem/tools/gcc/gcc-10.1.0/install/sled12.x86_64.gcc-4.8.5.release.combinedTree/lib64/libgcc_s.so.1 (0x00007f004cfbc000)
/lib64/ld-linux-x86-64.so.2 (0x00007f004d81f000)
libopen-rte.so.40 => /tools/modulesystem/tools/openmpi/openmpi-4.0.3/install/sled12.x86_64.gcc-10.1.0.release/lib/libopen-rte.so.40 (0x00007f004cf00000)
libopen-pal.so.40 => /tools/modulesystem/tools/openmpi/openmpi-4.0.3/install/sled12.x86_64.gcc-10.1.0.release/lib/libopen-pal.so.40 (0x00007f004cdf2000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f004cdec000)
libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f004cdbf000)
libpciaccess.so.0 => /lib/x86_64-linux-gnu/libpciaccess.so.0 (0x00007f004cdb2000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f004cda8000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f004cda3000)
$ nm libt8big.so
0000000000004020 B __bss_start
0000000000004020 b completed.0
w __cxa_finalize@@GLIBC_2.2.5
0000000000001040 t deregister_tm_clones
00000000000010b0 t __do_global_dtors_aux
0000000000003d98 d __do_global_dtors_aux_fini_array_entry
0000000000004018 d __dso_handle
0000000000003da0 d _DYNAMIC
0000000000004020 D _edata
0000000000004028 B _end
00000000000010f8 t _fini
00000000000010f0 t frame_dummy
0000000000003d90 d __frame_dummy_init_array_entry
0000000000002000 r __FRAME_END__
0000000000004000 d _GLOBAL_OFFSET_TABLE_
w __gmon_start__
0000000000001000 t _init
w _ITM_deregisterTMCloneTable
w _ITM_registerTMCloneTable
0000000000001070 t register_tm_clones
0000000000004020 d __TMC_END__
What I want instead is the following:
$ pwd
/localdata2/mark_jo/build/t8code/feature-big-lib
$ gcc -shared -o libt8big.so \
$(find sc/src/.libs -iname '*.o') $(find p4est/src/.libs -iname '*.o') $(find src/.libs -iname '*.o')
$ ls -l -h libt8big.so
-rwxr-xr-x 1 mark_jo dlr_mark_jo_p 1,2M Mai 26 10:32 libt8big.so
$ nm libt8big.so | grep sc_ | head
000000000002f240 T sc_abort
0000000000030b70 T sc_abort_collective
000000000002fd40 t sc_abort_handler
0000000000021671 t sc_abort_handler.cold
000000000002f6e0 T sc_abort_verbose
000000000002f9a0 T sc_abort_verbosef
000000000002f970 T sc_abort_verbosev
0000000000022c10 T sc_allgather
0000000000022710 T sc_allgather_alltoall
00000000000228d0 T sc_allgather_recursive
$ nm libt8big.so | grep p4est_ | head
0000000000051e20 t p4est_all_recursion
0000000000067c60 t p4est_all_recursion
0000000000050670 t p4est_array_split_ancestor_id
0000000000066140 t p4est_array_split_ancestor_id
00000000000acb80 T p4est_balance
00000000000a0b50 T p4est_balance_border
00000000000aa7c0 T p4est_balance_ext
000000000009d590 t p4est_balance_replace_recursive
00000000000c2590 t p4est_balance_replace_recursive
00000000000a8150 t p4est_balance_response
$ nm libt8big.so | grep t8_ | head
000000000002f050 T sc_int8_compare
00000000000eed50 T t8_debugf
00000000000fc0e0 R t8_eclass_boundary_count
00000000000ee790 T t8_eclass_compare
00000000000ee690 T t8_eclass_count_boundary
00000000000fc400 R t8_eclass_face_orientation
00000000000fc1e0 R t8_eclass_face_types
00000000000ee7f0 T t8_eclass_is_valid
00000000000fd3c0 R t8_eclass_max_num_faces
00000000000fc3c0 R t8_eclass_num_edges
Played with this change. Gave me the same results shown above but without proper linking to libsc.so, libp4est.so, and libt8.so.
libt8big_la_SOURCES = sc/src/libsc.la p4est/src/libp4est.la src/libt8.la
libt8big_la_LDFLAGS = -release $(VERSION) -version-info 2:0:0
libt8big_la_LIBADD =