Building Octave Statically (and without graphics)

View: New views
11 Messages — Rating Filter:   Alert me  

Building Octave Statically (and without graphics)

by Tim Currie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!
  I'm trying to build a static Octave binary on Fedora 9. In building
all the deps as static libs, I ran into trouble with the requirement for
libGL. It seems (according to comments in the Mesa configure script)
that Mesa cannot be built statically, as the DRI requires that the
drivers be dynamic, which seems to conflict with the explicit assertion
in the documentation that Octave can, in fact, be built as a static
binary on Linux.
  This might be beside the point if I can figure out how to build Octave
*without any graphical capability*, as the Octave configure script
suggests is possible, because this build is going to be run on a large
cluster. But alas, this doesn't work any better than building Mesa,
which is to say that following the instructions in the README, as well
as the comments in the configure script and the Makefile, doesn't
produce the predicted results.
  Any suggestions you can offer or resources you can point me at would
be very much appreciated.

Thanks,

-Tim Currie
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Building Octave Statically (and without graphics)

by John W. Eaton-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 25-Feb-2009, Tim Currie wrote:

|   I'm trying to build a static Octave binary on Fedora 9. In building
| all the deps as static libs, I ran into trouble with the requirement for
| libGL. It seems (according to comments in the Mesa configure script)
| that Mesa cannot be built statically, as the DRI requires that the
| drivers be dynamic, which seems to conflict with the explicit assertion
| in the documentation that Octave can, in fact, be built as a static
| binary on Linux.
|
|   This might be beside the point if I can figure out how to build Octave
| *without any graphical capability*, as the Octave configure script
| suggests is possible, because this build is going to be run on a large
| cluster. But alas, this doesn't work any better than building Mesa,
| which is to say that following the instructions in the README, as well
| as the comments in the configure script and the Makefile, doesn't
| produce the predicted results.

The configure script could probably use a --without-opengl option.

Until someone adds that, if you want to build without OpenGL on a
system that has OpenGLL libraries installed, you can do the following:

  * run configure

  * edit the generated config.h file and comment out the lines

      #define HAVE_OPENGL 1
      #define HAVE_FLTK

  * edit the generated Makeconf file and comment out the line

     GRAPHICS_LIBS = ...
     OPENGL_LIBS = ...

To build a statically linked binary, I think you'll probably want to
configure with

  --disable-dl --disable-dynamic --enable-static LDFLAGS=-static

and you'll need to make the following change to the genrated src/Makefile:

--- Makefile~ 2009-03-06 10:59:38.000000000 -0500
+++ Makefile 2009-03-06 11:33:55.000000000 -0500
@@ -374,7 +374,8 @@
  $(LEXLIB) $(UMFPACK_LIBS) $(AMD_LIBS) $(CAMD_LIBS) $(COLAMD_LIBS) \
  $(CHOLMOD_LIBS) $(CCOLAMD_LIBS) $(CXSPARSE_LIBS) $(BLAS_LIBS) \
  $(FFTW_LIBS) $(QRUPDATE_LIBS) $(ARPACK_LIBS) $(OPENGL_LIBS) \
- $(X11_LIBS) $(CARBON_LIBS) $(LIBS) $(FLIBS)
+ $(QHULL_LIBS) $(REGEX_LIBS) $(CURL_LIBS) $(GLPK_LIBS) \
+ $(GRAPHICS_LIBS) $(FT2_LIBS) $(X11_LIBS) $(CARBON_LIBS) $(LIBS) $(FLIBS)
 
 stmp-pic: pic
  @if [ -f stmp-pic ]; then \

(i.e., add $(QHULL_LIBS) $(REGEX_LIBS) $(CURL_LIBS) $(GLPK_LIBS)
$(GRAPHICS_LIBS) $(FT2_LIBS) to the command used for linking Octave).

Finally, you may also need to generate a modified version of your
systems' libblas.a file so that Octave can override the xerbla
function it probably includes.  Copying /usr/lib/libblas.a to the src
directory in the build tree and then running

  ar -d libblas.a xerbla.o

might work.

Building static binaries isn't normal usage these days, so it is not
surprising to me that some things don't work correctly.  Maybe we can
fix some of the problems (add a --disable-opengl option for the
configure script, add the proper libraries to the link command for a
static build) but I don't see a good general way of avoiding the
libblas xerbla problem.  If I understand correctly, the intent is that
users should be able to replace that function with their own.

