No way to get multithreaded gcc on OpenBSD? - BSD

This is a discussion on No way to get multithreaded gcc on OpenBSD? - BSD ; Hi all. I am writing multithreaded C++ app which on my POV requires gcc configured with Threading model: posix. The one I have on my OpenBSD 4.2 is single-threaded: #g++ -v Reading specs from /usr/lib/gcc-lib/i386-unknown-openbsd4.2/3.3.5/ specs Configured with: Thread model: ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: No way to get multithreaded gcc on OpenBSD?

  1. No way to get multithreaded gcc on OpenBSD?

    Hi all. I am writing multithreaded C++ app which on my POV requires
    gcc configured with Threading model: posix.
    The one I have on my OpenBSD 4.2 is single-threaded:
    #g++ -v
    Reading specs from /usr/lib/gcc-lib/i386-unknown-openbsd4.2/3.3.5/
    specs
    Configured with:
    Thread model: single
    gcc version 3.3.5 (propolice)

    OpenBSD ports does not provide multithreaded gcc, so I tried to build
    it myself from gcc sources. I downloaded src for gcc 3.3.5 and for gcc
    4.2.2 frok gcc site but failed to compile either of them! (I compiled
    with --enable-threads=posix --enable-languages=c,c++). Trying to make
    gcc 3.3.5 resulted in yacc error, for gcc 4.2.2 it was $< macro error.
    I am wondering is it a way to get multithreaded gcc on OpenBSD 4.2?
    Thanx.

  2. Re: No way to get multithreaded gcc on OpenBSD?

    In article <20b7bbe9-8727-45a7-81e4-857caabc77f2@s13g2000prd.googlegroups.com>,
    Viatly wrote:
    >Hi all. I am writing multithreaded C++ app which on my POV requires
    >gcc configured with Threading model: posix.
    >The one I have on my OpenBSD 4.2 is single-threaded:
    >#g++ -v
    >Reading specs from /usr/lib/gcc-lib/i386-unknown-openbsd4.2/3.3.5/
    >specs
    >Configured with:
    >Thread model: single
    >gcc version 3.3.5 (propolice)
    >
    >OpenBSD ports does not provide multithreaded gcc, so I tried to build
    >it myself from gcc sources. I downloaded src for gcc 3.3.5 and for gcc
    >4.2.2 frok gcc site but failed to compile either of them! (I compiled
    >with --enable-threads=posix --enable-languages=c,c++). Trying to make
    >gcc 3.3.5 resulted in yacc error, for gcc 4.2.2 it was $< macro error.
    >I am wondering is it a way to get multithreaded gcc on OpenBSD 4.2?
    >Thanx.


    Things will break horribly in the libc.

  3. Re: No way to get multithreaded gcc on OpenBSD?

    On Jan 15, 3:41 pm, es...@lain.home (Marc Espie) wrote:
    > In article <20b7bbe9-8727-45a7-81e4-857caabc7...@s13g2000prd.googlegroups.com>,
    >
    >
    >
    > Viatly wrote:
    > >Hi all. I am writing multithreaded C++ app which on my POV requires
    > >gcc configured with Threading model: posix.
    > >The one I have on my OpenBSD 4.2 is single-threaded:
    > >#g++ -v
    > >Reading specs from /usr/lib/gcc-lib/i386-unknown-openbsd4.2/3.3.5/
    > >specs
    > >Configured with:
    > >Thread model: single
    > >gcc version 3.3.5 (propolice)

    >
    > >OpenBSD ports does not provide multithreaded gcc, so I tried to build
    > >it myself from gcc sources. I downloaded src for gcc 3.3.5 and for gcc
    > >4.2.2 frok gcc site but failed to compile either of them! (I compiled
    > >with --enable-threads=posix --enable-languages=c,c++). Trying to make
    > >gcc 3.3.5 resulted in yacc error, for gcc 4.2.2 it was $< macro error.
    > >I am wondering is it a way to get multithreaded gcc on OpenBSD 4.2?
    > >Thanx.

    >
    > Things will break horribly in the libc.


    Mmm, Marc, could you please be a bit more detailed?

  4. Re: No way to get multithreaded gcc on OpenBSD?

    Hi!

    Viatly wrote:
    >Hi all. I am writing multithreaded C++ app which on my POV requires
    >gcc configured with Threading model: posix.


    Why do you need that? What fails with your application when you compile
    and link with -pthread, as in
    c++ -pthread -c foo.cc
    c++ -pthread -c bar.cc
    c++ -pthread -o application foo.o bar.o

    >[...]


    Kind regards,

    Hannah.

  5. Re: No way to get multithreaded gcc on OpenBSD?

    In article <5598ff89-9286-455f-a561-f21df5003c18@f10g2000hsf.googlegroups.com>,
    Viatly wrote:
    >Mmm, Marc, could you please be a bit more detailed?


    Sorry, I was a bit out of time.

    Some gcc libraries, specifically the libstdc++, do rely on some hooks in the
    libc that do not necessarily exist. Specifically, the libstdc++ will compile
    `thread-safe' on a gnu-linux system.

    If you compile it on OpenBSD, you will get something that does not work.
    Assuming you fix the few issues you found, the configure mechanism still
    will not find `proper' `thread-safe' versions of some libc underlying
    functions (IO functions), and will give you non-thread safe iostreams.

    You can fix that by either implementing the gnu hooks in our libc, or
    porting libstdc++ to our environment.

    Otherwise, you will end up with a subtly broken C++ system---one that is
    not thread-safe at all.

    This is the sense of `horribly'. Things will work most of the time, but
    without locking mechanisms, things that should be protected from other
    threads won't be.

    Admittedly, since we only have a functional userland-only thread library
    for now, this may not be such a big issue, since pthread does already
    abuse signals to such a point that a lot of things don't work in some
    fringe cases...



  6. Re: No way to get multithreaded gcc on OpenBSD?

    On Jan 16, 2:21 pm, es...@lain.home (Marc Espie) wrote:
    > In article <5598ff89-9286-455f-a561-f21df5003...@f10g2000hsf.googlegroups.com>,
    >
    > Viatly wrote:
    > >Mmm, Marc, could you please be a bit more detailed?

    >
    > Sorry, I was a bit out of time.
    >
    > Some gcc libraries, specifically the libstdc++, do rely on some hooks in the
    > libc that do not necessarily exist. Specifically, the libstdc++ will compile
    > `thread-safe' on a gnu-linux system.
    >
    > If you compile it on OpenBSD, you will get something that does not work.
    > Assuming you fix the few issues you found, the configure mechanism still
    > will not find `proper' `thread-safe' versions of some libc underlying
    > functions (IO functions), and will give you non-thread safe iostreams.
    >
    > You can fix that by either implementing the gnu hooks in our libc, or
    > porting libstdc++ to our environment.
    >
    > Otherwise, you will end up with a subtly broken C++ system---one that is
    > not thread-safe at all.
    >
    > This is the sense of `horribly'. Things will work most of the time, but
    > without locking mechanisms, things that should be protected from other
    > threads won't be.
    >
    > Admittedly, since we only have a functional userland-only thread library
    > for now, this may not be such a big issue, since pthread does already
    > abuse signals to such a point that a lot of things don't work in some
    > fringe cases...


    Thanx. Your answer basically means that this is almost no chance for
    me to use e.g. boost::thread library and I have to use C-style pthread
    API to write my own C/C++ application. Right?

+ Reply to Thread