Re: gcc48 error on Mavericks

2014-01-10 Thread Brandon Allbery
On Sat, Jan 11, 2014 at 12:56 AM, Shiyuan  wrote:

> There is another problem regarding to the coexistence of xcode gcc and
> gcc48 from macports.
> When I do  "port select gcc mp-gcc48" , I can compile using "g++". But
> when I switch back by "port select gcc none",
> I got the error:
>
> > g++ -g -o HelloWorld HelloWorld.cpp
>
> -bash: /opt/local/bin/g++: No such file or directory
>
> But strangely, when I do "which g++",  I get "/usr/bin/g++". Then why
> "g++" still try to involve "/opt/local/bin/g++" but not "/usr/bin/g++"?
>

`which` is often not a shell builtin and/or not using what your current
shell's state is, and will often show you not what your current shell sees
but what a new shell would see (or, in older versions especially with *csh,
what you would see if you logged out and back in). You should not rely on
it. `type` shows you (and is required by POSIX to show you) what the
current shell "knows", not what it would find if it were restarted.

In this case, the problem is that bash remembers where it found a command,
rather than looking again for it every single time; you need to use `hash
-r` to make it forget that it once saw /opt/local/bin/g++ so it will go
find out that /usr/bin/g++ is currently the only one on $PATH. (Actually
setting $PATH will do this automatically; removing an executable found
somewhere on $PATH originally does not.)

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Re: gcc48 error on Mavericks

2014-01-10 Thread Shiyuan
There is another problem regarding to the coexistence of xcode gcc and
gcc48 from macports.
When I do  "port select gcc mp-gcc48" , I can compile using "g++". But when
I switch back by "port select gcc none",
I got the error:

> g++ -g -o HelloWorld HelloWorld.cpp

-bash: /opt/local/bin/g++: No such file or directory

But strangely, when I do "which g++",  I get "/usr/bin/g++". Then why "g++"
still try to involve "/opt/local/bin/g++" but not "/usr/bin/g++"?

Thanks.

Shiyuan


On Fri, Jan 10, 2014 at 9:32 PM, Shiyuan  wrote:

> That solves the problem. Thanks.
>
>
> On Fri, Jan 10, 2014 at 7:47 PM, Brandon Allbery wrote:
>
>> On Fri, Jan 10, 2014 at 9:53 PM, Shiyuan  wrote:
>>
>>>I am on OS 10.9 Mavericks. I install gcc48 from macport. However, I
>>> got the follow error when I compile HelloWorld. What might go wrong?
>>> Thanks.
>>>
>>
>> wchar.h is part of the Xcode command line tools package. If you got gcc48
>> from a prebuilt package instead of locally built, you may never have gotten
>> the Xcode 5 command line tools (which may be auto-installed the first time
>> something invokes `clang`) and may be missing system include files.
>>
>> `xcode-select --install` should force installation of the command line
>> tools.
>>
>> --
>> brandon s allbery kf8nh   sine nomine
>> associates
>> allber...@gmail.com
>> ballb...@sinenomine.net
>> unix, openafs, kerberos, infrastructure, xmonad
>> http://sinenomine.net
>>
>
>
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Re: gcc48 error on Mavericks

2014-01-10 Thread Shiyuan
That solves the problem. Thanks.


On Fri, Jan 10, 2014 at 7:47 PM, Brandon Allbery wrote:

> On Fri, Jan 10, 2014 at 9:53 PM, Shiyuan  wrote:
>
>>I am on OS 10.9 Mavericks. I install gcc48 from macport. However, I
>> got the follow error when I compile HelloWorld. What might go wrong?
>> Thanks.
>>
>
> wchar.h is part of the Xcode command line tools package. If you got gcc48
> from a prebuilt package instead of locally built, you may never have gotten
> the Xcode 5 command line tools (which may be auto-installed the first time
> something invokes `clang`) and may be missing system include files.
>
> `xcode-select --install` should force installation of the command line
> tools.
>
> --
> brandon s allbery kf8nh   sine nomine
> associates
> allber...@gmail.com
> ballb...@sinenomine.net
> unix, openafs, kerberos, infrastructure, xmonad
> http://sinenomine.net
>
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


Re: gcc48 error on Mavericks

2014-01-10 Thread Brandon Allbery
On Fri, Jan 10, 2014 at 9:53 PM, Shiyuan  wrote:

>I am on OS 10.9 Mavericks. I install gcc48 from macport. However, I got
> the follow error when I compile HelloWorld. What might go wrong? Thanks.
>

wchar.h is part of the Xcode command line tools package. If you got gcc48
from a prebuilt package instead of locally built, you may never have gotten
the Xcode 5 command line tools (which may be auto-installed the first time
something invokes `clang`) and may be missing system include files.

`xcode-select --install` should force installation of the command line
tools.

-- 
brandon s allbery kf8nh   sine nomine associates
allber...@gmail.com  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users


gcc48 error on Mavericks

2014-01-10 Thread Shiyuan
Hi all,
   I am on OS 10.9 Mavericks. I install gcc48 from macport. However, I got
the follow error when I compile HelloWorld. What might go wrong? Thanks.

In file included from /opt/local/include/gcc48/c++/bits/postypes.h:40:0,

 from /opt/local/include/gcc48/c++/iosfwd:40,

 from /opt/local/include/gcc48/c++/ios:38,

 from /opt/local/include/gcc48/c++/ostream:38,

 from /opt/local/include/gcc48/c++/iostream:39,

 from HelloWorld.cpp:5:

/opt/local/include/gcc48/c++/cwchar:44:19: fatal error: wchar.h: No such
file or directory

 #include 

   ^

compilation terminated.


Shiyuan
___
macports-users mailing list
macports-users@lists.macosforge.org
https://lists.macosforge.org/mailman/listinfo/macports-users