#1625 Correction to gcc_selected function

open
nobody
5
2014-08-03
2011-10-13
Anonymous
No

I'm running OSX 10.6.8 with Xcode 3.2.6. This version of Xcode appears to set the gcc symlink in /opt/local/bin/gcc, which is returned from 'which gcc', so to get the bootstrap script to run, I had to change the gcc_selected function in perlmod/Fink/Services.pm as follows:

#sub gcc_selected {
# # this should work anywhere we support, really
# if (-l '/usr/bin/gcc') {
# my $link = readlink('/usr/bin/gcc');
# if ($link =~ /gcc-(\d+\.\d+)/) {
# return $1;
# } else {
# print STDERR "WARNING: /usr/bin/gcc is not a symlink!";
# }
# }
# return 0;
# }

sub gcc_selected {
# this should work anywhere we support, really
if (-l '/opt/local/bin/gcc') {
my $link = readlink('/opt/local/bin/gcc');
if ($link =~ /gcc-(\d+\.\d+)/) {
return $1;
} else {
print STDERR "WARNING: /opt/local/bin/gcc is not a symlink!";
}
}
return 0;
}

This enabled the bootstrap script to run successfully. More generally the path to the gcc symlink should probably be read from either 'which gcc' or an environment variable.

Also, as of at least Xcode 3.1 gcc_select no longer exists, and no replacement in apparent. The bootstrap script currently suggests that we use gcc_select to set the version of gcc if necessary, which it should not do anymore.

Discussion

  • Umm...no.

    That symlink has nothing to do with Xcode.

     
  • The text discussing gcc_select should definitely be removed, however, because we've found that when people _create_ such a script it breaks current versions of fink.

     
  • Reading an environment variable for gcc is bad, because we _deliberately_ don't read the user's environment in an attempt to have a fully deterministic build process on all systems.

    Xcode, to date, installs gcc as /usr/bin/gcc, period. We're not modifying fink's bootstrap code so that people can use compilers from Macports, which is what your symlink is doing.