« Return to Thread: patch for LD_PRELOAD compatibility on cygwin

patch for LD_PRELOAD compatibility on cygwin

by Marco atzeri-3 :: Rate this Message:

Reply to Author | View in Thread

Dear All,
the attached patch solve the LD_PRELOAD fault on cygwin
and it should be compatible with all the other systems.

It is just a change of separator from space to ":" and
inversion of the lib order:

-LD_PRELOAD="$liboctinterp $liboctave $libcruft" \
+LD_PRELOAD="$libcruft:$liboctave:$liboctinterp" \

I also added the full explanation and an altenative
solution on the README.Cygwin .

If this change should cause any problem on other systems
than only the change on README.Cygwin should be applied.

Regards
Marco




[hg_preload.patch]

# HG changeset patch
# User Marco Atzeri <marco_atzeri@...>
# Date 1244041057 -7200
# Node ID 9ec1abec682a285cd75fc3f067245476e033f22b
# Parent  38ad8c99d6a2ddcf4db4ccc854cdd54a1606969f
LD_PRELOAD definition and documentation

diff -r 38ad8c99d6a2 -r 9ec1abec682a ChangeLog
--- a/ChangeLog Fri May 29 17:32:08 2009 -0400
+++ b/ChangeLog Wed Jun 03 16:57:37 2009 +0200
@@ -1,3 +1,7 @@
+2009-06-03  Marco Atzeri  <marco_atzeri@...>
+ *  run-octave.in: modified LD_PRELOAD for cygwin compatibility
+ *  README.Cygwin: added note on LD_PRELOAD
+
 2009-05-26  John W. Eaton  <jwe@...>
 
  * src/dirfns.cc (Fpathsep): Allow path separator to be set.
diff -r 38ad8c99d6a2 -r 9ec1abec682a README.Cygwin
--- a/README.Cygwin Fri May 29 17:32:08 2009 -0400
+++ b/README.Cygwin Wed Jun 03 16:57:37 2009 +0200
@@ -14,19 +14,6 @@
  Marco Atzeri
  http://matzeri.altervista.org
 
-An obsolete version of Octave (2.1.73) is part of the normal net
-distribution of Cygwin, available from http://www.cygwin.com.  Check
-the package list in Cygwin's setup.exe installer if you would like to
-try using it.  However, 2.1.73 is unsupported and we STRONGLY
-recommended that you use a more recent version of Octave.
-
-It should be possible to build Octave on Windows systems with Cygwin,
-but at the time of this writing, there are some performance problems
-related to the way C++ exception handling is implemented with the
-default Cygwin compiler.  This is a known problem with a long history.
-If you would like to see this problem corrected, please search the
-Cygwin mailing lists for threads related to "sjlj exception handling"
-(or similar).
 
 There is also an "unofficial" Octave distribution for Cygwin:
 
@@ -43,7 +30,38 @@
 
     This binary is maintained by Tatsuro Matsuroka.
 
+###############################################################
 
+Note on LD_PRELOAD.
+
+Due to specific cygwin implementation the
+
+LD_PRELOAD="$liboctinterp $liboctave $libcruft"
+
+on run-octave.in does not work.
+It must be replaced with
+
+LD_PRELOAD="$libcruft:$liboctave:$liboctinterp"
+
+Two reasons for the change:
+
+- the Space is not accepted as separator as in a MS
+ systems too many directories have names with space.
+
+- the DLL's must be loaded following the dependency,
+ $liboctinterp needs $liboctave that needs $libcruft.
+
+This solution should also work on all the other sytems.
+
+An alternative solution is to remove completely the LD_PRELOAD
+definition and replace it with a PATH definition
+
+PATH="$builddir/src:$builddir/liboctave:$builddir/libcruft:$PATH"
+
+this second solution have less risk of address collision
+between the various systems DLL's.
+
+################################################################
 John W. Eaton
 jwe@...
 University of Wisconsin-Madison
@@ -58,4 +76,4 @@
 marco_atzeri@...
 Italy
 
-Wed, 17 Sep 2008 14:16:03 EDT
+Wed Jun  3 16:47:16 WEDT 2009
diff -r 38ad8c99d6a2 -r 9ec1abec682a run-octave.in
--- a/run-octave.in Fri May 29 17:32:08 2009 -0400
+++ b/run-octave.in Wed Jun 03 16:57:37 2009 +0200
@@ -68,7 +68,7 @@
 fi
 
 OCTAVE_SITE_INITFILE="$top_srcdir/scripts/startup/main-rcfile" \
-LD_PRELOAD="$liboctinterp $liboctave $libcruft" \
+LD_PRELOAD="$libcruft:$liboctave:$liboctinterp" \
 %library_path_var%="$builddir/src:$builddir/liboctave:$builddir/libcruft:$%library_path_var%" \
   exec $driver "$builddir/src/octave" --no-init-path --path="$LOADPATH" --image-path="$IMAGEPATH" --doc-cache-file="$DOCFILE" --info-file="$INFOFILE" "$@"
 

 « Return to Thread: patch for LD_PRELOAD compatibility on cygwin