[cfe-dev] messed up C++ compile on OpenBSD

Amit Kulkarni amitkulz at gmail.com
Tue Feb 15 20:00:25 PST 2011


Hello,

Here's a simple C++ program called clantest.cpp

#include <string>
#include <iostream>
using namespace std;
int main() {
   cout << "Hello world";
   return 0;
}

WHen I try to compile it on openbsd -current with clang -current I get
problems. Can somebody tell me what's the problem with C++ compiler
and libstdc++ on OpenBSD? There is no problem with clang C compiler.

clang version 2.9 (trunk 125613)
Target: x86_64-unknown-openbsd4.9
Thread model: posix
 "/usr/local/bin/clang" -cc1 -triple x86_64-unknown-openbsd4.9
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier
-main-file-name clantest.cpp -mrelocation-model static
-mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -target-linker-version 2.15
-momit-leaf-frame-pointer -v -resource-dir
/usr/local/bin/../lib/clang/2.9 -ferror-limit 19 -fmessage-length 0
-fexceptions -fgnu-runtime -fdiagnostics-show-option -o
/tmp/cc-sVpnWD.o -x c++ clantest.cpp
clang -cc1 version 2.9 based upon llvm 2.9svn hosted on
x86_64-unknown-openbsd4.9
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++
 /usr/include/g++/amd64-unknown-openbsd4.9
 /usr/include/g++/backward
 /usr/local/include
 /usr/local/bin/../lib/clang/2.9/include
 /usr/include
End of search list.
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:68:
/usr/include/g++/cstdlib:169:11: error: target of using declaration
conflicts with declaration already in scope
 using ::_Exit;
         ^
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:68:
In file included from /usr/include/g++/cstdlib:71:
/usr/include/stdlib.h:120:14: note: target of using declaration
__dead void      _Exit(int);
                ^
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:68:
/usr/include/g++/cstdlib:166:20: note: conflicting declaration
 extern "C" void (_Exit)(int);
                  ^
/usr/include/g++/cstdlib:188:46: error: redefinition of parameter 'restrict'
   (strtoll)(const char * restrict, char ** restrict, int);
                                            ^
/usr/include/g++/cstdlib:188:28: note: previous declaration is here
   (strtoll)(const char * restrict, char ** restrict, int);
                          ^
/usr/include/g++/cstdlib:190:47: error: redefinition of parameter 'restrict'
   (strtoull)(const char * restrict, char ** restrict, int);
                                             ^
/usr/include/g++/cstdlib:190:29: note: previous declaration is here
   (strtoull)(const char * restrict, char ** restrict, int);
                           ^
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:70:
In file included from /usr/include/g++/iosfwd:44:
In file included from
/usr/include/g++/amd64-unknown-openbsd4.9/bits/c++locale.h:48:
/usr/include/g++/cstdio:158:52: error: redefinition of parameter 'restrict'
 (snprintf)(char * restrict, size_t, const char * restrict, ...);
                                                  ^
/usr/include/g++/cstdio:158:21: note: previous declaration is here
 (snprintf)(char * restrict, size_t, const char * restrict, ...);
                   ^
/usr/include/g++/cstdio:160:43: error: redefinition of parameter 'restrict'
 (vfscanf)(FILE * restrict, const char * restrict, __gnuc_va_list);
                                         ^
/usr/include/g++/cstdio:160:20: note: previous declaration is here
 (vfscanf)(FILE * restrict, const char * restrict, __gnuc_va_list);
                  ^
/usr/include/g++/cstdio:163:53: error: redefinition of parameter 'restrict'
 (vsnprintf)(char * restrict, size_t, const char * restrict, __gnuc_va_list);
                                                   ^
/usr/include/g++/cstdio:163:22: note: previous declaration is here
 (vsnprintf)(char * restrict, size_t, const char * restrict, __gnuc_va_list);
                    ^
/usr/include/g++/cstdio:165:49: error: redefinition of parameter 'restrict'
 (vsscanf)(const char * restrict, const char * restrict, __gnuc_va_list);
                                               ^
/usr/include/g++/cstdio:165:26: note: previous declaration is here
 (vsscanf)(const char * restrict, const char * restrict, __gnuc_va_list);
                        ^
/usr/include/g++/cstdio:169:11: error: target of using declaration
conflicts with declaration already in scope
 using ::snprintf;
         ^
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:70:
In file included from /usr/include/g++/iosfwd:44:
In file included from
/usr/include/g++/amd64-unknown-openbsd4.9/bits/c++locale.h:48:
In file included from /usr/include/g++/cstdio:52:
/usr/include/stdio.h:266:6: note: target of using declaration
int      snprintf(char *, size_t, const char *, ...)
        ^
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:70:
In file included from /usr/include/g++/iosfwd:44:
In file included from
/usr/include/g++/amd64-unknown-openbsd4.9/bits/c++locale.h:48:
/usr/include/g++/cstdio:158:4: note: conflicting declaration
 (snprintf)(char * restrict, size_t, const char * restrict, ...);
  ^
