Re: Compilation failure for openblas-0.3.7-1 under OSX 10.11.6

"Homeier, Derek" <[email protected]>
Newsgroups gmane.os.apple.fink.beginners
Message-ID <[email protected]>
Hi David,
> 
>   A few further thoughts concerning openblas under OSX 10.11:  I should clarify, I have not tried to compile 0.3.6 myself at any point; the only thing I know today is that version 0.3.6 is present on my 10.11 machines and (presumably) working.  I never took a conscious choice to install it myself, I assume it is present because it is a dependency of some other program(s) that I did choose to install.  Another point is that I used to have binary downloads enabled until the problems with fink mirrors started last year, so it could be that it was downloaded as a binary and thus perhaps evaded any compilation issues on my 10.11 machines.  I see the following in /sw/fink/10.9-libcxx/stable/main/binary-darwin-x86_64/sci:
> 
thanks for the clarification, having installed the binary .debs might indeed an explanation.
I was puzzled though to still see calls to gcc-fsf-9 in your last log, so it’s still not clear to
me if your build really used clang to compile, and if this might help with the problem.

But I was also reminded of another change in the package, which is that building
smallscale (which is only part of the benchmark suite, not the library itself) was only
enabled after 0.3.6-1! I assume there is no /sw/share/doc/openblas/bin/smallscaling
in your current installation?

If you’re not tired of experimenting yet you could try the attached update to 0.3.8, which
should automatically switch to clang for 10.11 and earlier, and let me know if that helps.
If not, there is hopefully still no need to restrict the package, as I could just disable the
build of smallscaling. Just need to check if the rest of the test+benchmark suite will run
without it, but the library itself definitely does not depend on it.

Cheers,
					Derek

_______________________________________________
Fink-beginners mailing list
[email protected]
List archive:
https://sourceforge.net/p/fink/mailman/fink-users/
Subscription management:
https://lists.sourceforge.net/lists/listinfo/fink-beginners
openblas.info (application/octet-stream, 4.9 KB) - not displayed
openblas.patch (application/octet-stream, 9 KB)
diff -uNr a/Makefile.system b/Makefile.system
--- a/Makefile.system	2020-02-09 23:16:28.000000000 +0100
+++ b/Makefile.system	2020-02-20 18:06:14.000000000 +0100
@@ -486,8 +486,10 @@
 endif
 
 ifeq ($(C_COMPILER), CLANG)
+ifneq ($(OSNAME), Darwin)
 CCOMMON_OPT    += -fopenmp
 endif
+endif
 
 ifeq ($(C_COMPILER), INTEL)
 CCOMMON_OPT    += -fopenmp
@@ -1201,8 +1203,8 @@
 endif


-REVISION = -r$(VERSION)
 MAJOR_VERSION = $(word 1,$(subst ., ,$(VERSION)))
+REVISION = .$(MAJOR_VERSION)

 ifeq ($(DEBUG), 1)
 COMMON_OPT += -g
@@ -1272,11 +1274,11 @@

 ifneq ($(DYNAMIC_ARCH), 1)
 ifndef SMP
-LIBNAME		= $(LIBPREFIX)_$(LIBCORE)$(REVISION).$(LIBSUFFIX)
-LIBNAME_P	= $(LIBPREFIX)_$(LIBCORE)$(REVISION)_p.$(LIBSUFFIX)
+LIBNAME		= $(LIBPREFIX)$(REVISION).$(LIBSUFFIX)
+LIBNAME_P	= $(LIBPREFIX)_p$(REVISION).$(LIBSUFFIX)
 else
-LIBNAME		= $(LIBPREFIX)_$(LIBCORE)p$(REVISION).$(LIBSUFFIX)
-LIBNAME_P	= $(LIBPREFIX)_$(LIBCORE)p$(REVISION)_p.$(LIBSUFFIX)
+LIBNAME		= $(LIBPREFIX)$(REVISION).$(LIBSUFFIX)
+LIBNAME_P	= $(LIBPREFIX)_p$(REVISION).$(LIBSUFFIX)
 endif
 else
 ifndef SMP
