[tex-live] tlmgr invokes cc on OS X

Mojca Miklavec mojca.miklavec.lists at gmail.com
Tue Oct 29 18:02:03 CET 2013


On Tue, Oct 29, 2013 at 5:37 PM, Maxwell, Adam R wrote:
> On Oct 29, 2013, at 08:57, Mojca Miklavec wrote:
>
>> If Karl agrees, if it is easy to do and if invoking the compiler makes
>> problems on newer OSes (I didn't install 10.9 yet), I definitely
>> support the idea to avoid calling config.guess on Macs. The
>> config.guess script doesn't return anything useful on Mac anyway, so
>> it's already useless.
>
> I just looked at config.guess in more detail. Checking for 64-bit
> by compiling seems nonsensical, since Apple's compiler is basically a
> cross-compiler.

I totally agree. On the other hand I had problems because config.guess
reports "mips64el-linux" instead of "mipsel-linux" just because uname
reports 64-bit kernel (while compiler produces 32-binaries and
64-binaries don't even work). In that case running the compiler would
actually have been the only proper way to check whether certain
64-bitness flags are present, but the developers' response was:

   > No, it's not a bug.  You are running a 64-bit kernel with 32-bit
   > userland.  Historically, we use what the kernel reports.  If you want
   > something different, pass --host=mipsel-linux (for example) to
   > configure.

Then I asked about fixing the situation on Mac and never got a
response. So I believe that trying to fix config.guess upstream is
more or less hopeless unless someone with sufficient motivation wants
to start convincing the developers that certain changes would be worth
doing.

> If there's already a special case for Darwin, using
> sysctl would be better, IMNSHO.

sysctl is already used. The problem is that tlmgr first calls
config.guess and only once config.guess reports "darwin", TLUtils.pm
runs sysctl.

The current code is:

sub platform {
  unless (defined $::_platform_) {
    if ($^O =~ /^MSWin/i) {
      $::_platform_ = "win32";
    } else {
      my $config_guess = "$::installerdir/tlpkg/installer/config.guess";

      # We cannot rely on #! in config.guess but have to call /bin/sh
      # explicitly because sometimes the 'noexec' flag is set in
      # /etc/fstab for ISO9660 file systems.
      chomp (my $guessed_platform = `/bin/sh '$config_guess'`);

      # For example, if the disc or reader has hardware problems.
      die "$0: could not run $config_guess, cannot proceed, sorry"
        if ! $guessed_platform;

      $::_platform_ = platform_name($guessed_platform);
    }
  }
  return $::_platform_;
}

followed by

  if ($OS eq "darwin") {
    # We want to guess x86_64-darwin on new-enough systems.~~
    # Most robust approach is to check sw_vers (os version)
    # and sysctl (processor hardware).
    chomp (my $sw_vers = `sw_vers -productVersion`);
    my ($os_major,$os_minor) = split (/\./, $sw_vers);
    #
    chomp (my $sysctl = `sysctl hw.cpu64bit_capable`);
    my (undef,$hw_64_bit) = split (" ", $sysctl);
    #
    $CPU = ($os_major >= 10 && $os_minor >= 6 && $hw_64_bit >= 1)
           ? "x86_64" : "universal";
  }

The first part could have been

    if ($^O =~ /^MSWin/i) {
      $::_platform_ = "win32";
    } elsif ($^O =~ /darwin/) {
      # or maybe even the whole sysctl code here
      $::_platform_ = "darwin";
    } else {

to avoid calling config.guess altogether.

Mojca


More information about the tex-live mailing list