When trying to install Crypt::SSLeay on Mac OS X I get the following error:
$ sudo perl -MCPAN -e shell
cpan[1]> install Crypt::SSLeay
Reading '/Users/.cpan/Metadata'
Database was generated on Thu, 26 Oct 2017 01:53:54 GMT
Running install for module 'Crypt::SSLeay'
Running make for N/NA/NANIS/Crypt-SSLeay-0.72.tar.gz
Checksum for /Users/.cpan/sources/authors/id/N/NA/NANIS/Crypt-SSLeay-0.72.tar.gz ok
Scanning cache /Users/.cpan/build for sizes
............................................................................DONE
CPAN.pm: Building N/NA/NANIS/Crypt-SSLeay-0.72.tar.gz
Cannot link with any of the requested SSL libraries 'ssl, crypto, ssl32, ssleay32, eay32, libeay32, z'
No 'Makefile' created'YAML' not installed, will not store persistent state
NANIS/Crypt-SSLeay-0.72.tar.gz
/usr/bin/perl Makefile.PL -- NOT OK
Running make test
Make had some problems, won't test
Running make install
Make had some problems, won't install
Could not read metadata file. Falling back to other methods to determine prerequisites
Failed during this command:
NANIS/Crypt-SSLeay-0.72.tar.gz : writemakefile NO -- No 'Makefile' created
I have installed openssl as per the instructions found here and the output of openssl version -a is:
OpenSSL 1.1.0f 25 May 2017
built on: reproducible build, date unspecified
platform: darwin64-x86_64-cc
compiler: cc -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPADLOCK_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/mac-dev-env/openssl-1.1.0f/ssl\"" -DENGINESDIR="\"/usr/local/mac-dev-env/openssl-1.1.0f/lib/engines-1.1\""
OPENSSLDIR: "/usr/local/mac-dev-env/openssl-1.1.0f/ssl"
ENGINESDIR: "/usr/local/mac-dev-env/openssl-1.1.0f/lib/engines-1.1"
I'm not sure what else I can do, as I have the ssl library required but it doesn't seem to link it?
OPENSSLDIR: "/usr/local/mac-dev-env/openssl-1.1.0f/ssl"
This is not a standard location for openssl. Which explains why it cannot find the necessary files:
Cannot link with any of the requested SSL libraries 'ssl, crypto, ssl32, ssleay32, eay32, libeay32, z'
When looking at the README for Crypt::SSLeay you will find:
If you have OpenSSL headers and libraries in nonstandard locations, you can use
$ perl Makefile.PL --incpath=... --libpath=...
There are further instructions in the README how to set the path when using cpanm etc.
Apart from that, in most cases you don't want to install Crypt::SSLeay but instead Net::SSLeay. Crypt::SSLeay is only supported to keep older versions of LWP working, all newer things (including current versions of LWP) use Net::SSLeay and IO::Socket::SSL on top of Net::SSLeay.
If this is related to installing LWP::Protocol::https , because you wanted to use LWP::UserAgent ... you will be bettor off installing: IO::Socket::SSL instead off aforementioned Crypt::SSLeay
As stated above, in README it's mentioned "--incpath" and "--libpath" to use custom paths to your openssl instalation.
So it should be something like this (Note:check your openssl version, in this example it's 1.1.1d):
$ sudo perl Makefile.PL --incpath="/usr/local/Cellar/openssl#1.1/1.1.1d/include" --libpath="/usr/local/Cellar/openssl#1.1/1.1.1d/lib"
I struggled to understand what path should be used on those parameters. Those worked though.
Related
I have a Mac which architecture is:
$ arch
arm64
(it supports x86_64 and aarch64).
And I have installed openssl library with brew tool. Now I try to build my application for x86_64 platform (it's Haskell application and the build script is large and complex, so I cannot show it here) and I get an error:
...
<command line>: dlopen(/MyWork/.stack/snapshots/x86_64-osx/b1d675598b9b6c5f516e03f82c45d01becd6003e6128005b2b4acb8628b0f350/9.2.5/lib/x86_64-osx-ghc-9.2.5/libHSHsOpenSSL-0.11.7.2-1JX1qBi8YfpGDjk1ra3OXq-ghc9.2.5.dylib, 0x0005): symbol not found in flat namespace '_DSA_free'
...
However, it works fine for aarch64 platform. After little research I see that my OpenSSL libraries are:
$ file /opt/homebrew/opt/openssl#3/3.0.7/lib/libssl.3.dylib
/opt/homebrew/opt/openssl#3/3.0.7/lib/libssl.3.dylib: Mach-O 64-bit dynamically linked shared library arm64
which seems that it is a library for arm64 and not x86_64, so maybe this is the reason of the error "symbol not found in flat namespace '_DSA_free'".
How to fix it? I guess I need to install the second openssl - for x86_64, I tried arch -x86_64 brew install openssl but I get:
Warning: openssl#3 3.0.7 is already installed and up-to-date.
To reinstall 3.0.7, run:
brew reinstall openssl#3
which makes sense - it is installed already (but for arm64).
How to fix/workaround this problem, so to be able to build the application for both platform while it depends on external libraries like openssl? Maybe there is a way to install openssl for both platform?
EDIT:
Currently I found 2 solutions:
to install libraries from sources setting prefix=/unique/folder/for/arch and to prefix ./configure ..., make, make install by arch -ARCH (where ARCH is x86_64 or arm64).
Another way is to have 2nd Homebrew, it's described here
I am trying to install biogrinder on my macOS Monterey, which needs some perl modules.
All necessary modules are installed except Math::Random::MT
When trying to install this module using the following command:
sudo cpan install Math::Random::MT
I get the following error
Loading internal null logger. Install Log::Log4perl for logging messages
CPAN: Storable loaded ok (v2.62)
Reading '/Users/imac/.cpan/Metadata'
Database was generated on Mon, 17 Oct 2022 13:29:01 GMT
Running install for module 'Math::Random::MT'
CPAN: Digest::SHA loaded ok (v5.96)
CPAN: Compress::Zlib loaded ok (v2.074)
Checksum for /Users/imac/.cpan/sources/authors/id/F/FA/FANGLY/Math-Random-MT-1.17.tar.gz ok
CPAN: YAML loaded ok (v1.30)
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v2.150010)
CPAN: CPAN::Meta loaded ok (v2.150010)
CPAN: Module::CoreList loaded ok (v5.20180414_26)
Configuring F/FA/FANGLY/Math-Random-MT-1.17.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Math::Random::MT
Writing MYMETA.yml and MYMETA.json
FANGLY/Math-Random-MT-1.17.tar.gz
/Users/imac/opt/anaconda3/bin/perl Makefile.PL -- OK
Running make for F/FA/FANGLY/Math-Random-MT-1.17.tar.gz
cp MT.pm blib/lib/Math/Random/MT.pm
Running Mkbootstrap for MT ()
chmod 644 "MT.bs"
"/Users/imac/opt/anaconda3/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- MT.bs blib/arch/auto/Math/Random/MT/MT.bs 644
"/Users/imac/opt/anaconda3/bin/perl" "/Users/imac/opt/anaconda3/lib/5.26.2/ExtUtils/xsubpp" -typemap '/Users/imac/opt/anaconda3/lib/5.26.2/ExtUtils/typemap' -typemap '/Users/imac/.cpan/build/Math-Random-MT-1.17-48/typemap' MT.xs > MT.xsc
mv MT.xsc MT.c
x86_64-apple-darwin13.4.0-clang -c -fno-common -DPERL_DARWIN -no-cpp-precomp -mmacosx-version-min=10.9 -fno-strict-aliasing -pipe -fstack-protector-strong -DPERL_USE_SAFE_PUTENV -O3 -DVERSION=\"1.17\" -DXS_VERSION=\"1.17\" -fPIC --sysroot=/Applications/Xcode_12.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk "-I/Users/imac/opt/anaconda3/lib/5.26.2/darwin-thread-multi-2level/CORE" MT.c
In file included from MT.xs:2:
/Users/imac/opt/anaconda3/lib/5.26.2/darwin-thread-multi-2level/CORE/perl.h:694:10: fatal error: 'sys/types.h' file not found
#include <sys/types.h>
^~~~~~~~~~~~~
1 error generated.
make: *** [MT.o] Error 1
FANGLY/Math-Random-MT-1.17.tar.gz
/usr/bin/make -- NOT OK
My perl version is:
perl --version
This is perl 5, version 26, subversion 2 (v5.26.2) built for darwin-thread-multi-2level
Copyright 1987-2018, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
What doesn't look Okay, is that I don't have /usr/include folder on my machine, instead the types.h file is located in /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/include/sys/types.h
PS: I already installed Bio:SeqIO module using the exact same command and it worked.
Any idea on how to get over this issue ?
Many thanks
I am compiling OpenSSL libraries on macOS 10.15, but my application deployment target (which uses these OpenSSL libraries) is 10.12.
So, when I link these libraries with my application I get multiple errors like this:
ld: warning: object file (.../libcrypto.a) was built for newer OXS version (10.15) than being linked (10.12)
The question is:
how to compile OpenSSL to be linked with specific deployment target (in my case it is 10.12)?
When compiling OpenSSL I am trying to configure it like this:
$ ./configure darwin64-x86_64-cc --prefix=/Users/username/openssl --openssldir=/Users/username/openssl/ssl -mmacosx-version-min=10.12
but this does not help.
Ok, I did not execute the command:
$ make distclean
at the end of my previous compilation.
So, it should look like this:
$ ./configure darwin64-x86_64-cc --prefix=/Users/username/openssl --openssldir=/Users/username/openssl/ssl -mmacosx-version-min=10.12
$ make depend
$ make install
$ make distclean
Then all temporary files will be deleted and next compilations with modified sittings will work.
I want to install perl Gtk2, and for this I need first to have Glib installed. I tried sudo cpanm Glib, but I get an error when compiling (I also tried downloading the .tar.gz source etc., with the same effect). I also tried with an older version of Glib. I’m on OS X 10.11 (El Capitan). Here’s the error :
error: '_GStaticAssertCompileTimeAssertion_0' declared as an array with a negative size
I don’t know how to fix it… Thanks a lot if anyone can do something for me !
(BTW, brew install glib works fine, but it seems the app that I’m trying to build and run — auto-multiple-choice, for instance — is looking for a Gtk2.pm somewhere. So, the ‘glib’ installed by Homebrew is of no help.)
Benjamin
p.-s. : below is the complete log, if it helps :
cpanm (App::cpanminus) 1.7042 on perl 5.018002 built for darwin-thread-multi-2level
Work directory is /Users/benjamin/.cpanm/work/1474765262.7331
You have make /usr/bin/make
You have LWP 6.05
You have /usr/bin/tar: bsdtar 2.8.3 - libarchive 2.8.3
You have /usr/bin/unzip
Searching Glib () on cpanmetadb ...
--> Working on Glib
Fetching http://www.cpan.org/authors/id/X/XA/XAOC/Glib-1.322.tar.gz
-> OK
Unpacking Glib-1.322.tar.gz
Entering Glib-1.322
Checking configure dependencies from META.json
Checking if you have ExtUtils::MakeMaker 6.58 ... Yes (6.66)
Checking if you have ExtUtils::PkgConfig 1.000 ... Yes (1.15)
Checking if you have ExtUtils::Depends 0.300 ... Yes (0.306)
Configuring Glib-1.322
Running Makefile.PL
Including generated API documentation...
Checking if your kit is complete...
Looks good
Writing Makefile for Glib
Writing MYMETA.yml and MYMETA.json
-> OK
Checking dependencies from MYMETA.json ...
Checking if you have ExtUtils::Depends 0.300 ... Yes (0.306)
Checking if you have ExtUtils::PkgConfig 1.000 ... Yes (1.15)
Checking if you have ExtUtils::MakeMaker 0 ... Yes (6.66)
Building and testing Glib-1.322
cp lib/Glib/CodeGen.pm blib/lib/Glib/CodeGen.pm
cp /Users/benjamin/.cpanm/work/1474765262.7331/Glib-1.322/typemap blib/arch/Glib/Install/typemap
cp lib/Glib/ParseXSDoc.pm blib/lib/Glib/ParseXSDoc.pm
cp doctypes blib/arch/Glib/Install/doctypes
cp devel.pod blib/lib/Glib/devel.pod
cp gperl_marshal.h blib/arch/Glib/Install/gperl_marshal.h
cp lib/Glib/MakeHelper.pm blib/lib/Glib/MakeHelper.pm
cp gperl.h blib/arch/Glib/Install/gperl.h
cp lib/Glib.pm blib/lib/Glib.pm
cp lib/Glib/Object/Subclass.pm blib/lib/Glib/Object/Subclass.pm
cp build/IFiles.pm blib/arch/Glib/Install/Files.pm
cp lib/Glib/GenPod.pm blib/lib/Glib/GenPod.pm
[ XS Glib.xs ]
[ CC Glib.c ]
In file included from Glib.xs:22:
In file included from ./gperl.h:37:
In file included from /usr/local/Cellar/glib/2.48.2/include/glib-2.0/glib-object.h:23:
In file included from /usr/local/Cellar/glib/2.48.2/include/glib-2.0/gobject/gbinding.h:28:
In file included from /usr/local/Cellar/glib/2.48.2/include/glib-2.0/glib.h:30:
In file included from /usr/local/Cellar/glib/2.48.2/include/glib-2.0/glib/galloca.h:32:
/usr/local/Cellar/glib/2.48.2/include/glib-2.0/glib/gtypes.h:422:3: error: '_GStaticAssertCompileTimeAssertion_0' declared as an array with a negative size
G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/Cellar/glib/2.48.2/include/glib-2.0/glib/gmacros.h:232:103: note: expanded from macro 'G_STATIC_ASSERT'
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
^~~~~~~~~~~~~~~
1 error generated.
make: *** [Glib.o] Error 1
-> FAIL Installing Glib failed. See
/Users/benjamin/.cpanm/work/1474765262.7331/build.log for details. Retry with --force to force install it.
This was posted to a GitHub issue.
I tracked down the problem by running:
cpanm --verbose --build-args=NOECHO=' ' Glib
so that I could see the specific compilation command that failed:
cc -c -I. -I/usr/local/Cellar/glib/2.50.0/include/glib-2.0 -I/usr/local/Cellar/glib/2.50.0/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.39/include -D_REENTRANT -arch x86_64 -arch i386 -g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing -fstack-protector -Os -DVERSION=\"1.323\" -DXS_VERSION=\"1.323\" -o Glib.o "-I/System/Library/Perl/5.18/darwin-thread-multi-2level/CORE" Glib.c
Since the problem was something to do with mismatching sizeof's, I figured that the problem was that the architecture that Perl was building with does not the architecture that Homebrew's libglib-2.0 was built against.
The fix is to specify that you only want to build for x86_64 by setting the ARCHFLAGS environment variable:
ARCHFLAGS="-arch x86_64" cpanm --verbose Glib
This is all using the system Perl. If you want the install to work in the long run across system upgrades, you will want to install your own user Perl using either perlbrew or plenv.
I ran into the same issue.
Installing gtk+ as a prerequisite fixed it.
I have a problem concerning libstdc++.so.
I installed a new version of gcc and tried to compile C++ code. The compiling worked, but when I try to execute the binary (m5.opt is its name) I've got the following error:
build/ALPHA_SE/m5.opt: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by build/ALPHA_SE/m5.opt).
Do I need to replace libstdc++.so? And if so, where can I download the version I want? On the GCC-website they say libstdc++ is a part of gcc now.
Details
GCC:
I had gcc 4.1.2 before, but I downloaded gcc 4.2.4. From the untarred gcc-directory I executed ./configure; make; sudo make install`.
When I tried to use gcc or g++ to compile, it's default version was still 4.1.2. To overcome this I replaced some links:
mv /usr/bin/gcc /usr/bin/gcc_bak
ln -s /usr/local/bin/gcc gcc
mv /usr/bin/g++ /usr/bin/g++_bak
ln -s /usr/local/bin/g++ g++
GLIBC(++) -- libstdc++:
/usr/lib64/libstdc++.so.6 -> libstdc++.so.6.0.8
/usr/local/lib/libstdc++.so -> libstdc++.so.6.0.9
/lib/libc.so.6 -> libc-2.5.so -> libc-2.5.so
Linux-version:
uname -a gives:
Linux madmax 2.6.18-128.4.1.el5 #1 SMP Tue Aug 4 12:51:10 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
The problem is that you built your new GCC incorrectly: on Linux you should use
./configure --prefix=/usr
The default installation prefix is /usr/local, which is why make install put gcc and g++ binaries into /usr/local/bin, etc.
What's happening to you now is that you compile and link using the new (symlinked) GCC 4.2.4, but at runtime your program binds to the old /usr/lib64/libstdc++.so.6 (version 6.0.8, instead of required 6.0.9). You can confirm that by running ldd build/ALPHA_SE/m5.opt: you should see that it uses /usr/lib64/libstdc++.so.6.
There are several fixes you could do.
env LD_LIBRARY_PATH=/usr/local/lib64 ldd build/ALPHA_SE/m5.opt
should show you that setting LD_LIBRARY_PATH is sufficient to redirect the binary to correct library, and
LD_LIBRARY_PATH=/usr/local/lib64 build/ALPHA_SE/m5.opt
should just run. You could "bake" this path into m5.opt binary by relinking it with -Wl,-rpath=/usr/local/lib64.
A more permanent solution is to fix the libraries the same way you fixed the binaries:
cd /usr/lib64 && mv libstdc++.so.6 libstdc++.so.6_bak &&
ln -s /usr/local/lib64/libstdc++.so.6 .
An even better solution is to reconfigure the new GCC with --prefix=/usr, and then make all install.
I know this is a very old question, but ...
It's not usually a good idea to replace the system compiler (i.e. the one in /usr) because the entire system will have been built with it and depend on it.
It's usually better to install the new compiler to a separate location and then see the libstdc++ FAQ How do I insure that the dynamically linked library will be found? and Finding Dynamic or Shared Libraries in the manual for how to ensure the correct libstdc++.so is found at runtime.
The other answers here should be fine, but the 'quick and easy' solution if you do happen to have gcc installed to /usr/local/ is to just add the new libs to the LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64
You can also check the to see if you have the right versions of GLIBC installed using
strings /usr/lib/libstdc++.so.6 | grep GLIBC
strings /usr/local/lib64/libstdc++.so.18 | grep GLIBC
I got this last tip from another forum so credits due where credits due!