diff -uNr a/benchmark/Makefile b/benchmark/Makefile
--- a/benchmark/Makefile   2020-02-09 23:16:28.000000000 +0100
+++ b/benchmark/Makefile   2020-02-20 19:15:33.000000000 +0100
@@ -19,8 +19,12 @@
 #LIBATLAS = -fopenmp $(ATLAS)/liblapack_atlas.a  $(ATLAS)/libptcblas.a  $(ATLAS)/libptf77blas.a  $(ATLAS)/libatlas.a -lgfortran -lm
 
 # Atlas RHEL and Fedora
-ATLAS=/usr/lib64/atlas
-LIBATLAS = -fopenmp $(ATLAS)/liblapack.a  $(ATLAS)/libptcblas.a  $(ATLAS)/libptf77blas.a  $(ATLAS)/libatlas.a -lgfortran -lm
+#ATLAS=/usr/lib64/atlas
+#LIBATLAS = -fopenmp $(ATLAS)/liblapack.a  $(ATLAS)/libptcblas.a  $(ATLAS)/libptf77blas.a  $(ATLAS)/libatlas.a -lgfortran -lm
+
+# Atlas MacOS X Fink (Xcode clang does not support -fopenmp)
+ATLAS=@PREFIX@/lib
+LIBATLAS = $(FOPENMP) $(ATLAS)/liblapack.a  $(ATLAS)/libptcblas.a  $(ATLAS)/libptf77blas.a  $(ATLAS)/libatlas.a -lgfortran -lm
 
 # Intel standard
 # MKL=/opt/intel/mkl/lib/intel64
@@ -2338,7 +2342,7 @@
 
 
 smallscaling: smallscaling.c ../$(LIBNAME)
-	$(CC) $(CFLAGS) -o $(@F) $^ $(EXTRALIB) -fopenmp -lm -lpthread
+	$(CC) $(CFLAGS) -o $(@F) $^ $(EXTRALIB) $(FOPENMP) -lm -lpthread
 
 clean ::
 	@rm -f *.goto *.mkl *.acml *.atlas *.veclib *.essl smallscaling
diff -uNr a/Makefile b/Makefile
--- a/Makefile		2019-08-11 23:23:27.000000000 +0100
+++ b/Makefile		2019-11-06 19:18:15.000000000 +0100
@@ -109,8 +109,10 @@
 ifeq ($(OSNAME), Darwin)
	@$(MAKE) -C exports dyn
	@ln -fs $(LIBDYNNAME) $(LIBPREFIX).dylib
+ifneq ($(LIBDYNNAME), $(LIBPREFIX).$(MAJOR_VERSION).dylib)
	@ln -fs $(LIBDYNNAME) $(LIBPREFIX).$(MAJOR_VERSION).dylib
 endif
+endif
 ifeq ($(OSNAME), WINNT)
	@$(MAKE) -C exports dll
 endif
diff -uNr a/Makefile.install b/Makefile.install
--- a/Makefile.install	2019-08-11 23:23:27.000000000 +0100
+++ b/Makefile.install	2019-11-06 2019-11-06 20:13:02.000000000 +0100
@@ -84,8 +84,7 @@
	@-cp $(LIBDYNNAME) "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)"
	@-install_name_tool -id "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME)" "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)/$(LIBDYNNAME)"
	@cd "$(DESTDIR)$(OPENBLAS_LIBRARY_DIR)" ; \
-	ln -fs $(LIBDYNNAME) $(LIBPREFIX).dylib ; \
-	ln -fs $(LIBDYNNAME) $(LIBPREFIX).$(MAJOR_VERSION).dylib
+	ln -fs $(LIBDYNNAME) $(LIBPREFIX).dylib
 endif
 ifeq ($(OSNAME), WINNT)
	@-cp $(LIBDLLNAME) "$(DESTDIR)$(OPENBLAS_BINARY_DIR)"
