progress on libstdc++.dll

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

progress on libstdc++.dll

Paul Kienzle-2
Hi,

I'm trying to make GNU Octave work well under cygwin.
One issue is the size of the loadable modules, which
are huge because they are statically linked to libstdc++.a
I've been working on a libstdc++.dll instead.

Has someone already done this?

My first approach was to use dlltool:

   dlltool --export-all --output-exp a.exp \
        --dllname libstdc++.dll \
        --output-lib libstdc++.dll.a \
        /usr/lib/libstdc++.a
   gcc -shared a.exp /usr/lib/libstdc++.a -o libstdc++.dll
   # To avoid using rebase I will try adding the following:
   #    -Wl,--anable-auto-image-base
   # but I didn't do so in the current build.
   rebase -d -b 0x68000000 -o 0x10000 libstdc++.dll

I could then link the loadable modules using

   gcc -shared -Wl,--export-all-symbols,--enable-auto-import,--enable-runtime-pseudo-reloc
        ...  libstdc++.dll

The loadable modules mostly work!  And they are only 1/10th
the size of the statically linked modules.

One problem was that saving an image to jpg munged the file name
(as if there were no end of string terminator from c_str).  I
wrote the following simple test program which seg-faults:

  #include <iostream>
  #include <string>
  int main(int argc, char *argv[]) {
    std::string x="hello";
    std::cout << "<" << x.c_str() << ">" << std::endl;
    return 0;
  }

  g++ -c str.cc
  gcc -o str.exe -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \
        str.o libstdc++.dll

There may be other problems.

I have been advised from a couple of sources that the dlltool approach to
building libstdc++.dll will not work.  So I then tried the following:

  gcc -shared -Wl,-whole-archive,--export-all-symbols,--enable-auto-image-base \
        /usr/lib/libstdc++.a -Wl,-no-whole-archive -o libstdc++.dll

  gcc -o str.exe -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc str.o \
        libstdc++.dll

but the linker complained about many missing symbols.  Using nm, they seem
to be in libstdc++.dll.  Any suggestions what I'm doing wrong?

Thanks in advance,

Paul Kienzle
[hidden email]
         


Reply | Threaded
Open this post in threaded view
|

Re: progress on libstdc++.dll

Paul Kienzle
Paul Kienzle wrote:

>I'm trying to make GNU Octave work well under cygwin.
>  
>
This problem is taking too much time.  Unless the cygwin list can
suggest something
useful, I'm going to use with Andy's solution of bundling all the
octave-forge compiled
functions into octave.exe, but still allowing dynamic linking (which
means adding
the --disable-lite-kernel option back in, or otherwise hacking
src/Makefile so that
bundled DLD functions are static).  I'm not going to back-link to the
exe since that
will require more configuration changes.  Feel free to contribute a
better solution.

BTW, Andy has added the installer script and icons to
octave-forge/admin/Windows.
If you have any thing you want to add (e.g., clear the existing version
before
installing the new version), post your changes there as usual.

- Paul



Reply | Threaded
Open this post in threaded view
|

Re: progress on libstdc++.dll

Andy Adler
On Wed, 29 Jan 2003, Paul Kienzle wrote:

> Paul Kienzle wrote:
>
> >I'm trying to make GNU Octave work well under cygwin.
> >
> This problem is taking too much time.  Unless the cygwin list can
> suggest something useful, I'm going to use with Andy's solution
> of bundling all the octave-forge compiled functions into octave.exe,
> but still allowing dynamic linking (which means adding
> the --disable-lite-kernel option back in, or otherwise hacking
> src/Makefile so that bundled DLD functions are static).

This approach makes a few changes to src/Makefile

1. Mods to compile everything in DLD-FUNCTIONS

2. Mods to link to extra libraries, eg SuperLU

Also, I create a "src/octave" that has symlinks to
all the appropriate *.h files. That way a function
with includes <octave/oct.h> will work.

The instructions for this are in octave-forge/INSTALL.WINDOWS ,
but in a wordy descriptive format. I wan't sure if this
could be expressed as a patch or if we would need to
write a little perl script to do it.


Andy


Reply | Threaded
Open this post in threaded view
|

Re: progress on libstdc++.dll

John W. Eaton-6
On 30-Jan-2003, Paul Kienzle <[hidden email]> wrote:

| However . . .
|
| The mingw list came through for me (many thanks to Danny Smith)!
|
| Here is the build recipe for a libstdc++.dll that works:

Does anyone on the list know whether the Cygwin folks are planning to
start building and distributing a shared libstdc++ by default?

Thanks,

jwe