On my system, I also had some trouble with things like libcurl,
libX11, and libglpk, as these apparently depend on additional
libraries.  But I'm not sure which additional libraries to link.
So maybe disabling these features would be the quick fix (unless you
need them, in which case, you'll need to figure out which libraries
are needed to make linking possible).

I also see a problem with some pthread functions required by libhdf5,
so you might either disable HDF5 or add the pthread library to the
link command.

But ultimately, if it turns out that there are some necessary system
libraries can't be linked statically on your system, then I'm not sure
there are any changes we could make to Octave to overcome that
problem.

jwe
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Building Octave Statically (and without graphics)

by Jason Riedy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

And John W. Eaton writes:
> Building static binaries isn't normal usage these days, so it is not
> surprising to me that some things don't work correctly.

Alas, it is expected usage for certain clusters and parallel
machines.  There is a page detailing how people built an older
Octave for BG/L that *may* be of use to the original poster:
  http://www.pdc.kth.se/resources/computers/bluegene/bgloctave/mpitb-octave-on-bgl

There would be much (some?) rejoicing if someone would tackle a
--build-static-octave configure option...

> [...] but I don't see a good general way of avoiding the libblas
> xerbla problem.  If I understand correctly, the intent is that users
> should be able to replace that function with their own.

You mentioned the intended method:
>   ar -d libblas.a xerbla.o

We (mostly me) haven't had the mental cycles to figure out the
"right" way to handle XERBLA, and it's made much, much worse by
requirements in the BLAS Tech Forum's BLAS interface (that no one
implements yet).

In my opinion, there likely will be a libxerbla at some future
point so we can avoid cross-library dependencies.  But that's
just my view.

Jason
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Building Octave Statically (and without graphics)

by John W. Eaton-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On  6-Mar-2009, Jason Riedy wrote:

| And John W. Eaton writes:
| > Building static binaries isn't normal usage these days, so it is not
| > surprising to me that some things don't work correctly.
|
| Alas, it is expected usage for certain clusters and parallel
| machines.  There is a page detailing how people built an older
| Octave for BG/L that *may* be of use to the original poster:
|   http://www.pdc.kth.se/resources/computers/bluegene/bgloctave/mpitb-octave-on-bgl
|
| There would be much (some?) rejoicing if someone would tackle a
| --build-static-octave configure option...

If you build Octave this way, is it OK to completely disable the
ability to use .oct and .mex functions?  Or do you want some (easy)
way to be able to do something like put a bunch of .cc files (that
would normally be used to build a set of .oct files) in a directory
and have them built as part of Octave?  I think that might be
possible, but would require more work for mex files since they all
use the same function name (mexFunction).

jwe
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Building Octave Statically (and without graphics)

by Jason Riedy :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

And John W. Eaton writes:
> If you build Octave this way, is it OK to completely disable the
> ability to use .oct and .mex functions?  Or do you want some (easy)
> way to be able to do something like put a bunch of .cc files (that
> would normally be used to build a set of .oct files) in a directory
> and have them built as part of Octave?

The ideal would be to drop source files somewhere and have them built,
but this is all wish-list stuff.  Just being able to build Octave
statically is a good start, assuming all the relevant system libraries
are available in static form.  At that point, modifying src/Makefile.in
and crew isn't so bad.

But at least one system I have in mind requires cross-compilation (Cray
XT5), so this may all be pointless...

I don't know how long the pendulum stay on the "special-purpose node"
side, so I don't know if it's worth serious effort.  Having to build
magic debugging tools for each special-purpose platform is such a huge
waste of the expensive time (developer cost >> machine cost) that I
expect something close enough to general-purpose nodes will return
shortly.

> I think that might be possible, but would require more work for mex
> files since they all use the same function name (mexFunction).

I don't use mex files, so I don't care.  ;)  But I imagine other
users would like them...

Jason
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Building Octave Statically (and without graphics)

by Raymond at SDSU :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

My application is also a cluster, without graphics support on the nodes.  I'm trying to build Octave from source on a cluster that I don't have root access to and even the X11 include files aren't there.  Is there an easy way to configure for a minimal build?  


