help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: compiling a stand alone ...


From: Paul Kienzle
Subject: Re: compiling a stand alone ...
Date: Mon, 16 Oct 2000 09:45:28 +0100
User-agent: Mutt/1.2.5i

I wrote a little script to find missing libraries.  Put it
somewhere on your executable path.

E.g.,

pkienzle:Šþ/Mail$ findlib append_history
/lib/libhistory.so.4.1: append_history T 0000421c
/lib/libreadline.so.4.1: append_history T 0001cf5c
/usr/lib/libgnomeui.so.32.11.3: gnome_entry_append_history T 0005b6f0
/usr/lib/libhistory.so.2.1: append_history T 00004e88
/usr/lib/libreadline.so: append_history T 0001cf5c


Paul Kienzle
address@hidden

#!/bin/sh

function searchlib {
    # echo searchlib $file "$2"
    local file flags
    flags="--print-file-name --demangle --extern-only --no-sort ŠÜ
        --portability --defined-only"
    file="$1" ; shift
    [ -z "${file##*.so*}" ] && flags="$flags --dynamic"
    if [ "$file" != "none." ]; then
        # look for pattern [use "2>/dev/null" if nm gives errors]
        nm $flags $file 2>/dev/null | grep "$1"
    fi
}

# search all standard library directories (shouldn't we use ld.conf?)
for dir in /lib /usr/lib /usr/local/lib /usr/X11R6/lib ; do
    # Search only in the newest library/object file: *.a, *.o, *.so*
    # Note: Use ls to get a list of files in alphatical order. That
    # means that the newest .so will be the last name in the list, and 
    # it should be as new as the .a file. So all we have to do is search 
    # the last file before the base name changes.

    # echo Dir=$dir
    last=none.
    for file in `/bin/ls $dir/*.{a,o,so,so.*} 2>/dev/null` ; do 
        # Stemming: chop off the shortest tail matching .a* .o* or .s*
        # Because we are only including .a, .o, .so* patterns in our
        # search, this gets us exactly the base file name.
        # echo "$last, $file->${file%.[aos]*}"
        if [ "${file%.[aos]*}" != "${last%.[aos]*}" ] ; then 
            searchlib $last "$1" ; 
        fi
        last=$file
    done
    # Don't forget the last group!!
    searchlib $last "$1"
done


On Sun, Oct 15, 2000 at 08:15:29PM -0400, Andy Adler wrote:
> Thanks,
> 
> This gives me less errors (16 instead of 61),
> but I still can't compile. There must be another lib
> that I need.
> 
> Andy
> _______________________________________
> Andy Adler,                address@hidden
> 
> 
> On Sat, 14 Oct 2000, Paul Kienzle wrote:
> > You need -lreadline as well.
> > 
> > Paul Kienzle
> > 
> > On Fri, Oct 13, 2000 at 09:19:49PM -0400, Andy Adler wrote:
> > > On Fri, 13 Oct 2000, Nimrod Mesika wrote:
> > > 
> > > > On Fri, Oct 13, 2000 at 04:28:28PM +1100, flatmax wrote:
> > > > > Here is a stand alone program I would like to compile.
> > > > > ______________________ BEGIN FILE octaveTest.cc 
> > > > > ________________________
> > > > > #include <octave/oct.h>
> > > > > 
> > > > > main(){
> > > > > ColumnVector dx (3);
> > > > > }
> > > > > ___________________ END FILE ocaveTest.cc _________________________
> > > > This is the Makefile I use to compile your standalone example:
> > > > 
> > > > OCTAVEINCLUDE=/usr/local/include/octave-2.1.30
> > > > CXXFLAGS:= -I${OCTAVEINCLUDE}/octave -I${OCTAVEINCLUDE} 
> > > > LDFLAGS=-L/usr/local/lib/octave-2.1.30 -loctave  -lcruft -lstdc++ -lg2c
> > > > 
> > > > OBJS=stand.o
> > > > 
> > > > stand:  ${OBJS} 
> > > >         cc -o stand ${OBJS} ${LDFLAGS}
> > > > 
> > > > 
> > > > This one works on FreeBSD-4. Not sure about other systems. liboctave
> > > > and libcruft are part of Octave. libstdc++ is a gcc library and
> > > > libg2c is the g77 library.
> > > 
> > > I'm also interested in doing this.  I tried this approach, but
> > > am unable to get this one to work for me.
> > > 
> > > I'm using RH linux 6.2.
> > > 
> > > I get a whole series of link error like this
> > > 
> > > > cc stand.o -L/usr/local/lib/octave-2.1.31 -loctave  -lcruft ŠÜ
> > >       -lstdc++ -lg2c
> > > /usr/local/lib/octave-2.1.31/liboctave.so: undefined reference to
> > > `append_history'
> > > /usr/local/lib/octave-2.1.31/liboctave.so: undefined reference to
> > > `rl_deprep_term_function'
> > > /usr/local/lib/octave-2.1.31/liboctave.so: undefined reference to
> > > `dlerror'
> 
> 
> 
> -----------------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
> 
> Octave's home on the web:  http://www.che.wisc.edu/octave/octave.html
> How to fund new projects:  http://www.che.wisc.edu/octave/funding.html
> Subscription information:  http://www.che.wisc.edu/octave/archive.html
> -----------------------------------------------------------------------
> 
> 



-----------------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.che.wisc.edu/octave/octave.html
How to fund new projects:  http://www.che.wisc.edu/octave/funding.html
Subscription information:  http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]