From help-octave-request at bevo dot che dot wisc dot edu Wed Jun 13 09:36:34 2001 Subject: Re: clues to statically building octave w/extensions? From: "A. Danial" To: "John W. Eaton" Cc: help-octave at bevo dot che dot wisc dot edu Date: Wed, 13 Jun 2001 07:36:10 -0700 Dirk, Christoph, Bill, John, Andy: Thank you all for your posts. With your help, rebuiding octave with statically linked extensions was easy. Here is how I rebuilt octave with oregonator.cc: Starting from the octave-2.1.34 directory: 1. Built the original, unmodified octave distribution. 2. Copied oregonator.cc to the DLD-FUNCTIONS directory: cp examples/oregonator.cc src/DLD-FUNCTIONS 3. Replaced line 1, "#include " in oregonator.cc with explicit includes as described: vi src/DLD-FUNCTIONS/oregonator.cc # on line 1 of oregonator.cc, replaced #include # with #ifdef HAVE_CONFIG_H #include #endif #include "defun-dld.h" #include "error.h" #include "gripes.h" #include "oct-obj.h" #include "utils.h" 4. Appended oregonator.cc to the definition of the Makefile variable DLD_XSRC: vi src/Makefile # search for 'DLD_XSRC' # appended oregonator.cc after the last entry (time.cc) of DLD_XSRC 5. rm src/octave 6. make The executable src/octave now has the function oregonator statically built in. jwe> I assume you are using 2.1.x. As Dirk said, you can drop the jwe> functions in with the sources, and that's about it. If you put the jwe> functions in the src/DLD-FUNCTIONS directory, then you would also jwe> need to add the names of the .cc files to the DLD_XSRC list in jwe> src/Makefile.in and then run jwe> jwe> CONFIG_FILES=src/Makefile ./config.status jwe> make jwe> jwe> in the top-level build directory. I omitted the CONFIG_FILES= step because it overwrites the Makefile modifications for the variable DLD_XSRC. Maybe I'm doing it at the wrong time? jwe> But a better solution would be to figure out why dynamic linking jwe> doesn't work, and fix the real problem. I don't think it is because jwe> -rdyanmic is not recognized, or anything wrong with your gcc. jwe> I no longer have access to a system running AIX 4.x, so can you please jwe> help us solve this problem? Without a doubt, dynamic linking is way more convenient. I'll gladly lend assistance to try to fix dynamic linking on AIX. I don't really know where to start or what to look for but will try any commands you suggest and will report the results. Speaking of problems on AIX, I should mention that the make process goes smoothly except for the very last step where the octave executable is generated. The link step fails because it cannot locate the library dlfcn. To fix the problem I cut and paste the giant c++ command to a separate file & edit that file by inserting "-L../dlfcn" right before "-ldfcn". I then execute the file, and the link succeeds. For your curiosity, this is what the c++ command looks like after I've edited it. The original c++ line generated by the makefile has the same items in the same order, except it lacks the "-L../dlfcn" you'll find at the beginning of the 4th from last line. c++ -I. -I.. -I../liboctave -I../src -I../libcruft/misc -I../dlfcn \ -I../dlfcn -I../glob -I../glob -DHAVE_CONFIG_H -mminimal-toc \ -fno-implicit-templates -g -O2 -Wall -L.. -g -o octave octave.o builtins.o \ ops.o ../libcruft/blas-xtra/xerbla.o balance.o besselj.o betainc.o \ chol.o colloc.o dassl.o det.o eig.o expm.o fft.o fft2.o filter.o \ find.o fsolve.o gammainc.o getgrent.o getpwent.o getrusage.o givens.o \ hess.o ifft.o ifft2.o inv.o log.o lpsolve.o lsode.o lu.o minmax.o \ pinv.o qr.o quad.o qz.o rand.o schur.o sort.o svd.o syl.o time.o \ oregonator.o -L../liboctave -L../libcruft -L../src ../src/liboctinterp.a \ ../liboctave/liboctave.a ../libcruft/libcruft.a ../readline/libreadline.a \ ../kpathsea/libkpathsea.a ../glob/glob.o ../glob/fnmatch.o \ -L../dlfcn -ldlfcn -ll -lld -ll -lcurses -lm -lg2c -lm \ -L/usr/local/gcc/lib/gcc-lib/rs6000-ibm-aix4.3.2.0/2.95.2 \ -L/usr/local/gcc/lib -lm \ /usr/local/gcc/lib/gcc-lib/rs6000-ibm-aix4.3.2.0/2.95.2/libgcc.a -- Al ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------