plentico / osxcross-target

Provides darwin (Mac) binary support on Linux when cross-compiling Go apps that have CGO dependencies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot build without libcrypto (OpenSSL)

jimafisk opened this issue · comments

I was getting some broken builds recently (https://github.com/plentico/plenti/runs/2171421181) so I decided to try and rebuild the OSXCross target, but I'm getting errors...

./tools/gen_sdk_package_pbzx.sh Xcode_11.6.xip:

configure: error: Cannot build without libcrypto (OpenSSL)

./build.sh:

configure: error: Cannot build without libcrypto (OpenSSL)

exiting with abnormal exit code (1)
run 'OCDEBUG=1 ./build.sh' to enable debug messages

Found https://askubuntu.com/questions/1108506/building-xar-source-error-no-libcrypto

This prompted me to edit build/xar/xar/configure.ac and change:

AC_CHECK_LIB([crypto], [EVP_add_cipher], , [have_libcrypto="0"])

To:

AC_CHECK_LIB([crypto], [OPENSSL_init_crypto], , [have_libcrypto="0"])

Then ran ./build/xar/xar/autogen.sh but that returned:

autoconf
autoconf: error: no input file
Error 0 in autoconf

Also rerunning ./tools/gen_sdk_package_pbzx.sh Xcode_12.5_beta_3.xip returns build/xar/xar/configure.ac to its original values since this is a built asset.

This comment also leads me to believe using [CRYPTO_free] instead of [OPENSSL_init_crypto] from this PR would work better.

Not quite sure how to build osxcross with change to xar dependency. Tried changing line 373 of build/xar/xar/src/xar.1 from:

https://github.com/mackyle/xar

To a modified version:

https://github.com/jimafisk/xar

However running the build script ./tools/gen_sdk_package_pbzx.sh Xcode_12.5_beta_3.xip resets these values as well.

Tried editing tools/tools.sh line 476: get_sources https://github.com/tpoechtrager/xar.git master => get_sources https://github.com/jimafisk/xar.git master but no luck...

It looks like there is some git submodule action going on here:

  1. cd build/xar/
  2. git remote -v:
origin	https://github.com/tpoechtrager/xar.git (fetch)
origin	https://github.com/tpoechtrager/xar.git (push)
  1. git remote remove origin
  2. git remote add origin https://github.com/jimafisk/xar.git
  3. cd ../..
  4. ./tools/gen_sdk_package_pbzx.sh Xcode_12.5_beta_3.xip

This does pull my modified repo finally, but unfortunately still get:

configure: error: Cannot build without libcrypto (OpenSSL)

Also tried with AC_CHECK_LIB([crypto], [OPENSSL_init_crypto], , [have_libcrypto="0"]) from mackyle/xar#18 (comment), but returned the same error.

Weird that even when trying to use [CRYPTO_free] instead of [EVP_add_cipher] the error still says:

checking for EVP_add_cipher in -lcrypto... no
configure: error: Cannot build without libcrypto (OpenSSL)

Made sure I had dependencies listed in project readme: sudo apt-get install gcc g++ zlib1g-dev libmpc-dev libmpfr-dev libgmp-dev:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
g++ is already the newest version (4:9.3.0-1ubuntu2).
gcc is already the newest version (4:9.3.0-1ubuntu2).
zlib1g-dev is already the newest version (1:1.2.11.dfsg-2ubuntu1.2).
The following packages were automatically installed and are no longer required:
  libilmbase12 libllvm10:i386 libopenexr22 libraw16 libsystemd0:i386 xsane-common
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libgmpxx4ldbl
Suggested packages:
  gmp-doc libgmp10-doc libmpfr-doc
The following NEW packages will be installed:
  libgmp-dev libgmpxx4ldbl libmpc-dev libmpfr-dev
0 upgraded, 4 newly installed, 0 to remove and 23 not upgraded.
Need to get 620 kB of archives.
After this operation, 3,286 kB of additional disk space will be used.
Do you want to continue? [Y/n] y

Then tried: sudo apt install libssl-dev

The following packages have unmet dependencies:
 libssl-dev : Depends: libssl1.1 (= 1.1.1f-1ubuntu2.3) but 1.1.1g-1+ubuntu18.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.

And sudo apt install libssl1.1 gives:

libssl1.1 is already the newest version (1.1.1g-1+ubuntu18.04.1+deb.sury.org+1).
The following packages were automatically installed and are no longer required:
  libilmbase12 libllvm10:i386 libopenexr22 libraw16 libsystemd0:i386 xsane-common
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 23 not upgraded.

People with similar issues just downgrade libssl version: https://askubuntu.com/questions/1261614/ubuntu-20-04-libssl-so-1-0-0-cannot-open-shared-object-file-no-such-file-or-d

Could not get this working with libssl1.1 so reverted to outdated libssl1.0 per this:

  • sudo nvim /etc/apt/sources.list
    • Added deb http://security.ubuntu.com/ubuntu xenial-security main
  • sudo apt update
  • sudo apt install libssl1.0.0
Output
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libssl1.0.0 is already the newest version (1.0.2n-1ubuntu5.4).
The following packages were automatically installed and are no longer required:
  libilmbase12 libllvm10:i386 libopenexr22 libraw16 libsystemd0:i386 xsane-common
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 17 not upgraded.

Then

  • bash
  • cd /home/runner/work/osxcross
  • ./tools/gen_sdk_package_pbzx.sh Xcode_12.5_beta_3.xip

Still errors with configure: error: Cannot build without libcrypto (OpenSSL)

Running openssl version -a produces:

OpenSSL 1.1.1g
OpenSSL 1.1.1g  21 Apr 2020
built on: Tue Apr 21 14:30:52 2020 UTC
platform: debian-amd64
options:  bn(64,64) rc4(16x,int) des(int) blowfish(ptr) 
compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -Wa,--noexecstack -g -O2 -fdebug-prefix-map=/build/openssl-InlZB1/openssl-1.1.1g=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAESNI_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DNDEBUG -Wdate-time -D_FORTIFY_SOURCE=2
OPENSSLDIR: "/usr/lib/ssl"
ENGINESDIR: "/usr/lib/x86_64-linux-gnu/engines-1.1"
Seeding source: os-specific

From rvm/rvm#4764 (comment):

  • sudo vim /etc/apt/sources.list
    • add: deb http://security.ubuntu.com/ubuntu bionic-security main
  • sudo apt update && apt-cache policy libssl1.0-dev
  • sudo apt-get install libssl1.0-dev

Then even though running openssl version -a still returned OpenSSL 1.1.1g, running the shell script ./tools/gen_sdk_package_pbzx.sh Xcode_12.5_beta_3.xip WORKED!

That created MacOSX11.3.sdk.tar.xz which I moved to the correct directory: mv MacOSX11.3.sdk.tar.xz tarballs/.

Then ran the build: ./build.sh