public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: ggl329 <ggl329@gmail.com>
To: cygwin@cygwin.com
Subject: Re: iostream doesn't work (clang++)
Date: Thu, 6 Jul 2023 00:54:31 +0900	[thread overview]
Message-ID: <3c02f650-248e-9e03-94a8-d508c857474e@gmail.com> (raw)
In-Reply-To: <47f9e50d-763b-e6a9-b2b0-8d3cc311a63b@maxrnd.com>

Hi Mark,

On 2023/07/05 12:06, Mark Geisert via Cygwin wrote:
> My previous reply addressed the specific error reported by your testcase.
> But I am unable to make progress on the root cause because I can't reproduce your report.

Hm, it seems to be difficult to track down the root cause...

> On my system I try the compilation and see:
> ~ clang++ sample.cc
> sample.cc:1:10: fatal error: 'iostream' file not found
> #include <iostream>
>           ^~~~~~~~~~
> 1 error generated.

I tried with clang++ --verbose, and the log showed search paths for #include.
iostream is at /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/iostream.
Can you find it? It comes from gcc-g++.
Or the search path includes /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++?



$ clang++ sample.cc --verbose
clang version 8.0.1 (tags/RELEASE_801/final)
Target: x86_64-unknown-windows-cygnus
Thread model: posix
InstalledDir: /usr/bin
  "/usr/bin/clang-8" -cc1 -triple x86_64-unknown-windows-cygnus -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name sample.cc -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -v -resource-dir /usr/lib/clang/8.0.1 -internal-isystem /usr/x86_64-pc-cygwin/include/c++ -internal-isystem /usr/x86_64-pc-cygwin/include/c++/x86_64-pc-cygwin -internal-isystem /usr/x86_64-pc-cygwin/include/c++/backward -internal-isystem /usr/x86_64-pc-cygwin/include/c++/11 -internal-isystem /usr/x86_64-pc-cygwin/include/c++/11/x86_64-pc-cygwin -internal-isystem /usr/x86_64-pc-cygwin/include/c++/11/backward -internal-isystem /usr/include/c++/11 -internal-isystem /usr/include/c++/11/x86_64-pc-cygwin -internal-isystem /usr/include/c++/11/backward -internal-isystem /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++ -internal-isystem /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/x86_64-pc-cygwin -internal-isystem /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/backward -internal-isystem /usr/lib/clang/8.0.1/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/clang/8.0.1/include -internal-isystem /usr/x86_64-pc-cygwin/include -internal-isystem /usr/include -internal-isystem /usr/include/w32api -fdeprecated-macro -fdebug-compilation-dir /home/ggl329/tmp -ferror-limit 19 -fmessage-length 120 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fseh-exceptions -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/sample-76ab2a.o -x c++ sample.cc -faddrsig
clang -cc1 version 8.0.1 based upon LLVM 8.0.1 default target x86_64-unknown-cygwin
ignoring nonexistent directory "/usr/x86_64-pc-cygwin/include/c++"
ignoring nonexistent directory "/usr/x86_64-pc-cygwin/include/c++/x86_64-pc-cygwin"
ignoring nonexistent directory "/usr/x86_64-pc-cygwin/include/c++/backward"
ignoring nonexistent directory "/usr/x86_64-pc-cygwin/include/c++/11"
ignoring nonexistent directory "/usr/x86_64-pc-cygwin/include/c++/11/x86_64-pc-cygwin"
ignoring nonexistent directory "/usr/x86_64-pc-cygwin/include/c++/11/backward"
ignoring nonexistent directory "/usr/include/c++/11"
ignoring nonexistent directory "/usr/include/c++/11/x86_64-pc-cygwin"
ignoring nonexistent directory "/usr/include/c++/11/backward"
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/x86_64-pc-cygwin/include"
ignoring duplicate directory "/usr/lib/clang/8.0.1/include"
#include "..." search starts here:
#include <...> search starts here:
  /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++
  /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/x86_64-pc-cygwin
  /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/backward
  /usr/lib/clang/8.0.1/include
  /usr/include
  /usr/include/w32api
End of search list.
In file included from sample.cc:1:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/iostream:39:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/ostream:38:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/ios:42:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/bits/ios_base.h:39:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/ext/atomicity.h:35:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/x86_64-pc-cygwin/bits/gthr.h:148:
In file included from /usr/lib/gcc/x86_64-pc-cygwin/11/include/c++/x86_64-pc-cygwin/bits/gthr-default.h:35:
In file included from /usr/include/pthread.h:11:
In file included from /usr/include/sys/types.h:221:
In file included from /usr/include/sys/_pthreadtypes.h:12:
/usr/include/sys/cpuset.h:45:24: error: use of undeclared identifier '__builtin_malloc'; did you mean
       '__builtin_alloca'?
   return (cpu_set_t *) __builtin_malloc (CPU_ALLOC_SIZE(num));
                        ^
/usr/include/sys/cpuset.h:45:24: note: '__builtin_alloca' declared here
/usr/include/sys/cpuset.h:52:3: error: use of undeclared identifier '__builtin_free'
   __builtin_free (set);
   ^
2 errors generated.



> My list of possibly related package versions looks very similar to yours:

In my environment, all the packages and versions you listed are installed.

> I'm not a clang user so there might be something fundamentally wrong with
> my setup that I don't see.  Also, do you have a CFLAGS or other environment
> string(s) that would possibly be passed to clang as it would to gcc?
> Has "clang++" been aliased to something else, perhaps passing options
> that way?  Also, do you happen to have any of the boost libraries installed?

I also use gcc mainly. I use clang just for bug check and coding completion.
So, I'm not familiar with clang's behavior either.
CFLAGS, CXXFLAGS and such other environment variables are not set.
/usr/bin/clang++ is linked to clang-8.exe, and /usr/bin/clang-8.exe is
executed as in the log shown above.
Only libboost_regex1.66 is installed from boost.

$ printenv | grep include
(no output)
$ printenv | grep -i flag
(no output)
$ type clang++
clang++ is /usr/bin/clang++
$ ls -o /usr/bin/clang++
lrwxrwxrwx 1 root 11 Jan  8 16:08 /usr/bin/clang++ -> clang-8.exe
$ cygcheck -dc | grep boost
libboost_regex1.66                      1.66.0-1


Thanks,


    ggl329

  reply	other threads:[~2023-07-05 15:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-04 16:48 ggl329
2023-07-04 18:51 ` Mark Geisert
2023-07-05  3:06 ` Mark Geisert
2023-07-05 15:54   ` ggl329 [this message]
2023-07-05 23:08     ` Brian Inglis
2023-07-07  8:01       ` Mark Geisert
2023-07-07 15:48       ` Jon Turney
2023-07-07 18:18         ` gs-cygwin.com
2023-07-08  9:12           ` Jon Turney
2023-07-13  5:52     ` Mark Geisert
2023-07-13 16:11       ` ggl329

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3c02f650-248e-9e03-94a8-d508c857474e@gmail.com \
    --to=ggl329@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).