[Boost-users] "template with C linkage"

282 views
Skip to first unread message

Chris Coleman

unread,
Jan 5, 2005, 6:04:47 AM1/5/05
to boost...@lists.boost.org
Hi,

I'm struggling with Boost (1.32) on Solaris 8 at the moment - I do not
have root access to the machine.

The default compiler is gcc-2.95, and so has no <ostream> <locale> etc
so the -sTOOLS=gcc toolset won't work. I then thought that the solution
would be to install STLPort, but can't get this to build cleanly.

Since then I have discovered that there is another version of gcc
(gcc-3.2) hidden in /opt/sfw/gcc-3.2. With this I then built the boost
libraries again, and installed them with the line:

bjam "--prefix=/staff/cqc/ -sGCC_ROOT_DIRECTORY=/opt/sfw/gcc-3.2
-sTOOLS=gcc" install

This seemed to work fine with no problems at all. I then moved the
headers, and the libs to the approprite places, and set about compiling
my project.

The result below is repeated many many times about various files:

/opt/sfw/gcc-3.2/bin/gcc -DHAVE_CONFIG_H -I. -I. -I.. -D_REENTRANT
-c -o zz_broker.o `test -f zz_broker.cpp || echo './'`zz_broker.cpp
In file included from /opt/sfw/gcc-3.2/include/c++/3.2/utility:66,
from
/staff/cqc/include/boost/config/select_stdlib_config.hpp:20,
from /staff/cqc/include/boost/config.hpp:40,
from /staff/cqc/include/boost/smart_ptr.hpp:14,
from zz_broker.h:28,
from zz_broker.cpp:24:
/opt/sfw/gcc-3.2/include/c++/3.2/bits/stl_relops.h:91: template with C
linkage
/opt/sfw/gcc-3.2/include/c++/3.2/bits/stl_relops.h:104: template with C
linkage
/opt/sfw/gcc-3.2/include/c++/3.2/bits/stl_relops.h:117: template with C
linkage
/opt/sfw/gcc-3.2/include/c++/3.2/bits/stl_relops.h:130: template with C
linkage

I have searched the list archives and googled around quite alot, but
can't seem to find any info.

Any help will be greatly recieved,
Cheers
Chris


This message has been scanned but we cannot guarantee that it and any
attachments are free from viruses or other damaging content: you are
advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Caleb Epstein

unread,
Jan 5, 2005, 10:40:39 AM1/5/05
to boost...@lists.boost.org
On Wed, 05 Jan 2005 11:04:47 +0000, Chris Coleman <c...@cs.nott.ac.uk> wrote:
> The result below is repeated many many times about various files:
>
> /opt/sfw/gcc-3.2/bin/gcc -DHAVE_CONFIG_H -I. -I. -I.. -D_REENTRANT
> -c -o zz_broker.o `test -f zz_broker.cpp || echo './'`zz_broker.cpp
> In file included from /opt/sfw/gcc-3.2/include/c++/3.2/utility:66,
> from
> /staff/cqc/include/boost/config/select_stdlib_config.hpp:20,
> from /staff/cqc/include/boost/config.hpp:40,
> from /staff/cqc/include/boost/smart_ptr.hpp:14,
> from zz_broker.h:28,
> from zz_broker.cpp:24:
> /opt/sfw/gcc-3.2/include/c++/3.2/bits/stl_relops.h:91: template with C
> linkage

Do you perhaps have extern "C" block still open before you include
<boost/smart_ptr.hpp>? I get identical errors compiling the following
test program:

extern "C" {
#include <boost/shared_ptr.hpp>
}

--
Caleb Epstein
caleb dot epstein at gmail dot com

David Abrahams

unread,
Jan 5, 2005, 11:14:14 AM1/5/05
to boost...@lists.boost.org
Chris Coleman wrote:

> The result below is repeated many many times about various files:
>
> /opt/sfw/gcc-3.2/bin/gcc -DHAVE_CONFIG_H -I. -I. -I.. -D_REENTRANT
> -c -o zz_broker.o `test -f zz_broker.cpp || echo './'`zz_broker.cpp
> In file included from /opt/sfw/gcc-3.2/include/c++/3.2/utility:66,
> from
> /staff/cqc/include/boost/config/select_stdlib_config.hpp:20,
> from /staff/cqc/include/boost/config.hpp:40,
> from /staff/cqc/include/boost/smart_ptr.hpp:14,
> from zz_broker.h:28,
> from zz_broker.cpp:24:
> /opt/sfw/gcc-3.2/include/c++/3.2/bits/stl_relops.h:91: template with C
> linkage
> /opt/sfw/gcc-3.2/include/c++/3.2/bits/stl_relops.h:104: template with C
> linkage
> /opt/sfw/gcc-3.2/include/c++/3.2/bits/stl_relops.h:117: template with C
> linkage
> /opt/sfw/gcc-3.2/include/c++/3.2/bits/stl_relops.h:130: template with C
> linkage