Tim Currie wrote:
Hi!
  I'm trying to build a static Octave binary on Fedora 9. In building
all the deps as static libs, I ran into trouble with the requirement for
libGL. It seems (according to comments in the Mesa configure script)
that Mesa cannot be built statically, as the DRI requires that the
drivers be dynamic, which seems to conflict with the explicit assertion
in the documentation that Octave can, in fact, be built as a static
binary on Linux.
  This might be beside the point if I can figure out how to build Octave
*without any graphical capability*, as the Octave configure script
suggests is possible, because this build is going to be run on a large
cluster. But alas, this doesn't work any better than building Mesa,
which is to say that following the instructions in the README, as well
as the comments in the configure script and the Makefile, doesn't
produce the predicted results.
  Any suggestions you can offer or resources you can point me at would
be very much appreciated.

Thanks,

-Tim Currie
_______________________________________________
Help-octave mailing list
Help-octave@octave.org
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Building Octave Statically (and without graphics)

by Sergei Steshenko-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



--- On Wed, 10/21/09, Raymond at SDSU <raymondsgroupmail@...> wrote:

> From: Raymond at SDSU <raymondsgroupmail@...>
> Subject: Re: Building Octave Statically (and without graphics)
> To: help-octave@...
> Date: Wednesday, October 21, 2009, 10:48 AM
>
> My application is also a cluster, without graphics support
> on the nodes.  I'm
> trying to build Octave from source on a cluster that I
> don't have root
> access to and even the X11 include files aren't
> there.  Is there an easy way
> to configure for a minimal build? 
>
>
>
> Tim Currie wrote:
> >
> > Hi!
> >   I'm trying to build a static Octave
> binary on Fedora 9. In building
> > all the deps as static libs, I ran into trouble with
> the requirement for
> > libGL. It seems (according to comments in the Mesa
> configure script)
> > that Mesa cannot be built statically, as the DRI
> requires that the
> > drivers be dynamic, which seems to conflict with the
> explicit assertion
> > in the documentation that Octave can, in fact, be
> built as a static
> > binary on Linux.
> >   This might be beside the point if I
> can figure out how to build Octave
> > *without any graphical capability*, as the Octave
> configure script
> > suggests is possible, because this build is going to
> be run on a large
> > cluster. But alas, this doesn't work any better than
> building Mesa,
> > which is to say that following the instructions in the
> README, as well
> > as the comments in the configure script and the
> Makefile, doesn't
> > produce the predicted results.
> >   Any suggestions you can offer or
> resources you can point me at would
> > be very much appreciated.
> >
> > Thanks,
> >
> > -Tim Currie
> > _______________________________________________
> > Help-octave mailing list
> > Help-octave@...
> > https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
> >
> >
>
> --
> View this message in context: http://www.nabble.com/Building-Octave-Statically-%28and-without-graphics%29-tp22206716p25997094.html
> Sent from the Octave - General mailing list archive at
> Nabble.com.
>
> _______________________________________________
> Help-octave mailing list
> Help-octave@...
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>

Raymond,

if you're building for Linux, I have a tool which using "one button"
(rather, one complex command line) builds _everything_ needed for 'octave'
and 'octave' itself. And you do not have to be root - every target is built
in a separate non-root directory, and is installed into another separate
directory. Sources are downloaded automatically from the net.

So for I've built up to octave-3.0.5 - haven't yet had a need for a higher
version. But it shouldn't be a big deal to upgrade - the only things
which bother me is ARPACK which is not standard 'configure', 'make',
'make install', but this can be taken care of, just requires an extra
effort from me.

And so far I've built with 'gnuplot' - the only thing requiring graphics,
but getting rid of it is a matter of commenting out one line.

If you're interested, let me know, I'll send you the tool and instructions
and will help you with the build.

The tool also is not that much Linux-specific.

Regards,
  Sergei.


     

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Building Octave Statically (and without graphics)

by John W. Eaton-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 21-Oct-2009, Raymond at SDSU wrote:

| My application is also a cluster, without graphics support on the nodes.  I'm
| trying to build Octave from source on a cluster that I don't have root
| access to and even the X11 include files aren't there.  Is there an easy way
| to configure for a minimal build?  

What have you tried?  If you configure with all the --without-PKG
options, then Octave should avoid using those packages.

