Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openblas 0.3.13 fails to compile on macOS #3037

Closed
fxcoudert opened this issue Dec 13, 2020 · 7 comments · Fixed by #3038
Closed

openblas 0.3.13 fails to compile on macOS #3037

fxcoudert opened this issue Dec 13, 2020 · 7 comments · Fixed by #3038

Comments

@fxcoudert
Copy link

fxcoudert commented Dec 13, 2020

openblas 0.3.13 fails to compile in Homebrew (Homebrew/homebrew-core#66821) with:

gcc-ranlib ../../libopenblasp-r0.3.13.a
 make[2]: gcc-ranlib: No such file or directory
 make[2]: *** [../../libopenblasp-r0.3.13.a] Error 1
 make[1]: *** [lapacklib] Error 2
 make: *** [netlib] Error 2

We run:

system make CC=gcc-10 FC=gfortran libs netlib shared

I have no idea why it's trying to call gcc-ranlib, but we don't have it installed. The system ranlib works perfectly fine, and should be called. We can (and probably will) override this with RANLIB=ranlib but that still seems like a bug that should be fixed here.

@martin-frbg
Copy link
Collaborator

I do not think this is due to a change in 0.3.13, possibly the hyphenation in gcc-10 tricks c_check into assuming that you are cross-compiling with a CROSS_SUFFIX (actually prefix) of "gcc-" to add to RANLIB in Makefile.system. Do you see CROSS=1 in your Makefile.conf ?

@fxcoudert
Copy link
Author

$ grep CROSS Makefile.conf 
CROSS_SUFFIX=gcc-
CROSS=1

@fxcoudert
Copy link
Author

That's because this code is broken since da6d5d6

# Checking cross compile
 $hostos   = `uname -s | sed -e s/\-.*//`;    chop($hostos);
 $hostarch = `uname -m | sed -e s/i.86/x86/`;chop($hostarch);
 $hostarch = `uname -p` if ($hostos eq "AIX");
 $hostarch = `uname -p` if ($hostos eq "AIX" || $hostos eq "SunOS");
 chop($hostarch);

uname -m returns x86_64\n, the first chop (on the same line) removes the newline. But then there is an extra chop on line 10, don't know why, which removes the 4. Later, we end up with architecture= x86_64 and hostarch= x86_6, and therefore identified as cross-compiling.

@fxcoudert
Copy link
Author

I'm not sure why chop is being used at all throughout this code. The only thing that should be removed is the trailing newline, so chomp would a lot safer than chop.

@martin-frbg
Copy link
Collaborator

Ah, thanks, that is a bit insidious indeed. The Solaris case probably needs its own line anyway IF the AIX case used to work without a chop/chomp. (And the whole thing could go unnoticed on Linux, and apparently all other systems including OSX in our CI as well, as they have gcc-ranlib installed)

@fxcoudert
Copy link
Author

I'd still recommend using chomp (instead of chop) for safety. Is there a case in this script where you want to remove something other than a newline? That'd be weird

@martin-frbg
Copy link
Collaborator

Probably not - unless some platform returns a trailing blank or has a misbehaving chomp. The "chop" has been inherited from GotoBLAS I believe...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants