Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Sep 2014 10:56:02 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Matthias Andree <matthias.andree@gmx.de>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: Need help compiling use of std::vector
Message-ID:  <20140925075602.GQ8870@kib.kiev.ua>
In-Reply-To: <5423140D.8080005@gmx.de>
References:  <5422DD61.4030808@ShaneWare.Biz> <5423140D.8080005@gmx.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Sep 24, 2014 at 08:57:17PM +0200, Matthias Andree wrote:
> Am 24.09.2014 um 17:04 schrieb Shane Ambler:
> > I am trying to compile the new version of a port I maintain and have
> > trouble related to std::vector. The code producing the error can be
> > boiled down to the following test case, which compiles as 64bit but
> > fails as 32bit.
> > 
> > #include <stdlib.h>
> > #include <vector>
> > 
> > int main(int argc, char *argv[])
> > {
> >     int num_layers = 3;
> >     std::vector<const char *> layers (num_layers, NULL);
> > 
> >     exit(0);
> > }
> > 
> > So that should create a vector containing 3 items initially set to NULL.
> > 
> > 10.0 compiles ok - both 32 and 64 bit. (libc++)
> > 8.4, 9.2 and 9.3 compiles 64bit but fails on 32bit. (libstdc++)
> > 
> > Using the above code
> > clang++ -m32 test.cpp
> > fails with
> > 
> > /usr/include/c++/4.2/bits/stl_algobase.h:641:15: error: assigning to
> > 'const char *' from incompatible type 'const int'
> 
> I don't think "-m32" compilation has ever worked properly for C++ on the
> older FreeBSD releases, where older includes 9.3.
The headers for machine/x86 were only consilidated during 10-CURRENT.
The -m32 works on 10.0 and later, but not on stable/9.

> 
> You're probably better off trying to build with 32-bit chroots or jails
> on your 64-bit host, like poudriere or Tinderbox are doing (but I'm not
> sure if they support setting up 32-bit jails on 64-bit computers).
> 
> See here
> <https://lists.freebsd.org/pipermail/freebsd-stable/2009-September/051855.html>;
> 
> so it's a long-standing thing, and for "recent" developments:
> 
> <https://lists.freebsd.org/pipermail/freebsd-current/2013-June/042378.html>;
> -so that would have been for 10-CURRENT at the time, and hints that the
> headers weren't pure enough for -m32 and similar tricks.
> 
> I am not aware that this effort was ever MFH'd.
No, it was not, and it will not be merged.

> 
> I am Cc'ing Konstantin Belousov in case he wants to shed more light on
> this issue.
> 
> HTH



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140925075602.GQ8870>