Segmentation fault with Homebrew Perl 5.24.1 on macOS Sierra 10.12.5
#1
I get a lot from get_iplayer, so I'm very grateful to those responsible for a nice bit of programming.

I just upgraded to get_iplayer 3.01.2 using homebrew (as usual). I now get Segmentation fault: 11 when I try to run get_iplayer. I uninstalled and then re-installed, according to the instructions at

https://github.com/get-iplayer/get_iplay...osx#manual

but I still get the same problem.

It's probably a coincidence, but I installed SnailSVN using homebrew yesterday, following an unsuccessful experiment with SCplugin for subversion.

I'd be grateful for any help.
#2
get_iplayer is just a script, so it won't segfault itself. You may have broken Perl or one of get_iplayer's dependencies. Post the output from perl -V. Also try to execute ffmpeg and AtomicParsley from the command prompt. If any of those segfaults, then get_iplayer won't work properly. If not, follow our instructions to provide a full report so we can see where the segfault occurs.
#3
Thanks for the speedy reply.

Here's the output from perl -V.


Code:
MacBook-Pro:~ jimwoodcock$ perl -V
Summary of my perl5 (revision 5 version 24 subversion 1) configuration:
 
 Platform:
   osname=darwin, osvers=16.4.0, archname=darwin-thread-multi-2level
   uname='darwin sierra.local 16.4.0 darwin kernel version 16.4.0: thu dec 22 22:53:21 pst 2016; root:xnu-3789.41.3~3release_x86_64 x86_64 '
   config_args='-des -Dprefix=/usr/local/Cellar/perl/5.24.1 -Dprivlib=/usr/local/Cellar/perl/5.24.1/lib/perl5/5.24.1 -Dsitelib=/usr/local/Cellar/perl/5.24.1/lib/perl5/site_perl/5.24.1 -Dotherlibdirs=/usr/local/lib/perl5/site_perl/5.24.1 -Dperlpath=/usr/local/opt/perl/bin/perl -Dstartperl=#!/usr/local/opt/perl/bin/perl -Dman1dir=/usr/local/Cellar/perl/5.24.1/share/man/man1 -Dman3dir=/usr/local/Cellar/perl/5.24.1/share/man/man3 -Duseshrplib -Duselargefiles -Dusethreads'
   hint=recommended, useposix=true, d_sigaction=define
   useithreads=define, usemultiplicity=define
   use64bitint=define, use64bitall=define, uselongdouble=undef
   usemymalloc=n, bincompat5005=undef
 Compiler:
   cc='cc', ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.12 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -DPERL_USE_SAFE_PUTENV',
   optimize='-O3',
   cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.12 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
   ccversion='', gccversion='4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)', gccosandvers=''
   intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3
   d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
   ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
   alignbytes=8, prototype=define
 Linker and Libraries:
   ld='cc', ldflags =' -mmacosx-version-min=10.12 -fstack-protector-strong -L/usr/local/lib'
   libpth=/usr/local/lib /usr/include/libxml2 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib /usr/lib
   libs=-lpthread -ldbm -ldl -lm -lutil -lc
   perllibs=-lpthread -ldl -lm -lutil -lc
   libc=, so=dylib, useshrplib=true, libperl=libperl.dylib
   gnulibc_version=''
 Dynamic Linking:
   dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
   cccdlflags=' ', lddlflags=' -mmacosx-version-min=10.12 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector-strong'


Characteristics of this binary (from libperl):
 Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                       PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV
                       PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
                       PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
                       PERL_PRESERVE_IVUV PERL_USE_SAFE_PUTENV
                       USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS
                       USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
                       USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME
                       USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API
 Built under darwin
 Compiled at Feb 26 2017 18:56:17
 %ENV:
   PERL5LIB="/Users/jimwoodcock/perl5/lib/perl5"
   PERL_LOCAL_LIB_ROOT="/Users/jimwoodcock/perl5"
   PERL_MB_OPT="--install_base "/Users/jimwoodcock/perl5""
   PERL_MM_OPT="INSTALL_BASE=/Users/jimwoodcock/perl5"
 @INC:
   /Users/jimwoodcock/perl5/lib/perl5/5.24.1/darwin-thread-multi-2level
   /Users/jimwoodcock/perl5/lib/perl5/5.24.1
   /Users/jimwoodcock/perl5/lib/perl5/darwin-thread-multi-2level
   /Users/jimwoodcock/perl5/lib/perl5
   /usr/local/Cellar/perl/5.24.1/lib/perl5/site_perl/5.24.1/darwin-thread-multi-2level
   /usr/local/Cellar/perl/5.24.1/lib/perl5/site_perl/5.24.1
   /usr/local/Cellar/perl/5.24.1/lib/perl5/5.24.1/darwin-thread-multi-2level
   /usr/local/Cellar/perl/5.24.1/lib/perl5/5.24.1
   /usr/local/lib/perl5/site_perl/5.24.1/darwin-thread-multi-2level
   /usr/local/lib/perl5/site_perl/5.24.1
   .
