Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
smpicc: don't add -shared when SMPI_PRETEND_CC is on
authorMartin Quinson <martin.quinson@loria.fr>
Thu, 29 Mar 2018 21:31:16 +0000 (23:31 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Thu, 29 Mar 2018 21:37:31 +0000 (23:37 +0200)
all mpi programs are compiled in the -shared binary model so that we
can load them with dlopen afterward. But shared binaries cannot be run
by themselves, which is a problem to ./configure that wants to ensure
that mpicc is a real compiler (not a cross-compiler) by executing some
stupid code of its own.

Before the introduction of dlopen as a privatization mechanism, we
used to prevent the binary doing weird things when SMPI_PRETEND_CC was
defined. Now, we extend this mecanism for our compiler wrapers to play
safe in this case.

doc/doxygen/module-smpi.doc
src/smpi/smpicc.in
src/smpi/smpicxx.in
src/smpi/smpif90.in
src/smpi/smpiff.in

index 1354486..bbeaed2 100644 (file)
@@ -641,10 +641,11 @@ make
 @endverbatim
 
 Indeed, the programs compiled with <tt>smpicc</tt> cannot be executed
-without <tt>smpirun</tt>, while configure wants to test them directly.
-With <tt>SMPI_PRETEND_CC</tt>, any program compiled with smpicc stops
-and returns 0 before doing anything that would fail without
-<tt>smpirun</tt>.
+without <tt>smpirun</tt> (they are shared libraries, and they do weird
+things on startup), while configure wants to test them directly.
+With <tt>SMPI_PRETEND_CC</tt> smpicc does not compile as shared,
+and the SMPI initialization stops and returns 0 before doing anything
+that would fail without <tt>smpirun</tt>.
 
 \warning 
 
index 85fd1ea..bdac600 100755 (executable)
@@ -23,10 +23,16 @@ if [ "x@WIN32@" = "x1" ]; then
     list_add LINKARGS "@libdir@\libsimgrid.dll"
 elif [ "x@APPLE@" = "x1" ]; then
     list_add CFLAGS "-fpic"
-    list_add LINKARGS "-shared" "-lsimgrid" "-Wl,-undefined,error"
+    if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
+       list_add LINKARGS "-shared"
+    fi
+    list_add LINKARGS "-lsimgrid" "-Wl,-undefined,error"
 else
     list_add CFLAGS "-fpic"
-    list_add LINKARGS "-shared" "-lsimgrid" "-Wl,-z,defs"
+    if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
+       list_add LINKARGS "-shared"
+    fi
+    list_add LINKARGS "-lsimgrid" "-Wl,-z,defs"
 fi
 
 
index a9a0b5e..241757c 100755 (executable)
@@ -21,7 +21,10 @@ list_set LINKARGS
 if [ "@WIN32@" != "1" ]; then
     # list_add CXXFLAGS "-Dmain=smpi_simulated_main_"
     list_add CXXFLAGS "-fpic" "-std=gnu++11"
-    list_add LINKARGS "-shared" "-lsimgrid" "-std=gnu++11"
+    if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
+       list_add LINKARGS "-shared"
+    fi
+    list_add LINKARGS "-lsimgrid" "-std=gnu++11"
 else
     list_add CXXFLAGS "-include" "@includedir@/smpi/smpi_main.h" "-std=gnu++11"
     list_add LINKARGS "@libdir@\libsimgrid.dll" "-std=gnu++11"
index b0c2b29..2100adb 100644 (file)
@@ -16,7 +16,10 @@ CMAKE_LINKARGS="-L@libdir@"
 @SMPITOOLS_SH@
 
 list_set FFLAGS @SMPI_Fortran_FLAGS@
-list_set LINKARGS "-shared" "-lsimgrid" @SMPI_Fortran_LIBS@ "-lm"
+    if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
+       list_add LINKARGS "-shared"
+    fi
+list_set LINKARGS "-lsimgrid" @SMPI_Fortran_LIBS@ "-lm"
 list_set TMPFILES
 main_name=main
 
index 5361c3b..210645d 100644 (file)
@@ -16,7 +16,10 @@ CMAKE_LINKARGS="-L@libdir@"
 @SMPITOOLS_SH@
 
 list_set FFLAGS @SMPI_Fortran_FLAGS@
-list_set LINKARGS "-shared" "-lsimgrid" @SMPI_Fortran_LIBS@ "-lm"
+if [ "x${SMPI_PRETEND_CC}" = "x" ]; then
+   list_add LINKARGS "-shared"
+fi
+list_set LINKARGS "-lsimgrid" @SMPI_Fortran_LIBS@ "-lm"
 list_set TMPFILES
 main_name=main