arch issue building openssl on Mac OS X 10.11.2 (El Capitan) on MacBook Air with Intel Core i5

445 views
Skip to first unread message

Tom Barron

unread,
Dec 23, 2015, 7:18:30 PM12/23/15
to Spack
Brand new install of spack (0.8.15)

When I do "spack install openssl", I get this:

$ spack install openssl
==> Installing openssl
==> zlib is already installed in /Users/tbarron/prj/spack/opt/spack/darwin-x86_64/gcc-4.2.1/zlib-1.2.
8-srpjm45vhbpgwb7d6tmlvrpp55rsx7ov.
############################################################################################## 100.0%
==> Staging archive: /Users/tbarron/prj/spack/var/spack/stage/openssl-1.0.2e-i3znj7ubpfgndbqc426i6vop
y5ormgkf/openssl-1.0.2e.tar.gz
==> Created stage in /Users/tbarron/prj/spack/var/spack/stage/openssl-1.0.2e-i3znj7ubpfgndbqc426i6vop
y5ormgkf.
==> No patches needed for openssl.
==> Building openssl.
==> Error: Command exited with status 2:
make

See build log for details:
  /private/var/folders/4g/xhhsjk953jd8sqnvqq3fhxsc0000gp/T/tbarron/spack-stage/spack-stage-rNvsCJ/ope
nssl-1.0.2e/spack-build.out

/Users/tbarron/prj/spack/var/spack/packages/openssl/package.py:27, in install:
     19       def install(self, spec, prefix):
     20           config = Executable("./config")
     21           config("--prefix=%s" % prefix,
     22                  "--openssldir=%s/etc/openssl" % prefix,
     23                  "zlib",
     24                  "no-krb5",
     25                  "shared")
     26
  >> 27           make()
     28           make("install")
==> Error: Installation process had nonzero exit code.

At the bottom of /private/var/folders/4g/xhhsjk953jd8sqnvqq3fhxsc0000gp/T/tbarron/spack-stage/spack-stage-rNvsCJ/ope
nssl-1.0.2e/spack-build.out, I see:

[ -z "" ] || /Users/tbarron/prj/spack/lib/spack/env/gcc/gcc -fPIC -fno-common -DOPENSSL_PIC -DZLIB -D
OPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch i386 -O3 -fomit-frame-pointer -DL_ENDIA
N -DOPENSSL_BN_ASM_PART_WORDS -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_
ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DRMD160_ASM -DAES_ASM -DVPAES_ASM -DWHIRLPOOL_ASM -DGHASH_AS
M -Iinclude \
                -DFINGERPRINT_PREMAIN_DSO_LOAD -o fips_premain_dso  \
                fips_premain.c fipscanister.o \
                libcrypto.a -lz
ld: warning: ignoring file /Users/tbarron/prj/spack/opt/spack/darwin-x86_64/gcc-4.2.1/zlib-1.2.8-srpj
m45vhbpgwb7d6tmlvrpp55rsx7ov/lib/libz.dylib, file was built for x86_64 which is not the architecture
being linked (i386): /Users/tbarron/prj/spack/opt/spack/darwin-x86_64/gcc-4.2.1/zlib-1.2.8-srpjm45vhb
pgwb7d6tmlvrpp55rsx7ov/lib/libz.dylib
Undefined symbols for architecture i386:
  "_deflate", referenced from:
      _zlib_stateful_compress_block in libcrypto.a(c_zlib.o)
      _bio_zlib_write in libcrypto.a(c_zlib.o)
      _bio_zlib_ctrl in libcrypto.a(c_zlib.o)
  "_deflateEnd", referenced from:

So spack is trying to build openssl for i386 and is ignoring the zlib library as a consequence since it was built for x86_64. But all the zlib libraries were built for x86_64 architecture. I *think* zlib is right and my machine is x86_64 but I'm not certain. How would one tell definitively? 

$ pwd
/Users/tbarron/prj/spack/opt/spack/darwin-x86_64/gcc-4.2.1/zlib-1.2.8-srpjm45vhbpgwb7d6tmlvrpp55rsx7ov/lib
$ file *
libz.1.2.8.dylib: Mach-O 64-bit dynamically linked shared library x86_64
libz.1.dylib:     Mach-O 64-bit dynamically linked shared library x86_64
libz.a:           current ar archive random library
libz.dylib:       Mach-O 64-bit dynamically linked shared library x86_64
pkgconfig:        directory

It seems like openssl should be getting built for x86_64 also. How can I adjust this?

Thanks!
Tom

Tom Barron

unread,
Dec 24, 2015, 5:35:03 AM12/24/15
to Spack
P.S. It occurred to me to check the other packages I've installed with spack. I was trying to install python and got ncurses, bzip2, and zlib installed successfully. All three of them have their libraries linked for x86_64. So it seems like that's what should be right for my machine.

Tom Barron

unread,
Dec 24, 2015, 6:21:18 AM12/24/15
to Spack
I found a solution!

Through various investigations, I found that setting the environment variable KERNEL_BITS=64 will make openssl build correctly on my version of Mac OS X. So I tried the following hack in spack:

$ git diff
diff --git a/var/spack/packages/openssl/package.py b/var/spack/packages/openssl/package.py
index 40648fc..6f14364 100644
--- a/var/spack/packages/openssl/package.py
+++ b/var/spack/packages/openssl/package.py
@@ -1,3 +1,5 @@
+import sysconfig
+import os
 from spack import *

 class Openssl(Package):
@@ -17,6 +19,9 @@ class Openssl(Package):
     parallel = False

     def install(self, spec, prefix):
+        plat = sysconfig.get_platform()
+        if 'macosx' in plat and 'x86_64' in plat:
+            os.environ['KERNEL_BITS'] = '64'
         config = Executable("./config")
         config("--prefix=%s" % prefix,
                "--openssldir=%s/etc/openssl" % prefix,

This works. But I wonder if there might be a better way to do it? Should I submit this as a pull request?

Thanks,
Tom

On Wednesday, December 23, 2015 at 7:18:30 PM UTC-5, Tom Barron wrote:

Todd Gamblin

unread,
Dec 31, 2015, 6:37:45 PM12/31/15
to Tom Barron, Spack
Hi Tom,

Thanks for the much needed work on OSX, and thanks for joining the list!  Sorry for the slow response due to the holidays.  It's great to have someone from ORNL contributing.

So now with your change I've got two proposals to get OpenSSL building on darwin -- the other is from Eric Schnetter, here:


I am actually not an expert on what the best way to build on Mac OS X is.  Maybe these two could be combined and merged into the mainline?

-Todd

nssl-1.0.2e/spack-build.out,I see:

--
You received this message because you are subscribed to the Google Groups "Spack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spack+un...@googlegroups.com.
To post to this group, send email to sp...@googlegroups.com.
Visit this group at https://groups.google.com/group/spack.
For more options, visit https://groups.google.com/d/optout.

Erik Schnetter

unread,
Jan 4, 2016, 11:06:44 AM1/4/16
to Spack
My changes (PR 270) are also necessary to build with gcc instead of the Darwin system clang.

Tom, can you check whether PR 270 suffices for you, or whether you still need to set kernel_bits?

-erik


On Wednesday, December 23, 2015 at 7:18:30 PM UTC-5, Tom Barron wrote:
Reply all
Reply to author
Forward
0 new messages