diff --git a/.travis.yml b/.travis.yml
index 9e18412e8..0f20aef5c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -176,7 +176,7 @@ matrix:
     - <<: *test-macos
       osx_image: xcode10.1
       env:
-        - CC="/Applications/Xcode-10.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Applications/Xcode-10.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk"
+        - CC="/Applications/Xcode-10.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
         - CFLAGS="-O2 -Wno-macro-redefined -isysroot /Applications/Xcode-10.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -arch arm64 -miphoneos-version-min=10.0"
         - BTYPE="TARGET=ARMV8 BINARY=64 HOSTCC=clang NOFORTRAN=1"
 
diff --git a/Makefile.prebuild b/Makefile.prebuild
index a366004a1..b00f13368 100644
--- a/Makefile.prebuild
+++ b/Makefile.prebuild
@@ -42,7 +42,7 @@ all: getarch_2nd
 	./getarch_2nd  1 >> $(TARGET_CONF)
 
 config.h : c_check f_check getarch
-	perl ./c_check $(TARGET_MAKE) $(TARGET_CONF) $(CC) $(TARGET_FLAGS)
+	perl ./c_check $(TARGET_MAKE) $(TARGET_CONF) $(CC) $(TARGET_FLAGS) $(CFLAGS)
 ifneq ($(ONLY_CBLAS), 1)
 	perl ./f_check $(TARGET_MAKE) $(TARGET_CONF) $(FC) $(TARGET_FLAGS)
 else
@@ -59,13 +59,13 @@ endif
 
 
 getarch : getarch.c cpuid.S dummy $(CPUIDEMU)
-	$(HOSTCC) $(CFLAGS) $(EXFLAGS) -o $(@F) getarch.c cpuid.S $(CPUIDEMU)
+	$(HOSTCC) $(HOST_CFLAGS) $(EXFLAGS) -o $(@F) getarch.c cpuid.S $(CPUIDEMU)
 
 getarch_2nd : getarch_2nd.c config.h dummy
 ifndef TARGET_CORE
-	$(HOSTCC) -I. $(CFLAGS) -o $(@F) getarch_2nd.c
+	$(HOSTCC) -I. $(HOST_CFLAGS) -o $(@F) getarch_2nd.c
 else
-	$(HOSTCC) -I. $(CFLAGS) -DBUILD_KERNEL -o $(@F) getarch_2nd.c
+	$(HOSTCC) -I. $(HOST_CFLAGS) -DBUILD_KERNEL -o $(@F) getarch_2nd.c
 endif
 
 dummy:
diff --git a/Makefile.system b/Makefile.system
index c0e45515f..cf9e9bafa 100644
--- a/Makefile.system
+++ b/Makefile.system
@@ -214,7 +214,7 @@ ifndef GOTOBLAS_MAKEFILE
 export GOTOBLAS_MAKEFILE = 1
 
 # Generating Makefile.conf and config.h
-DUMMY := $(shell $(MAKE) -C $(TOPDIR) -f Makefile.prebuild CC="$(CC)" FC="$(FC)" HOSTCC="$(HOSTCC)" CFLAGS="$(GETARCH_FLAGS)" BINARY=$(BINARY) USE_OPENMP=$(USE_OPENMP) TARGET_CORE=$(TARGET_CORE) ONLY_CBLAS=$(ONLY_CBLAS) TARGET=$(TARGET) all)
+DUMMY := $(shell $(MAKE) -C $(TOPDIR) -f Makefile.prebuild CC="$(CC)" FC="$(FC)" HOSTCC="$(HOSTCC)" HOST_CFLAGS="$(GETARCH_FLAGS)" CFLAGS="$(CFLAGS)" BINARY=$(BINARY) USE_OPENMP=$(USE_OPENMP) TARGET_CORE=$(TARGET_CORE) ONLY_CBLAS=$(ONLY_CBLAS) TARGET=$(TARGET) all)
 
 ifndef TARGET_CORE
 include $(TOPDIR)/Makefile.conf