/usr/include/g++/cstdio:170:11: error: target of using declaration
conflicts with declaration already in scope
 using ::vfscanf;
         ^
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:70:
In file included from /usr/include/g++/iosfwd:44:
In file included from
/usr/include/g++/amd64-unknown-openbsd4.9/bits/c++locale.h:48:
In file included from /usr/include/g++/cstdio:52:
/usr/include/stdio.h:270:6: note: target of using declaration
int      vfscanf(FILE *, const char *, __va_list)
        ^
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:70:
In file included from /usr/include/g++/iosfwd:44:
In file included from
/usr/include/g++/amd64-unknown-openbsd4.9/bits/c++locale.h:48:
/usr/include/g++/cstdio:160:4: note: conflicting declaration
 (vfscanf)(FILE * restrict, const char * restrict, __gnuc_va_list);
  ^
/usr/include/g++/cstdio:171:11: error: target of using declaration
conflicts with declaration already in scope
 using ::vscanf;
         ^
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:70:
In file included from /usr/include/g++/iosfwd:44:
In file included from
/usr/include/g++/amd64-unknown-openbsd4.9/bits/c++locale.h:48:
In file included from /usr/include/g++/cstdio:52:
/usr/include/stdio.h:273:6: note: target of using declaration
int      vscanf(const char *, __va_list)
        ^
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:70:
In file included from /usr/include/g++/iosfwd:44:
In file included from
/usr/include/g++/amd64-unknown-openbsd4.9/bits/c++locale.h:48:
/usr/include/g++/cstdio:161:19: note: conflicting declaration
 extern "C" int (vscanf)(const char * restrict, __gnuc_va_list);
                 ^
/usr/include/g++/cstdio:172:11: error: target of using declaration
conflicts with declaration already in scope
 using ::vsnprintf;
         ^
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:70:
In file included from /usr/include/g++/iosfwd:44:
In file included from
/usr/include/g++/amd64-unknown-openbsd4.9/bits/c++locale.h:48:
In file included from /usr/include/g++/cstdio:52:
/usr/include/stdio.h:276:6: note: target of using declaration
int      vsnprintf(char *, size_t, const char *, __va_list)
        ^
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:70:
In file included from /usr/include/g++/iosfwd:44:
In file included from
/usr/include/g++/amd64-unknown-openbsd4.9/bits/c++locale.h:48:
/usr/include/g++/cstdio:163:4: note: conflicting declaration
 (vsnprintf)(char * restrict, size_t, const char * restrict, __gnuc_va_list);
  ^
/usr/include/g++/cstdio:173:11: error: target of using declaration
conflicts with declaration already in scope
 using ::vsscanf;
         ^
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:70:
In file included from /usr/include/g++/iosfwd:44:
In file included from
/usr/include/g++/amd64-unknown-openbsd4.9/bits/c++locale.h:48:
In file included from /usr/include/g++/cstdio:52:
/usr/include/stdio.h:280:6: note: target of using declaration
int      vsscanf(const char *, const char *, __va_list)
        ^
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:70:
In file included from /usr/include/g++/iosfwd:44:
In file included from
/usr/include/g++/amd64-unknown-openbsd4.9/bits/c++locale.h:48:
/usr/include/g++/cstdio:165:4: note: conflicting declaration
 (vsscanf)(const char * restrict, const char * restrict, __gnuc_va_list);
  ^
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:70:
In file included from /usr/include/g++/iosfwd:48:
In file included from /usr/include/g++/bits/postypes.h:45:
/usr/include/g++/cwchar:263:52: error: redefinition of parameter 'restrict'
   (wcstold)(const wchar_t * restrict, wchar_t ** restrict);
                                                  ^
/usr/include/g++/cwchar:263:31: note: previous declaration is here
   (wcstold)(const wchar_t * restrict, wchar_t ** restrict);
                             ^
/usr/include/g++/cwchar:266:11: error: target of using declaration
conflicts with declaration already in scope
 using ::wcstold;
         ^
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:70:
In file included from /usr/include/g++/iosfwd:48:
In file included from /usr/include/g++/bits/postypes.h:45:
In file included from /usr/include/g++/cwchar:54:
/usr/include/wchar.h:150:13: note: target of using declaration
long double wcstold(const wchar_t * __restrict, wchar_t ** __restrict);
           ^
In file included from clantest.cpp:1:
In file included from /usr/include/g++/string:46:
In file included from /usr/include/g++/bits/char_traits.h:45:
In file included from /usr/include/g++/bits/stl_algobase.h:70:
In file included from /usr/include/g++/iosfwd:48:
In file included from /usr/include/g++/bits/postypes.h:45:
/usr/include/g++/cwchar:263:6: note: conflicting declaration
   (wcstold)(const wchar_t * restrict, wchar_t ** restrict);
    ^
/usr/include/g++/cwchar:270:52: error: redefinition of parameter 'restrict'
   (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int);
                                                  ^
/usr/include/g++/cwchar:270:31: note: previous declaration is here
   (wcstoll)(const wchar_t * restrict, wchar_t ** restrict, int);
                             ^
/usr/include/g++/cwchar:272:53: error: redefinition of parameter 'restrict'
   (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int);
                                                   ^
/usr/include/g++/cwchar:272:32: note: previous declaration is here
   (wcstoull)(const wchar_t * restrict, wchar_t ** restrict, int);
                              ^
16 errors generated.



More information about the cfe-dev mailing list