Does the same problem happen with the following C++ file?

#include <utility>
int main() {}

If so, it's not a boost problem.

--
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com

Chris Coleman

unread,
Jan 5, 2005, 11:20:41 AM1/5/05
to boost...@lists.boost.org
Caleb Epstein wrote:

>On Wed, 05 Jan 2005 11:04:47 +0000, Chris Coleman <c...@cs.nott.ac.uk> wrote:
>
>
>>The result below is repeated many many times about various files:
>>
>>/opt/sfw/gcc-3.2/bin/gcc -DHAVE_CONFIG_H -I. -I. -I.. -D_REENTRANT
>>-c -o zz_broker.o `test -f zz_broker.cpp || echo './'`zz_broker.cpp
>>In file included from /opt/sfw/gcc-3.2/include/c++/3.2/utility:66,
>> from
>>/staff/cqc/include/boost/config/select_stdlib_config.hpp:20,
>> from /staff/cqc/include/boost/config.hpp:40,
>> from /staff/cqc/include/boost/smart_ptr.hpp:14,
>> from zz_broker.h:28,
>> from zz_broker.cpp:24:
>>/opt/sfw/gcc-3.2/include/c++/3.2/bits/stl_relops.h:91: template with C
>>linkage
>>
>>
>
>Do you perhaps have extern "C" block still open before you include
><boost/smart_ptr.hpp>? I get identical errors compiling the following
>test program:
>
>extern "C" {
>#include <boost/shared_ptr.hpp>
>}
>
>
>
I have only one extern "C" {} block in the whole code. Its job is to
create a wrapper that allows a member function to be used as a pointer
to the pthread_create() function. I have checked that it is closed
properly. eg:

extern "C" {
void *ThreadStartup(void *);
}

The top of the file looks like:

#ifndef ZZ_BROKER_H
#define ZZ_BROKER_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <iostream>
#include <pthread.h>
#include <boost/smart_ptr.hpp>

...
...


The code compiles fine under gcc-linux (gentoo, mandrake), mingw,
cygwin, its just Solaris thats causing problems. I'm not sure if this
is due to it being the non-standard install of gcc or not, or whether it
is a problem with the way I build boost etc.

Cheers
Chris

This message has been scanned but we cannot guarantee that it and any
attachments are free from viruses or other damaging content: you are
advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

Chris Coleman

unread,
Jan 5, 2005, 11:34:20 AM1/5/05
to boost...@lists.boost.org
David Abrahams wrote:

>Chris Coleman wrote:
>
>
>
>>The result below is repeated many many times about various files:
>>
>>/opt/sfw/gcc-3.2/bin/gcc -DHAVE_CONFIG_H -I. -I. -I.. -D_REENTRANT
>>-c -o zz_broker.o `test -f zz_broker.cpp || echo './'`zz_broker.cpp
>>In file included from /opt/sfw/gcc-3.2/include/c++/3.2/utility:66,
>> from
>>/staff/cqc/include/boost/config/select_stdlib_config.hpp:20,
>> from /staff/cqc/include/boost/config.hpp:40,
>> from /staff/cqc/include/boost/smart_ptr.hpp:14,
>> from zz_broker.h:28,
>> from zz_broker.cpp:24:
>>/opt/sfw/gcc-3.2/include/c++/3.2/bits/stl_relops.h:91: template with C
>>linkage
>>/opt/sfw/gcc-3.2/include/c++/3.2/bits/stl_relops.h:104: template with C
>>linkage
>>/opt/sfw/gcc-3.2/include/c++/3.2/bits/stl_relops.h:117: template with C
>>linkage
>>/opt/sfw/gcc-3.2/include/c++/3.2/bits/stl_relops.h:130: template with C
>>linkage
>>
>>
>
>Does the same problem happen with the following C++ file?
>
> #include <utility>
> int main() {}
>
>If so, it's not a boost problem.
>
>
>
The above code seems to compile without problem on the solaris box:

marian$ cat test.cpp
#include <utility>
int main() {}
marian$ /opt/sfw/gcc-3.2/bin/g++ test.cpp
marian$

Cheers
Chris

This message has been scanned but we cannot guarantee that it and any
attachments are free from viruses or other damaging content: you are
advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

Bart

unread,
Jan 5, 2005, 11:45:25 AM1/5/05
to boost...@lists.boost.org
On Wed, 05 Jan 2005 11:04:47 +0000, Chris Coleman wrote:

> Hi,
>
...snip...
> /opt/sfw/gcc-3.2/bin/gcc -DHAVE_CONFIG_H -I. -I. -I.. -D_REENTRANT
> -c -o zz_broker.o `test -f zz_broker.cpp || echo './'`zz_broker.cpp

I think you want `/opt/sfw/gcc-3.2/bin/g++`.

Bart

Christopher Coleman

unread,
Jan 5, 2005, 12:32:10 PM1/5/05
to boost...@lists.boost.org
On Wed, Jan 05, 2005 at 09:45:25AM -0700, Bart wrote:
> > /opt/sfw/gcc-3.2/bin/gcc -DHAVE_CONFIG_H -I. -I. -I.. -D_REENTRANT
> > -c -o zz_broker.o `test -f zz_broker.cpp || echo './'`zz_broker.cpp
>
> I think you want `/opt/sfw/gcc-3.2/bin/g++`.

Hi,

Yeah - I noticed that after my 1st post. I was originally using:

CXX=/opt/sfw/gcc-3.2/bin/g++ ./configure && make

And tried gcc as a kind of desparate blind hope, but to no avail...

Sorry I should have added that to my previous post.

Cheers
Chris

This message has been scanned but we cannot guarantee that it and any
attachments are free from viruses or other damaging content: you are
advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

doktora

unread,
Feb 13, 2005, 7:23:40 PM2/13/05
to boost...@lists.boost.org
Christopher Coleman <cqc <at> cs.nott.ac.uk> writes:

>
> On Wed, Jan 05, 2005 at 09:45:25AM -0700, Bart wrote:
> > > /opt/sfw/gcc-3.2/bin/gcc -DHAVE_CONFIG_H -I. -I. -I.. -D_REENTRANT
> > > -c -o zz_broker.o `test -f zz_broker.cpp || echo './'`zz_broker.cpp
> >
> > I think you want `/opt/sfw/gcc-3.2/bin/g++`.
>
> Hi,
>
> Yeah - I noticed that after my 1st post. I was originally using:
>
> CXX=/opt/sfw/gcc-3.2/bin/g++ ./configure && make
>
> And tried gcc as a kind of desparate blind hope, but to no avail...
>
> Sorry I should have added that to my previous post.
>
> Cheers
> Chris
>
> This message has been scanned but we cannot guarantee that it and any
> attachments are free from viruses or other damaging content: you are
> advised to perform your own checks. Email communications with the
> University of Nottingham may be monitored as permitted by UK legislation.
>


I have the same problem on Mac OS X powerpc G4, trying to use boost_1_32_0.
Did you come up with a solution?

I've ungoogled some related info about NO_IMPLICIT_EXTERN_C flag, but have not
been able to resolve the issue.
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15834).
I'm completely baffled after two days of doing nothing but uncuccessfully trying
to resolve this! Please help!

(I will try this on suse 9.1 later today.)

This compiles:

#include <utility>
int main(){return 0;}

and this does not:

#include <boost/utility.hpp>
int main(){return 0;}

Both are compiled with:
/usr/bin/g++-3.3 main.cpp

There are over 1000 errors, most of them in this fashion:

In file included from /usr/include/gcc/darwin/3.3/c++/utility:66,
from /usr/include/boost/config/select_stdlib_config.hpp:20,
from /usr/include/boost/config.hpp:40,
from /usr/include/boost/utility/addressof.hpp:14,
from /usr/include/boost/utility.hpp:12,
from main.cpp:3:
/usr/include/gcc/darwin/3.3/c++/bits/stl_relops.h:91: error: template with C
linkage
/usr/include/gcc/darwin/3.3/c++/bits/stl_relops.h:104: error: template with C
linkage
/usr/include/gcc/darwin/3.3/c++/bits/stl_relops.h:117: error: template with C
linkage
/usr/include/gcc/darwin/3.3/c++/bits/stl_relops.h:130: error: template with C
linkage

More info:

/usr/bin/g++-3.3 --version
g++-3.3 (GCC) 3.3 20030304 (Apple Computer, Inc. build 1666)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

uname -a
Darwin Computer.local 7.7.0 Darwin Kernel Version 7.7.0: Sun Nov 7 16:06:51 PST
2004; root:xnu/xnu-517.9.5.obj~1/RELEASE_PPC Power Macintosh powerpc

Thanks!

Chris Coleman

unread,
Feb 14, 2005, 5:11:31 AM2/14/05
to boost...@lists.boost.org
Hi,

I'm affraid not, our sys admins installed a new gcc (3.4.3) and I
successufully managed to build it using this. (sparc-sun-solaris2.8)

Sorry not to be able to offer any more help,
Cheers
Chris
This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

Reply all
Reply to author
Forward
0 new messages