diff --git a/c_check b/c_check
index 555b2eccf..c7899c84f 100644
--- a/c_check
+++ b/c_check
@@ -18,11 +18,12 @@ $binary = $ENV{"BINARY"};
 $makefile = shift(@ARGV);
 $config   = shift(@ARGV);
 
-$compiler_name = join(" ", @ARGV);
+$compiler_name = shift(@ARGV);
+$flags = join(" ", @ARGV);
 
 # First, we need to know the target OS and compiler name
 
-$data = `$compiler_name -E ctest.c`;
+$data = `$compiler_name $flags -E ctest.c`;
 
 if ($?) {
     printf STDERR "C Compiler ($compiler_name) is something wrong.\n";
@@ -175,7 +176,7 @@ if ($defined == 0) {
 
 # Do again
 
-$data = `$compiler_name -E ctest.c`;
+$data = `$compiler_name $flags -E ctest.c`;
 
 if ($?) {
     printf STDERR "C Compiler ($compiler_name) is something wrong.\n";
@@ -195,7 +196,7 @@ if (($architecture eq "mips") || ($architecture eq "mips64")) {
 	print $tmpf "void main(void){ __asm__ volatile($code); }\n";
 
 	$args = "$msa_flags -o $tmpf.o $tmpf";
-	my @cmd = ("$compiler_name $args");
+	my @cmd = ("$compiler_name $flags $args >/dev/null 2>/dev/null");
 	system(@cmd) == 0;
 	if ($? != 0) {
 	    $have_msa = 0;
@@ -236,7 +237,7 @@ if (($architecture eq "x86") || ($architecture eq "x86_64")) {
 	if ($compiler eq "PGI") {
 	    $args = " -tp skylake -c -o $tmpf.o $tmpf";
 	}
-	my @cmd = ("$compiler_name $args >/dev/null 2>/dev/null");
+	my @cmd = ("$compiler_name $flags $args >/dev/null 2>/dev/null");
 	system(@cmd) == 0;
 	if ($? != 0) {
 	    $no_avx512 = 1;
@@ -247,7 +248,7 @@ if (($architecture eq "x86") || ($architecture eq "x86_64")) {
     }
 }
 
-$data = `$compiler_name -S ctest1.c && grep globl ctest1.s | head -n 1 && rm -f ctest1.s`;
+$data = `$compiler_name $flags -S ctest1.c && grep globl ctest1.s | head -n 1 && rm -f ctest1.s`;
 
 $data =~ /globl\s([_\.]*)(.*)/;
 
@@ -263,19 +264,6 @@ if ($architecture ne $hostarch) {
 
 $cross = 1 if ($os ne $hostos);
 
-# rework cross suffix and architecture if we are on OSX cross-compiling for ARMV8-based IOS
-# the initial autodetection will have been confused by the command-line arguments to clang
-# and the cross-compiler apparently still claims to build for x86_64 in its CC -E output
-if (($os eq "Darwin") && ($cross_suffix ne "")) {
-  my $tmpnam = `xcrun --sdk iphoneos --find clang`;
-  $cross_suffix = substr($tmpnam, 0, rindex($tmpnam, "/")+1 ); 
-# this should produce something like $cross_suffix="/Applications/Xcode-10.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/";
-  $cross =1;
-  $architecture = arm64;
-}
-
-
-
 $openmp = "" if $ENV{USE_OPENMP} != 1;
 
 $linker_L = "";
@@ -283,7 +271,7 @@ $linker_l = "";
 $linker_a = "";
 
 {
-    $link = `$compiler_name -c ctest2.c -o ctest2.o 2>&1 && $compiler_name $openmp -v ctest2.o -o ctest2 2>&1 && rm -f ctest2.o ctest2 ctest2.exe`;
+    $link = `$compiler_name $flags -c ctest2.c -o ctest2.o 2>&1 && $compiler_name $flags $openmp -v ctest2.o -o ctest2 2>&1 && rm -f ctest2.o ctest2 ctest2.exe`;
 
     $link =~ s/\-Y\sP\,/\-Y/g;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.