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

openssl fails to build in non-standard prefix #28877

Closed
5 of 6 tasks
yurikoles opened this issue Jun 11, 2018 · 7 comments
Closed
5 of 6 tasks

openssl fails to build in non-standard prefix #28877

yurikoles opened this issue Jun 11, 2018 · 7 comments
Labels
outdated PR was locked due to age stale No recent activity

Comments

@yurikoles
Copy link
Contributor

To help us debug your issue please explain:

  • What you were trying to do (and why)
    Install openssl in non-standard prefix.
  • What happened (include command output)
    Build fails on linking stage.
  • What you expected to happen
    Successfull install.
  • Step-by-step reproduction instructions (by running brew install commands)
git clone https://github.com/Homebrew/brew.git --single-branch --depth=1
export PATH="${PWD}/brew/bin":"${PATH}"
brew install openssl
install output
Updating Homebrew...
==> Homebrew has enabled anonymous aggregate user behaviour analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics

==> Tapping homebrew/core
Cloning into '/yurikoles/brew/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 4780, done.
remote: Compressing objects: 100% (4561/4561), done.
remote: Total 4780 (delta 51), reused 1086 (delta 31), pack-reused 0
Receiving objects: 100% (4780/4780), 3.88 MiB | 1.23 MiB/s, done.
Resolving deltas: 100% (51/51), done.
Tapped 4568 formulae (4,821 files, 12.2MB)
==> Installing dependencies for openssl: makedepend
==> Installing openssl dependency: makedepend
==> Downloading https://homebrew.bintray.com/bottles/makedepend-1.0.5.high_sierra.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring makedepend-1.0.5.high_sierra.bottle.1.tar.gz
/yurikoles/brew/Cellar/makedepend/1.0.5: 8 files, 74.5KB
==> Installing openssl
==> Downloading https://www.openssl.org/source/openssl-1.0.2o.tar.gz
Already downloaded: /Users/yurikoles/Library/Caches/Homebrew/openssl-1.0.2o.tar.gz
==> perl ./Configure --prefix=/yurikoles/brew/Cellar/openssl/1.0.2o_1 --openssldir=/yurikoles/brew/etc/openssl no-comp no-ssl2 no-ssl3 no-zlib shared enable-cms darwin64-x86_64-cc enable-ec_nistp_64_gcc_128
==> make depend
==> make
Last 15 lines from /Users/yurikoles/Library/Logs/Homebrew/openssl/03.make:
      _ssl3_get_server_certificate in libssl.a(s3_clnt.o)
      _ssl3_choose_cipher in libssl.a(s3_lib.o)
      _ssl23_connect in libssl.a(s23_clnt.o)
      _ssl_add_clienthello_tlsext in libssl.a(t1_lib.o)
      _tls1_check_chain in libssl.a(t1_lib.o)
      ...
  "_sk_zero", referenced from:
      _ssl_bytes_to_cipher_list in libssl.a(ssl_lib.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[4]: *** [link_a.darwin] Error 1
make[3]: *** [do_darwin-shared] Error 2
make[2]: *** [libssl.1.0.0.dylib] Error 2
make[1]: *** [shared] Error 2
make: *** [build_ssl] Error 1

READ THIS: https://docs.brew.sh/Troubleshooting

These open issues may also help:
openssl not installing cert.pem in macOS 10.14 https://github.com/Homebrew/homebrew-core/issues/28806
@jonathansimmons
Copy link

Just linking these more officially, #28806

@yurikoles
Copy link
Contributor Author

I have 10.13

@mistydemeo
Copy link
Contributor

Looking at the specific command that failed, here's the shell output:

if [ -n "libcrypto.1.0.0.dylib libssl.1.0.0.dylib" ]; then \
		(cd ..; /Applications/Xcode.app/Contents/Developer/usr/bin/make libssl.1.0.0.dylib); \
	fi
[ -z "" ] || clang -fPIC -fno-common -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch x86_64 -O3 -DL_ENDIAN -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -Iinclude \
		-DFINGERPRINT_PREMAIN_DSO_LOAD -o fips_premain_dso  \
		fips_premain.c fipscanister.o \
		libcrypto.a 
Undefined symbols for architecture x86_64:
  "_ASN1_INTEGER_get", referenced from:
      _d2i_SSL_SESSION in libssl.a(ssl_asn1.o)
# etc

And here's what was run via superenv:

clang called with: -fPIC -fno-common -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch x86_64 -O3 -DL_ENDIAN -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -arch x86_64 -dynamiclib -current_version 1.0.0 -compatibility_version 1.0.0 -install_name /yurikoles/brew/Cellar/openssl/1.0.2o_1/lib/libssl.1.0.0.dylib -o libssl.1.0.0.dylib -all_load libssl.a -L. -lcrypto
superenv removed:  -arch x86_64 -O3 -Wall -arch x86_64
superenv added:    -pipe -w -Os -march=native -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2 -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/apache2 -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries -Wl,-headerpad_max_install_names
superenv executed: clang -pipe -w -Os -march=native -fPIC -fno-common -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -dynamiclib -current_version 1.0.0 -compatibility_version 1.0.0 -install_name /yurikoles/brew/Cellar/openssl/1.0.2o_1/lib/libssl.1.0.0.dylib -o libssl.1.0.0.dylib -all_load libssl.a -L. -lcrypto -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/libxml2 -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/apache2 -isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries -Wl,-headerpad_max_install_names

The missing symbols in question should come from libcrypto, and it does look like libcrypto.a was specified on the CLI.

@mistydemeo
Copy link
Contributor

I can't repro this specific failure; it finished installing for me. https://gist.github.com/mistydemeo/acc0edd63fce029369944db7c70e2c1a

But I got a different failure, where dynamic linkage was not fixed and the libs are linked to paths in the build directory.

$ otool -L Cellar/openssl/1.0.2o_2/lib/libssl.1.0.0.dylib
Cellar/openssl/1.0.2o_2/lib/libssl.1.0.0.dylib:
	/private/tmp/testbrew/opt/openssl/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	@loader_path//private/tmp/testbrew/Cellar/openssl/1.0.2o_2/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)

@woodruffw
Copy link
Member

woodruffw commented Jun 30, 2018

@mistydemeo That dynamic linkage failure looks like it was caused by using the temp dir as the installation prefix, which confuses the relocator (since it looks for files that begin with the /tmp or /private/tmp prefix to fix relocation for).

I've "fixed" it in Homebrew/brew#4397 by explicitly disallowing temp dirs as prefixes.

@stale
Copy link

stale bot commented Jul 21, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale No recent activity label Jul 21, 2018
@yurikoles
Copy link
Contributor Author

Seems to be fixed for me.

@lock lock bot added the outdated PR was locked due to age label Aug 20, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Aug 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age stale No recent activity
Projects
None yet
Development

No branches or pull requests

4 participants