Dependency Hell on Mac OS X: library not found

Discussion in 'Mac Programming' started by AppleMacFinder, Jan 17, 2012.

  1. macrumors 6502a

    AppleMacFinder

    Joined:
    Dec 7, 2009
    #1
    I am trying to build a program from the source, under Mac OS X Lion 10.7.2.

    When I run ./configure script, eventually it tells me:
    Code:
    ...
    checking for SDL - version >= 1.2.0... yes
    checking for LIBCDIO... configure: error: *** libcdio not found!
    But libcdio was already installed - to the default path
    Code:
    /usr/local/lib
    I have tried to link it manually, here are my failed attempts:
    Code:
    _____________1_____________
    LD_LIBRARY_PATH="/usr/local/lib" ./configure
    DYLD_LIBRARY_PATH="/usr/local/lib" ./configure
    _____________2_____________
    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
    ./configure
    _____________3_____________
    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/pkgconfig"
    ./configure
    _____________4_____________
    export DYLD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
    ./configure
    _____________5_____________
    export DYLD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/pkgconfig
    ./configure
    _____________6_____________
    export PKG_CONFIG="/opt/local/lib/pkgconfig"
    ./configure
    _____________7_____________
    export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig"
    ./configure
    _____________8_____________
    sudo env PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure
    
    _____________9_____________
    SHLIB_PATH=/usr/local/lib
    SHLIB_PATH=$SHLIB_PATH:/usr/local/lib/pkgconfig
    LD_LIBRARY_PATH=$SHLIB_PATH
    DYLD_LIBRARY_PATH=$SHLIB_PATH
    Please, tell me, how to solve this problem?
     
  2. macrumors 68030

    Joined:
    Oct 19, 2011
    Location:
    Switzerland
    #2
    did you install it manually? Was it compiled with the same compiler that is being used to build the program?
     
  3. macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #3
    Calm down. There's no need to scream.

    Run:
    Code:
    ./configure --help
    
    There might be a switch to add to configure where to look for libcio.

    Sometimes you do something like this:
    Code:
    ./configure --withcdio=/usr/local
    
    Notice that I've dropped lib from the path.

    In order to compile, you'll need more than just the .a or .dylib file in /usr/local/lib, you'll also need the .h files in /usr/local/include. This kind of switch says look for the headers files in /usr/local/include and the lib files in /usr/local/lib.

    Please do note that there way or may not be a --withcdio switch, or it might be named something else. So don't just copy this and complain if it doesn't work. You'll have to investigate the output of --help.
     
  4. thread starter macrumors 6502a

    AppleMacFinder

    Joined:
    Dec 7, 2009
    #4
    Execution result for "./configure --help" :
    Code:
    `configure' configures this package to adapt to many kinds of systems.
    
    Usage: ./configure [OPTION]... [VAR=VALUE]...
    
    To assign environment variables (e.g., CC, CFLAGS...), specify them as
    VAR=VALUE.  See below for descriptions of some of the useful variables.
    
    Defaults for the options are specified in brackets.
    
    Configuration:
      -h, --help              display this help and exit
          --help=short        display options specific to this package
          --help=recursive    display the short help of all the included packages
      -V, --version           display version information and exit
      -q, --quiet, --silent   do not print `checking...' messages
          --cache-file=FILE   cache test results in FILE [disabled]
      -C, --config-cache      alias for `--cache-file=config.cache'
      -n, --no-create         do not create output files
          --srcdir=DIR        find the sources in DIR [configure dir or `..']
    
    Installation directories:
      --prefix=PREFIX         install architecture-independent files in PREFIX
                              [/usr/local]
      --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                              [PREFIX]
    
    By default, `make install' will install all the files in
    `/usr/local/bin', `/usr/local/lib' etc.  You can specify
    an installation prefix other than `/usr/local' using `--prefix',
    for instance `--prefix=$HOME'.
    
    For better control, use the options below.
    
    Fine tuning of the installation directories:
      --bindir=DIR            user executables [EPREFIX/bin]
      --sbindir=DIR           system admin executables [EPREFIX/sbin]
      --libexecdir=DIR        program executables [EPREFIX/libexec]
      --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
      --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
      --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
      --libdir=DIR            object code libraries [EPREFIX/lib]
      --includedir=DIR        C header files [PREFIX/include]
      --oldincludedir=DIR     C header files for non-gcc [/usr/include]
      --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
      --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
      --infodir=DIR           info documentation [DATAROOTDIR/info]
      --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
      --mandir=DIR            man documentation [DATAROOTDIR/man]
      --docdir=DIR            documentation root [DATAROOTDIR/doc/PACKAGE]
      --htmldir=DIR           html documentation [DOCDIR]
      --dvidir=DIR            dvi documentation [DOCDIR]
      --pdfdir=DIR            pdf documentation [DOCDIR]
      --psdir=DIR             ps documentation [DOCDIR]
    
    Program names:
      --program-prefix=PREFIX            prepend PREFIX to installed program names
      --program-suffix=SUFFIX            append SUFFIX to installed program names
      --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
    
    X features:
      --x-includes=DIR    X include files are in DIR
      --x-libraries=DIR   X library files are in DIR
    
    System types:
      --build=BUILD     configure for building on BUILD [guessed]
      --host=HOST       cross-compile to build programs to run on HOST [BUILD]
      --target=TARGET   configure for building compilers for TARGET [HOST]
    
    Optional Features:
      --disable-option-checking  ignore unrecognized --enable/--with options
      --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
      --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
      --disable-dependency-tracking  speeds up one-time build
      --enable-dependency-tracking   do not reject slow dependency extractors
      --enable-silent-rules          less verbose build output (undo: `make V=1')
      --disable-silent-rules         verbose build output (undo: `make V=0')
      --enable-shared[=PKGS]  build shared libraries [default=yes]
      --enable-static[=PKGS]  build static libraries [default=yes]
      --enable-fast-install[=PKGS]
                              optimize for fast installation [default=yes]
      --disable-libtool-lock  avoid locking (might break parallel builds)
      --disable-largefile     omit support for large files
      --disable-rpath         do not hardcode runtime library paths
      --disable-nls           do not use Native Language Support
      --enable-threads={posix|solaris|pth|win32}
                              specify multithreading API
      --disable-threads       build without multithread safety
      --enable-debugger       build with internal debugger [[default=yes]]
      --enable-cjk-fonts      build with internal CJK(Chinese, Japanese, Korean)
                              fonts [[default=yes]]
      --enable-altivec        use AltiVec extensions on PowerPC/POWER ISA
                              processors [[default=yes]]
      --enable-gb             build with GameBoy emulation [[default=yes]]
      --enable-gba            build with GameBoy Advance emulation [[default=yes]]
      --enable-lynx           build with Atari Lynx emulation [[default=yes]]
      --enable-md             build with Sega Genesis/MegaDrive emulation
                              [[default=yes]]
      --enable-nes            build with Nintendo Entertainment System emulation
                              [[default=yes]]
      --enable-ngp            build with Neo Geo Pocket emulation [[default=yes]]
      --enable-pce            build with PC Engine(TurboGrafx 16) emulation
                              [[default=yes]]
      --enable-pce-fast       build the separate, fast PC Engine(TurboGrafx 16)
                              emulation [[default=yes]]
      --enable-pcfx           build with PC-FX emulation [[default=yes]]
      --enable-psx            build with PlayStation emulation [[default=no]]
      --enable-sms            build with SMS+GG emulation [[default=yes]]
      --enable-snes           build with SNES emulation [[default=yes]]
      --enable-vb             build with Virtual Boy emulation [[default=yes]]
      --enable-wswan          build with WonderSwan emulation [[default=yes]]
      --enable-alsa           support the ALSA audio API [[default=yes]]
      --disable-alsatest      Do not try to compile and run a test Alsa program
      --enable-jack           support the JACK audio API [[default=yes]]
    
    Optional Packages:
      --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
      --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
      --with-pic              try to use only PIC/non-PIC objects [default=use
                              both]
      --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
      --with-x                use the X Window System
      --with-gnu-ld           assume the C compiler uses GNU ld default=no
      --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
      --without-libiconv-prefix     don't search for libiconv in includedir and libdir
      --with-libpth-prefix[=DIR]  search for libpth in DIR/include and DIR/lib
      --without-libpth-prefix     don't search for libpth in includedir and libdir
      --with-included-gettext use the GNU gettext library included here
      --with-libintl-prefix[=DIR]  search for libintl in DIR/include and DIR/lib
      --without-libintl-prefix     don't search for libintl in includedir and libdir
      --with-alsa-prefix=PFX  Prefix where Alsa library is installed(optional)
      --with-alsa-inc-prefix=PFX  Prefix where include libraries are (optional)
      --with-sdl-prefix=PFX   Prefix where SDL is installed (optional)
      --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)
      --with-SDL_net          support network play [default=yes]
      --with-libcdio          support physical CD reading [default=yes]
      --with-libsndfile       support various sound file formats in ripped CD
                              images [default=yes]
    
    Some influential environment variables:
      CC          C compiler command
      CFLAGS      C compiler flags
      LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
                  nonstandard directory <lib dir>
      LIBS        libraries to pass to the linker, e.g. -l<library>
      CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
                  you have headers in a nonstandard directory <include dir>
      CPP         C preprocessor
      CCAS        assembler compiler command (defaults to CC)
      CCASFLAGS   assembler compiler flags (defaults to CFLAGS)
      CXX         C++ compiler command
      CXXFLAGS    C++ compiler flags
      CXXCPP      C++ preprocessor
      PKG_CONFIG  path to pkg-config utility
      XMKMF       Path to xmkmf, Makefile generator for X Window System
      JACK_CFLAGS C compiler flags for JACK, overriding pkg-config
      JACK_LIBS   linker flags for JACK, overriding pkg-config
      LIBCDIO_CFLAGS
                  C compiler flags for LIBCDIO, overriding pkg-config
      LIBCDIO_LIBS
                  linker flags for LIBCDIO, overriding pkg-config
      SNDFILE_CFLAGS
                  C compiler flags for SNDFILE, overriding pkg-config
      SNDFILE_LIBS
                  linker flags for SNDFILE, overriding pkg-config
    
    Use these variables to override the choices made by `configure' or to help
    it to find libraries and programs with nonstandard names/locations.
    
    Report bugs to the package provider.


    ----------

    I tried to link the libraries using the following way:
    Code:
    CPPFLAGS="-I/usr/local -I/usr/local/lib -I/usr/local/lib/pkgconfig"
    LDFLAGS="-L/usr/local -L/usr/local/lib -L/usr/local/lib/pkgconfig"
    sudo ./configure --build=x86_64-apple-darwin`uname -r`
    , but it failed again. :confused:
     
  5. jiminaus, Jan 17, 2012
    Last edited: Jan 17, 2012

    macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #5
    It looks like configure is expecting to be able to use pkg-config to get the compiler flags for libcdio. These compiler flags will include the path of libcdio's header files (via -I) and path of libcdio's link files (via -L). This will be why it's not letting you put a directory path after --with-cdio.

    What's the output of this command?
    Code:
    pkg-config --cflags --libs libcdio
    
    This will be the command (or something similar to it) that configure will be using to test if and where you have libcdio installed.


    BTW You shouldn't be running ./configure with sudo. Sudo elevates the execution of a program to having root/administrative access. You may be complicating yourself now by having some files having been created with root access and some without.

    Before you proceed. I would trash your current source directory and extract a fresh copy from the archive you downloaded.


    Second BTW, do you even want physical input/output access to CDs that bypasses the operating system. libcdio is actually optional. If you don't want/need its functionality, add --without-libcdio to ./configure and be done with libcdio.


    Third BTW. You might be doing this all the hard way. You know about Macports right? If MacPorts has the software you're trying to install, installing it via MacPorts is going to be a whole lot easier. MacPorts will not only installed all the dependent software, but will include all the right configure switches for the software to work on Mac OS X.
     
  6. thread starter macrumors 6502a

    AppleMacFinder

    Joined:
    Dec 7, 2009
    #6
    The output is:
    Code:
    -I/opt/local/include  -R/opt/local/lib -L/opt/local/lib -lcdio -lm -liconv
    Finally, after I have installed pkg-config, it is working!
    Thank you very much for such a valuable clue!
     

Share This Page