If that doesn't work, then report the problem as a bug.  But since I
normally want to build full-featured versions of Octave, I'm not sure
that I would consider this a high priority problem, so patches to fix
any problems like this would be appreciated.

jwe
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Building Octave Statically (and without graphics)

by Raymond at SDSU :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks (both) for the help.  The potential of a limited features version of Octave for use on computing clusters seems meritorious.  The Octave configure without all of the packages:

./configure --prefix=/home/raymond --without-framework-carbon --without-zlib --
without-hdf5 --without-fftw --without-glpk --without-curl --without-framework-op
engl --without-qrupdate --without-amd     --without-umfpack --without-colamd  --
without-ccolamd     --without-cholmod    --without-cxsparse  --without-arpack  

allows the "make" to proceed further, but the make still fails at a linking step:

g++  -I. -I.. -I../liboctave -I../src -I../libcruft/misc  -DHAVE_CONFIG_H -mieee-fp -Wall -W -Wshadow -Wold-style-cast -Wformat -g -O2 -rdynamic -L..  -fPIC  -o octave main.o  -L../liboctave -L../libcruft -L../src -Wl,-rpath -Wl,/home/raymond/lib/octave-3.2.3 -loctinterp -loctave  -lcruft   -lreadline  -lncurses -ldl -lm  -L/usr/lib/gcc/i386-redhat-linux/4.1.2 -L/usr/lib/gcc/i386-redhat-linux/4.1.2/../../.. -lgfortranbegin -lgfortran -lm

../liboctave/liboctave.so: undefined reference to `pthread_mutexattr_destroy'
../src/liboctinterp.so: undefined reference to `XOpenDisplay'
../liboctave/liboctave.so: undefined reference to `pthread_mutexattr_init'
../liboctave/liboctave.so: undefined reference to `pthread_mutexattr_settype'
../src/liboctinterp.so: undefined reference to `XScreenNumberOfScreen'
collect2: ld returned 1 exit status



John W. Eaton-3 wrote:
On 21-Oct-2009, Raymond at SDSU wrote:

| My application is also a cluster, without graphics support on the nodes.  I'm
| trying to build Octave from source on a cluster that I don't have root
| access to and even the X11 include files aren't there.  Is there an easy way
| to configure for a minimal build?  

What have you tried?  If you configure with all the --without-PKG
options, then Octave should avoid using those packages.

If that doesn't work, then report the problem as a bug.  But since I
normally want to build full-featured versions of Octave, I'm not sure
that I would consider this a high priority problem, so patches to fix
any problems like this would be appreciated.

jwe
_______________________________________________
Help-octave mailing list
Help-octave@octave.org
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Building Octave Statically (and without graphics)

by John W. Eaton-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 30-Oct-2009, Raymond at SDSU wrote:

| Thanks (both) for the help.  The potential of a limited features version of
| Octave for use on computing clusters seems meritorious.  The Octave
| configure without all of the packages:
|
| ./configure --prefix=/home/raymond --without-framework-carbon --without-zlib
| --
| without-hdf5 --without-fftw --without-glpk --without-curl
| --without-framework-op
| engl --without-qrupdate --without-amd     --without-umfpack --without-colamd
| --
| without-ccolamd     --without-cholmod    --without-cxsparse
| --without-arpack  
|
| allows the "make" to proceed further, but the make still fails at a linking
| step:
|
| g++  -I. -I.. -I../liboctave -I../src -I../libcruft/misc  -DHAVE_CONFIG_H
| -mieee-fp -Wall -W -Wshadow -Wold-style-cast -Wformat -g -O2 -rdynamic -L..
| -fPIC  -o octave main.o  -L../liboctave -L../libcruft -L../src -Wl,-rpath
| -Wl,/home/raymond/lib/octave-3.2.3 -loctinterp -loctave  -lcruft  
| -lreadline  -lncurses -ldl -lm  -L/usr/lib/gcc/i386-redhat-linux/4.1.2
| -L/usr/lib/gcc/i386-redhat-linux/4.1.2/../../.. -lgfortranbegin -lgfortran
| -lm
|
| ../liboctave/liboctave.so: undefined reference to
| `pthread_mutexattr_destroy'
| ../src/liboctinterp.so: undefined reference to `XOpenDisplay'
| ../liboctave/liboctave.so: undefined reference to `pthread_mutexattr_init'
| ../liboctave/liboctave.so: undefined reference to
| `pthread_mutexattr_settype'
| ../src/liboctinterp.so: undefined reference to `XScreenNumberOfScreen'
| collect2: ld returned 1 exit status

