Looking for a compact C++ STL implementation... (was "STLPort?")

10 posts / 0 new
Last post
Hans
Hans's picture
Offline
Last seen: 2 months 3 weeks ago
Joined: 2010-12-09 22:04
Looking for a compact C++ STL implementation... (was "STLPort?")

I have to statically link with the C++ libraries, and they're rather bloated (especially because I'm using C++ streams). Hence, I'm really interested in using STLPort, which I've heard is much more compact. Has anyone used this on AmigaOS 4.x recently?

I've tried Steven's old port from 2004, but it's hardwired for clib2 and doesn't compile any more. My brief attempt to update it to use newlib ended with:

  1. complex.cpp:27: error: 'float _STL::abs(const _STL::complexfloat)' is not
  2. declared in '_STL'
  3. complex.cpp:32: error: 'double _STL::abs(const _STL::complexdouble)' is not
  4. declared in '_STL'
  5. complex.cpp:39: error: 'long double _STL::abs(const _STL::complexlong
  6. double)' is not declared in '_STL'

I also briefly tried compiling the latest version of STLPort, but quickly ended up with pages of errors. I've never been the best at porting...

Hans

Hans
Hans's picture
Offline
Last seen: 2 months 3 weeks ago
Joined: 2010-12-09 22:04
Judging by the lack of

Judging by the lack of response so far I'm guessing that nobody here has tried STLPort in a while. Its os4depot download counter is at 133, so some people must have tried it out at some point...

For the curious:
- The current OS4 port is at: http://os4depot.net/index.php?function=showfile&file=development/library/misc/stlport.lha
- The main STLPort repository is at: http://sourceforge.net/projects/stlport/

I'd still like to have a compact C++ STL library. After a bit more reading I'm not so sure that STLPort would deliver. Version 4.6.x that was ported is supposedly buggy, and being compact isn't mentioned as a design goal anywhere on the website for the latest version.

Another possibility is uSTL. I didn't mention it earlier because it's missing a few bits (that I don't use like the locale module). Plus, it uses utf-8 for characters, and I wasn't sure if that would cause trouble or not.

Hans

http://hdrlab.org.nz/ - Amiga OS 4 projects, programming articles and more. Home of the RadeonHD driver for Amiga OS 4.x project.
http://keasigmadelta.co.nz/ - more of my software.

Massi
Massi's picture
Offline
Last seen: 3 years 10 months ago
Joined: 2012-03-28 17:16
@Hans I have to statically

@Hans

I have to statically link with the C++ libraries, and they're rather bloated (especially because I'm using C++ streams).

I don' t expect compact code from C++ ... when I built Stockfish5 chess engine for OS4 (available from OS4 Depot), I got a huge sized executable file, even bigger than the Windows and OSX versions.

Perhaps try to avoid streams. What is your need from STL?

Hans
Hans's picture
Offline
Last seen: 2 months 3 weeks ago
Joined: 2010-12-09 22:04
@Massi I don' t expect

@Massi

I don' t expect compact code from C++ ... when I built Stockfish5 chess engine for OS4 (available from OS4 Depot), I got a huge sized executable file, even bigger than the Windows and OSX versions.

Stockfish5 chess engine is a sizeable piece of code. Getting a binary that's hundreds of KiB, when it just prints a few things to the console is kind of annoying.

Perhaps try to avoid streams. What is your need from STL?

