what you see is difficult to explain, unless the PATH changed between the two 
tests.

if

'which gcc' gives /opt/local/bin/gcc

then

gcc --version

should give exactly the same as

/opt/local/bin/gcc --version


Now you know that /opt/local/bin/gcc will not actually exist, unless you have 
"selected" a gcc in macports to be your default gcc.  You probably want to 
unselect that if you did select one, as having it always set can cause problems 
that can be hard to debug. I do set a selected gcc sometimes, but unset it 
right after.

Ken




On 2023-06-01, at 8:17 AM, David Nicholls via macports-users wrote:

> I upgraded OSX to the latest Ventura, installed the latest Xcode, and Xcode 
> tools, accepted the license, then reinstalled Macports as per the 
> instructions.  Versions of gcc older than gcc12 failed (as advised in the 
> resintall), so I installed gcc12, ran port select to activate gcc12 and 
> gfortran12. All ok so far.
> 
> 'which gcc' gives /opt/local/bin/gcc
> 
> But:
> 
> <xxxx>:~ username$ gcc --version
> Apple clang version 14.0.3 (clang-1403.0.22.14.1)
> Target: x86_64-apple-darwin22.5.0
> Thread model: posix
> InstalledDir: 
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
> 
> and
> 
> <xxxx>:~ username$ /opt/local/bin/gcc --version
> gcc (MacPorts gcc12 12.3.0_0+stdlib_flag) 12.3.0
> Copyright (C) 2022 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.
> 
> Why does the command 'gcc --version' not give that same result as 
> '/opt/local/bin/gcc --version' ?
> 
> 'gfortan --version' works as expected
> 
> DN

Reply via email to