I understand wanting to build without graphics, but I don't understand
why you would want to discard all these other numerical tools.  What
does that have to do with running on a cluster?

I would expect --without-x to help, but I just tried a build with that
and X was still enabled.  That should probably be fixed, but it is not
a high priority item for me, so I will probably just wait for someone
to contribute patches.

The -lpthread problem is known, and I think fixed in the current
development sources (I haven't checked the 3.2.x release branch).

If you are interested in contributing patches, please note that the
configuration scripts are undergoing some major changes right now as
we switch to automake and libtool.  So it might be best to wait until
after that transition is finished.

Also, the maintainers list is probably a better place for this
discussion.

jwe
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Building Octave Statically (and without graphics)

by Tatsuro MATSUOKA-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

You should add

--disable-shared

for configure options.

Otherwise octave will make shared libraries because building with shared libraries is default option
for the octave.

Regards

Tatsuro
--- Raymond at SDSU  wrote:

>
> Thanks (both) for the help.  The potential of a limited features version of
> Octave for use on computing clusters seems meritorious.  The Octave
> configure without all of the packages:
>
> ./configure --prefix=/home/raymond --without-framework-carbon --without-zlib
> --
> without-hdf5 --without-fftw --without-glpk --without-curl
> --without-framework-op
> engl --without-qrupdate --without-amd     --without-umfpack --without-colamd
> --
> without-ccolamd     --without-cholmod    --without-cxsparse
> --without-arpack  
>
> allows the "make" to proceed further, but the make still fails at a linking
> step:
>
> g++  -I. -I.. -I../liboctave -I../src -I../libcruft/misc  -DHAVE_CONFIG_H
> -mieee-fp -Wall -W -Wshadow -Wold-style-cast -Wformat -g -O2 -rdynamic -L..
> -fPIC  -o octave main.o  -L../liboctave -L../libcruft -L../src -Wl,-rpath
> -Wl,/home/raymond/lib/octave-3.2.3 -loctinterp -loctave  -lcruft  
> -lreadline  -lncurses -ldl -lm  -L/usr/lib/gcc/i386-redhat-linux/4.1.2
> -L/usr/lib/gcc/i386-redhat-linux/4.1.2/../../.. -lgfortranbegin -lgfortran
> -lm
>
> ../liboctave/liboctave.so: undefined reference to
> `pthread_mutexattr_destroy'
> ../src/liboctinterp.so: undefined reference to `XOpenDisplay'
> ../liboctave/liboctave.so: undefined reference to `pthread_mutexattr_init'
> ../liboctave/liboctave.so: undefined reference to
> `pthread_mutexattr_settype'
> ../src/liboctinterp.so: undefined reference to `XScreenNumberOfScreen'
> collect2: ld returned 1 exit status
>
>
>
>
> John W. Eaton-3 wrote:
> >
> > On 21-Oct-2009, Raymond at SDSU wrote:
> >
> > | My application is also a cluster, without graphics support on the nodes.
> > I'm
> > | trying to build Octave from source on a cluster that I don't have root
> > | access to and even the X11 include files aren't there.  Is there an easy
> > way
> > | to configure for a minimal build?  
> >
> > What have you tried?  If you configure with all the --without-PKG
> > options, then Octave should avoid using those packages.
> >
> > If that doesn't work, then report the problem as a bug.  But since I
> > normally want to build full-featured versions of Octave, I'm not sure
> > that I would consider this a high priority problem, so patches to fix
> > any problems like this would be appreciated.
> >
> > jwe
> > _______________________________________________
> > Help-octave mailing list
> > Help-octave@...
> > https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Building-Octave-Statically-%28and-without-graphics%29-tp22206716p26139248.html
> Sent from the Octave - General mailing list archive at Nabble.com.
>
> _______________________________________________
> Help-octave mailing list
> Help-octave@...
> https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
>


--------------------------------------
GyaO! - Anime, Dramas, Movies, and Music videos [FREE]
http://pr.mail.yahoo.co.jp/gyao/
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave