Author Topic: problem running bedops and bed map  (Read 6768 times)

Grant Hartzog

  • Newbie
  • *
  • Posts: 5
problem running bedops and bed map
« on: November 04, 2013, 11:17:55 PM »
Hi I am running into an odd problem running bedmap and bedops on my Mac.  When I run this

$bedmap --echo --mean --bp-ovr 11 --prec 0 --delim "\t" --skip-unmapped - plusStrand_motif1_fimoP4.bed > mapped.bed

I get output that makes sense.

However, when I run

$bedmap --version

or

$bedmap --help

I see this:

dyld: lazy symbol binding failed: Symbol not found: ___emutls_get_address
  Referenced from: /Library/Application Support/BEDOPS/libstdc++.6.dylib
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: ___emutls_get_address
  Referenced from: /Library/Application Support/BEDOPS/libstdc++.6.dylib
  Expected in: /usr/lib/libSystem.B.dylib

Trace/BPT trap: 5

I get similar output when I try to use the help and version flags in bedops, but I seem to be able to merge a file just fine.

I believe I am running bedops 2.3, but as you see, I have been unable to confirm this.

AlexReynolds

  • Administrator
  • Jr. Member
  • *****
  • Posts: 72
Re: problem running bedops and bed map
« Reply #1 on: November 05, 2013, 02:40:54 AM »
Sorry to hear you're having problems. Can you please post the results of running the following command:

$ otool -L `which bedmap`

Also, can you please post which version of OS X you are using (10.5, .6., .7, .8, .9)?

Grant Hartzog

  • Newbie
  • *
  • Posts: 5
Re: problem running bedops and bed map
« Reply #2 on: November 05, 2013, 09:05:05 AM »
Thanks for the reply.

I am running OS 10.8.5 on a Macbook pro

$ otool -L `which bedmap`
/usr/local/bin/bedmap:
   /Library/Application Support/BEDOPS/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.18.0)
   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
   /Library/Application Support/BEDOPS/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

And curiously,

sort-bed --help looks good

$ sort-bed --help
sort-bed
  citation: http://bioinformatics.oxfordjournals.org/content/28/14/1919.abstract
  version:  2.3.0
  authors:  Scott Kuehn

USAGE: sort-bed [--help] [--version] [--max-mem <val>] <file1.bed> <file2.bed> <...>
        Sort BED file(s).
        May use '-' to indicate stdin.
        Results are sent to stdout.

        <val> for --max-mem may be 8G, 8000M, or 8000000000 to specify 8 GB of memory, for example.
« Last Edit: November 05, 2013, 01:27:49 PM by Grant Hartzog »

AlexReynolds

  • Administrator
  • Jr. Member
  • *****
  • Posts: 72
Re: problem running bedops and bed map
« Reply #3 on: November 05, 2013, 03:49:12 PM »
This has been a problem that's difficult to replicate, but it seems to be related to how I build our OS X binaries.

In BEDOPS v2.3, I made some progress in changing how we compile binaries, so that sort-bed, starch, starchcat, unstarch and wig2bed (C binaries) are now compiled with Apple's LLVM/clang compiler, instead of gcc 4.7.3 built via MacPorts.

This change makes these binaries rely on Apple's shared C library, built into the operating system. The other C++-based binaries (bedops/bedmap and related) are still compiled with gcc 4.73 and rely on 32- and 64-bit C and C++ libraries built as part of the MacPorts-based chain. We bundle those "universal" libraries into the BEDOPS OS X installer; binaries which need those libraries should then be able to get to them.

The (Apple) clang-built binaries seem to be "sharable" (have not shown "missing library" errors, so far) as compared with those built with the MacPort-gcc-based C/C++ libraries I bundle with our OS X installer.

In short, until I finish patching bedops/bedmap and other binaries to be compiled with clang, as a workaround, would you be willing to install Xcode, MacPorts and gcc locally? If so, you could try doing a local build of BEDOPS tools:

http://bedops.readthedocs.org/en/latest/content/installation.html#installation-via-source-code

I am embarrassed that I do not yet have a better/easier answer, but it has not been easy to replicate this problem found on some (but not all) other setups. Building with local tools will probably have a better outcome for you, until I complete the patching process.

Grant Hartzog

  • Newbie
  • *
  • Posts: 5
Re: problem running bedops and bed map
« Reply #4 on: November 06, 2013, 08:34:10 AM »
Not a problem.  The gcc 4.7 build is going slow, but I will let you know how it turns out.  Thanks for the help!

Grant Hartzog

  • Newbie
  • *
  • Posts: 5
Re: problem running bedops and bed map
« Reply #5 on: November 06, 2013, 10:21:44 AM »
Okay, I got part way through

$ sudo port select --list gcc
dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/sudo) is setuid or setgid
Available versions for gcc:
   llvm-gcc42
   mp-gcc47
   mp-llvm-gcc42
   none (active)

Should the next command be

$ sudo port select --set gcc mp-gcc47

In addition, do I need to uninstall my prior installation of bedops v2.3, or is it critical that I install in a particular location so that the prior installation is overwritten?

« Last Edit: November 06, 2013, 01:29:09 PM by Grant Hartzog »

AlexReynolds

  • Administrator
  • Jr. Member
  • *****
  • Posts: 72
Re: problem running bedops and bed map
« Reply #6 on: November 06, 2013, 01:49:28 PM »
Yes, I believe so. It will depend on what your copy of MacPorts installs and how ports are currently named, but I believe that is correct, since it is the only GCC 4.7 installation listed. I think "mp" is short for MacPorts.

The MacPorts-based 4.7 version needs to be picked, since the Apple Xcode version of GCC is 4.2.1 and will not have the C++11 extensions needed to compile BEDOPS.

This document appears to describe a similar approach:

http://www.ficksworkshop.com/blog/14-coding/65-installing-gcc-on-mac

Once you compile BEDOPS and run "make install", the binaries are put in a folder called "bin", located within your BEDOPS folder.

You would either copy the contents of this new bin folder to /usr/local/bin, or delete the precompiled BEDOPS v2.3 binaries installed in /usr/local/bin and then copy the contents of this new bin folder to another folder in your environment's PATH.

I recommend the first option. The first option would probably be easiest, but the second option may be cleaner, depending on how you have chosen to personalize your command-line environment.

In either case, I suggest having only one copy of the binaries, wherever they are put. If you copy the new binaries to /usr/local/bin, you will overwrite the precompiled binaries that currently do not work.

I do not have a BEDOPS uninstaller on hand for the OS X installer package, but I will add this as a to-do with the 2.4 release.

Grant Hartzog

  • Newbie
  • *
  • Posts: 5
Re: problem running bedops and bed map
« Reply #7 on: November 06, 2013, 03:53:42 PM »
Success!  Thanks for the help.

AlexReynolds

  • Administrator
  • Jr. Member
  • *****
  • Posts: 72
Re: problem running bedops and bed map
« Reply #8 on: November 07, 2013, 03:57:18 PM »
No problem, let us know if you run into any further difficulties.