Apart from streams (which I use because they're very useful), there's the container types like std::vector, etc.

Sure, I could avoid them all, but then I wouldn't get the benefits that they provide.

@all
Please don't bother posting "don't use STL" type comments. What I use is entirely up to me, and I've decided that their benefits outweigh their disadvantages. Nevertheless, I'd still like to minimise the binary bloat that comes with it.

I started this thread in the hope that someone else either had experience using STLPort and/or uSTL, or was also interested in getting a compact STL implementation on OS4 (and hopefully has the porting skills needed).

I briefly tried building uSTL, but it's configure script uses "sed," and fails on AmigaOS4. Maybe it might work on Linux with a cross-compiler...

Hans

http://hdrlab.org.nz/ - Amiga OS 4 projects, programming articles and more. Home of the RadeonHD driver for Amiga OS 4.x project.
http://keasigmadelta.co.nz/ - more of my software.

Massi
Massi's picture
Offline
Last seen: 3 years 10 months ago
Joined: 2012-03-28 17:16
@Hans Apart from streams

@Hans

Apart from streams (which I use because they're very useful), there's the container types like std::vector, etc.
Sure, I could avoid them all, but then I wouldn't get the benefits that they provide.

You could replace std::vector with your own implementation ... I once did it providing a template container class as a replacement for std::list ... I know is reinventing the wheel but anyway :)

Hans
Hans's picture
Offline
Last seen: 2 months 3 weeks ago
Joined: 2010-12-09 22:04
@Massi You could replace

@Massi

You could replace std::vector with your own implementation ... I once did it providing a template container class as a replacement for std::list ... I know is reinventing the wheel but anyway :)

Uh, no. By far the biggest reason to use STL is so that I can focus on what the software is actually supposed to do rather than working on the low-level data storage mechanics (and "reinventing the wheel" in the process).

Hans

http://hdrlab.org.nz/ - Amiga OS 4 projects, programming articles and more. Home of the RadeonHD driver for Amiga OS 4.x project.
http://keasigmadelta.co.nz/ - more of my software.

broadblues
broadblues's picture
Offline
Last seen: 4 years 1 month ago
Joined: 2012-05-02 21:48
but it's configure script


but it's configure script uses "sed," and fails on AmigaOS4.

which sed do you have? I seem to remeber the sed in recent SDK is broken in some ways, but the older sed 3 one works, I have custim build of sed 3 that might work if you want it.

YesCop
YesCop's picture
Offline
Last seen: 3 years 7 months ago
Joined: 2011-05-17 15:07
Hans, I must have missed

Hans,

I must have missed something. I don't use the word stl but I use ona regular basis std::vector, std::list, std::map and other things without doing anything.
All is already in the OS4 sdk.

So, did I understand your problem well?

Hans
Hans's picture
Offline
Last seen: 2 months 3 weeks ago
Joined: 2010-12-09 22:04
@Broadblues which sed do you

@Broadblues

which sed do you have?

Most likely the one that came with the latest SDK. I've never installed anything else.

Perhaps you could check out uSTL briefly and see if it configures with the version of sed that you have. The repo is at https://github.com/msharov/ustl. The configure script fails for me almost instantly.

@YesCop

So, did I understand your problem well?

No. If you reread the first post you'll see that I'm looking for an implementation of STL (the C++ standard library) that is less bloated than the one that comes with gcc (i.e., the one in the SDK). I'm using the libstdc++ that comes with the SDK right now, but would like to reduce the binary size if possible without losing the advantages that C++ streams and other STL classes bring. I specifically mentioned STLPort and uSTL as possibilities.

Hans

http://hdrlab.org.nz/ - Amiga OS 4 projects, programming articles and more. Home of the RadeonHD driver for Amiga OS 4.x project.
http://keasigmadelta.co.nz/ - more of my software.

YesCop
YesCop's picture
Offline
Last seen: 3 years 7 months ago
Joined: 2011-05-17 15:07
Ok. I thought that libstdc++

Ok.
I thought that libstdc++ was the only one implementation of this library.
And so the names you used (stlport or ustl) were synonyms of libstdc++.
So, I don't know anything about these ports but when I read your code (from Composite demo), I saw you used "using namespace std".
You should use using std::cout or whatever functions you will want to have.
Less symbols and may be size will be reduced (In real, I never compared the sizes).

Though, I will be interested in the advantages STLPort against libstdc++ will bring to C++ developpers.

EDIT:
I tested my idea. Well I have been sad to notice that the size was not lower.
I only tested with g++ -o exe source.cc and g++ -Os -o exe source.cc
and of course I launch strip.
May be some other arguments in gcc could help.
Sorry, this was a false good idea...

Log in or register to post comments