D3DEnergetic / FIDASIM

A Neutral Beam and Fast-ion Diagnostic Modeling Suite
http://d3denergetic.github.io/FIDASIM/
Other
29 stars 19 forks source link

Statically link hdf5 libraries #145

Closed sfiligoi closed 6 years ago

sfiligoi commented 6 years ago

Since we are using our own version of the hdf5 libraries, it is better to statically link them into the executable. This way we do not pick up by mistake system-provided shared libraries.

sfiligoi commented 6 years ago

It tells the linker to only statically link the libraries between the -B pair. (First on then off.) All else will be dynamic and before.

I checked it runs.

For the result, use ldd onbfidasim.

On Tue, May 1, 2018, 15:50 Luke Stagner notifications@github.com wrote:

@lstagner commented on this pull request.

In makefile https://github.com/D3DEnergetic/FIDASIM/pull/145#discussion_r185354975:

@@ -53,7 +53,7 @@ endif

HDF5 variables

HDF5_LIB = $(DEPS_DIR)/hdf5/lib HDF5_INCLUDE = $(DEPS_DIR)/hdf5/include -HDF5_FLAGS = -L$(HDF5_LIB) -lhdf5_fortran -lhdf5hl_fortran -lhdf5_hl -lhdf5 -lz -ldl -Wl,-rpath,$(HDF5_LIB) +HDF5_FLAGS = -L$(HDF5_LIB) -Wl,-Bstatic -lhdf5_fortran -lhdf5hl_fortran -lhdf5_hl -lhdf5 -Wl,-Bdynamic -lz -ldl

I'm afraid I don't understand this change. Wouldn't -Bstatic and -Bdynamic cancel eachother out. Also I thought to statically compile the code you need to use -fPIC somewhere (at least thats what I thought when I last tried static compilation)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/D3DEnergetic/FIDASIM/pull/145#pullrequestreview-116727107, or mute the thread https://github.com/notifications/unsubscribe-auth/AClUuVgb7XF0bMYvtyAinIsf-J-2BxT3ks5tuObKgaJpZM4Tuhu2 .

lstagner commented 6 years ago

I didn't know that was possible. Anyway thanks