MacBook-Pro:~ jimwoodcock$
#4
And the rest?
#5
Atomicparsley and ffmpeg both work (i.e., don't give a segmentation fault) from the command line.
#6
So send a full report as I instructed. I can't see what is happening unless you show it.
#7
1. Get_iplayer returns a segmentation fault.

2. get_iplayer -V returns the segmentation fault, but I know that I just installed get_iplayer 3.01.2.

3. I'm using macOS Sierra 10.12.5.

4. I typed get_iplayer without any parameters.

5. Not downloading a programme.

6. Output: "Segmentation fault: 11".

7. Of course,

get_iplayer --get 123 --verbose > "$HOME/log.txt" 2>&1

returns the same segmentation fault.
#8
Try /usr/bin/env perl -V. get_iplayer uses env to launch the perl defined in your shell environment. If using env is the source of the segfault, that would also be a more fundamental problem.

As the documentation makes clear, only the system Perl is supported, and you're using Homebrew Perl. Run /usr/bin/perl /path/to/get_iplayer to see if it will launch with system Perl. If so, then I suggest you roll everything back. Get rid of the manual installation and re-install get_iplayer via Homebrew, then get rid of Homebrew Perl. If you need a newer Perl for other reasons, look into Perlbrew, which gives you more control over using multiple versions of Perl. If /usr/bin/perl segfaults, then something more fundamental is wrong with your system.
#9
I did as you suggested. Please see the result of /usr/bin/env perl -V listed below.

I also tried running /usr/bin/perl /usr/local/bin/get_iplayer and got the same segfault.  :-(


Code:
MacBook-Pro:~ jimwoodcock$ /usr/bin/env perl -V
Summary of my perl5 (revision 5 version 24 subversion 1) configuration:
 
 Platform:
   osname=darwin, osvers=16.4.0, archname=darwin-thread-multi-2level
   uname='darwin sierra.local 16.4.0 darwin kernel version 16.4.0: thu dec 22 22:53:21 pst 2016; root:xnu-3789.41.3~3release_x86_64 x86_64 '
   config_args='-des -Dprefix=/usr/local/Cellar/perl/5.24.1 -Dprivlib=/usr/local/Cellar/perl/5.24.1/lib/perl5/5.24.1 -Dsitelib=/usr/local/Cellar/perl/5.24.1/lib/perl5/site_perl/5.24.1 -Dotherlibdirs=/usr/local/lib/perl5/site_perl/5.24.1 -Dperlpath=/usr/local/opt/perl/bin/perl -Dstartperl=#!/usr/local/opt/perl/bin/perl -Dman1dir=/usr/local/Cellar/perl/5.24.1/share/man/man1 -Dman3dir=/usr/local/Cellar/perl/5.24.1/share/man/man3 -Duseshrplib -Duselargefiles -Dusethreads'
   hint=recommended, useposix=true, d_sigaction=define
   useithreads=define, usemultiplicity=define
   use64bitint=define, use64bitall=define, uselongdouble=undef
   usemymalloc=n, bincompat5005=undef
 Compiler:
   cc='cc', ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.12 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -DPERL_USE_SAFE_PUTENV',
   optimize='-O3',
   cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.12 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
   ccversion='', gccversion='4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)', gccosandvers=''
   intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3
   d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3
   ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
   alignbytes=8, prototype=define
 Linker and Libraries:
   ld='cc', ldflags =' -mmacosx-version-min=10.12 -fstack-protector-strong -L/usr/local/lib'
   libpth=/usr/local/lib /usr/include/libxml2 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/lib /usr/lib
   libs=-lpthread -ldbm -ldl -lm -lutil -lc
   perllibs=-lpthread -ldl -lm -lutil -lc
   libc=, so=dylib, useshrplib=true, libperl=libperl.dylib
   gnulibc_version=''
 Dynamic Linking:
   dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
   cccdlflags=' ', lddlflags=' -mmacosx-version-min=10.12 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector-strong'


Characteristics of this binary (from libperl):
 Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                       PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV
                       PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
                       PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
                       PERL_PRESERVE_IVUV PERL_USE_SAFE_PUTENV
                       USE_64_BIT_ALL USE_64_BIT_INT USE_ITHREADS
                       USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE
                       USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME
                       USE_PERLIO USE_PERL_ATOF USE_REENTRANT_API
 Built under darwin
 Compiled at Feb 26 2017 18:56:17
 %ENV:
   PERL5LIB="/Users/jimwoodcock/perl5/lib/perl5"
   PERL_LOCAL_LIB_ROOT="/Users/jimwoodcock/perl5"
   PERL_MB_OPT="--install_base "/Users/jimwoodcock/perl5""
   PERL_MM_OPT="INSTALL_BASE=/Users/jimwoodcock/perl5"
 @INC:
   /Users/jimwoodcock/perl5/lib/perl5/5.24.1/darwin-thread-multi-2level
   /Users/jimwoodcock/perl5/lib/perl5/5.24.1
   /Users/jimwoodcock/perl5/lib/perl5/darwin-thread-multi-2level
   /Users/jimwoodcock/perl5/lib/perl5
   /usr/local/Cellar/perl/5.24.1/lib/perl5/site_perl/5.24.1/darwin-thread-multi-2level
   /usr/local/Cellar/perl/5.24.1/lib/perl5/site_perl/5.24.1
   /usr/local/Cellar/perl/5.24.1/lib/perl5/5.24.1/darwin-thread-multi-2level
   /usr/local/Cellar/perl/5.24.1/lib/perl5/5.24.1
   /usr/local/lib/perl5/site_perl/5.24.1/darwin-thread-multi-2level
   /usr/local/lib/perl5/site_perl/5.24.1
   .
MacBook-Pro:~ jimwoodcock$ which get_iplayer
/usr/local/bin/get_iplayer
MacBook-Pro:~ jimwoodcock$ /usr/bin/perl /usr/local/bin/get_iplayer
Segmentation fault: 11
MacBook-Pro:~ jimwoodcock$
#10
This seems relevant. I've been using get_iplayer from the command line to download BBC programmes, but Get iPlayer Automator for downloading ITV programmes. The latter works just fine — no Perl problems.
#11
GiA doesn't use perl for downloading ITV programmes, only for searching. But that begs the question: Why not use GiA for BBC programmes if it's working? GiA is hardwired to invoke system perl in a different environment. You can probably mimic it with env -i bash --noprofile --norc, which will open a shell without your normal configuration applied. Worth doing in case something in your configuration is messing with Perl.

Have you tried running any Perl scripts except get_iplayer? If you can run a test script, but not get_iplayer, then it may be that some native code in a get_iplayer dependency you installed is throwing the segfault, though that is only a guess. I'm not willing to go that deep, but if you know how, you can load them individually to see if one is broken.

You really need to get back to a minimal clean environment to test in, but it's impossible for me to know what you've done to your system, or how you did it, or when. Some generic advice:
  • delete ~/perl5 (or whatever you used for local::lib)
  • delete eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib` in .bash_profile (or wherever you put it)
  • open a fresh shell without local::lib configured
  • brew uninstall perl
  • brew uninstall get_iplayer (if still installed)
  • If you only installed Homebrew for get_iplayer, then uninstall it completely and clean out /usr/local, including your manual install of get_iplayer.
  • run /usr/bin/perl -V to ensure that no paths under ~/perl or /usr/local are in @INC
  • download a fresh copy of get_iplayer into your working directory - don't install in /usr/local
  • try /usr/bin/perl ./get_iplayer -V
  • if that fails, run env -i bash --noprofile --norc to start a new shell, then try /usr/bin/perl ./get_iplayer -V again

If that doesn't bear fruit, then that's where I throw in the towel because I don't see a get_iplayer problem here. I know for a fact it runs with system Perl on clean versions of 10.7+, and it would be a mutual waste of time for me to just start guessing what you broke on your system. I know nothing about SnailSVN, but if something like that somehow broke your system Perl or any of its modules, somebody should get a spanking. Maybe someone willing to invest more time will come along with better advice.
#12
Dinky: As you suspected, it was a Perl problem caused by my installing an SVN client. Thanks for your time and trouble.


Possibly Related Threads...
Thread Author Replies Views Last Post
  Cannot install Homebrew on El Capitan LondonLass 5 405 03-05-2017, 03:14 PM
Last Post: SquarePenguin
  Error with ffmpeg while trying to install get_iplayer via Homebrew Geggsy125 7 555 30-04-2017, 12:13 AM
Last Post: dinky