0

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

ikegami
  • 367,544
  • 15
  • 269
  • 518
Najoua
  • 81
  • 5
  • 1
    Possible duplicate: https://stackoverflow.com/q/73824846/2173773 – Håkon Hægland Oct 18 '22 at 13:08
  • *"sudo cpan install Math::Random::MT"* Are you running this command from inside a conda environment? Then you would not need to use `sudo`, right? Also explain how you set up the environment. And how you installed perl into it. Also, from the output of the command I see it is using the following clang binaray: `x86_64-apple-darwin13.4.0-clang`. How did you install that specific version of clang? – Håkon Hægland Oct 18 '22 at 19:49
  • Okay for ```sudo```, but when I don't use it it gives me a bunch of warning messages with this final error ```ld: library not found for -lSystem clang-12: error: linker command failed with exit code 1 (use -v to see invocation)```. As for clang, I actually didn't install it myself, it is a work machine that cames with "everything" already installed, so I don't really know how they installed it. – Najoua Oct 19 '22 at 08:20
  • I think you should not use sudo, and when you don't you run into this bug: https://github.com/conda/conda/issues/8425. This is because Math::Random::MT is an [XS module](https://perldoc.perl.org/perlxs) and needs a C compiler in order for itself to be compiled and installed properly. You can try work around the bug by using the hack I used [here](https://stackoverflow.com/a/65733276/2173773) for example – Håkon Hægland Oct 20 '22 at 08:08

0 Answers0