python-mcrypt install on Mac OSX

Discussion in 'Python' started by =?UTF-8?Q?Ahmad_=E3=8B=A1_Baitalmal?=, Sep 20, 2007.

  1. Hi,
    I'm having a hard time getting python-mcrypt extension to build.
    I installed libmcrypt with --prefix=/usr and I checked that the
    library exists

    -rwxr-xr-x 1 root wheel 352K Sep 19 16:53 /usr/lib/libmcrypt.
    4.4.8.dylib*
    lrwxr-xr-x 1 root wheel 21B Sep 19 16:53 /usr/lib/libmcrypt.
    4.dylib@ -> libmcrypt.4.4.8.dylib
    lrwxr-xr-x 1 root wheel 21B Sep 19 16:53 /usr/lib/
    libmcrypt.dylib@ -> libmcrypt.4.4.8.dylib
    -rwxr-xr-x 1 root wheel 801B Sep 19 16:53 /usr/lib/libmcrypt.la*

    But this is the output from setting up python-mcrypt

    # python setup.py build
    running build
    running build_ext
    building 'mcrypt' extension
    creating build
    creating build/temp.macosx-10.3-fat-2.5
    gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -
    fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -
    fno-common -dynamic -DNDEBUG -g -O3 -DVERSION="1.1" -I/usr/include -I/
    Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c
    mcrypt.c -o build/temp.macosx-10.3-fat-2.5/mcrypt.o
    creating build/lib.macosx-10.3-fat-2.5
    gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g
    -bundle -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.5/
    mcrypt.o -lmcrypt -o build/lib.macosx-10.3-fat-2.5/mcrypt.so
    /usr/bin/ld: for architecture ppc
    /usr/bin/ld: can't locate file for: -lmcrypt
    collect2: ld returned 1 exit status
    /usr/bin/ld: for architecture i386
    /usr/bin/ld: can't locate file for: -lmcrypt
    collect2: ld returned 1 exit status
    lipo: can't open input file: /var/tmp//ccGRKjU2.out (No such file or
    directory)
    error: command 'gcc' failed with exit status 1


    What am I missing here? I linked PHP with the same libmcrypt library
    just fine. This is only happening for this extension only.

    Would appreciate any help, thx

    Ahmad Baitalmal
     
    =?UTF-8?Q?Ahmad_=E3=8B=A1_Baitalmal?=, Sep 20, 2007
    #1
    1. Advertising

  2. Ahmad ã‹¡ Baitalmal schrieb:
    > Hi,
    > I'm having a hard time getting python-mcrypt extension to build.
    > I installed libmcrypt with --prefix=/usr and I checked that the library
    > exists
    >
    > -rwxr-xr-x 1 root wheel 352K Sep 19 16:53
    > /usr/lib/libmcrypt.4.4.8.dylib*
    > lrwxr-xr-x 1 root wheel 21B Sep 19 16:53
    > /usr/lib/libmcrypt.4.dylib@ -> libmcrypt.4.4.8.dylib
    > lrwxr-xr-x 1 root wheel 21B Sep 19 16:53
    > /usr/lib/libmcrypt.dylib@ -> libmcrypt.4.4.8.dylib
    > -rwxr-xr-x 1 root wheel 801B Sep 19 16:53 /usr/lib/libmcrypt.la*
    >
    > But this is the output from setting up python-mcrypt
    >
    > # python setup.py build
    > running build
    > running build_ext
    > building 'mcrypt' extension
    > creating build
    > creating build/temp.macosx-10.3-fat-2.5
    > gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
    > -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd
    > -fno-common -dynamic -DNDEBUG -g -O3 -DVERSION="1.1" -I/usr/include
    > -I/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c
    > mcrypt.c -o build/temp.macosx-10.3-fat-2.5/mcrypt.o
    > creating build/lib.macosx-10.3-fat-2.5
    > gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g
    > -bundle -undefined dynamic_lookup
    > build/temp.macosx-10.3-fat-2.5/mcrypt.o -lmcrypt -o
    > build/lib.macosx-10.3-fat-2.5/mcrypt.so
    > /usr/bin/ld: for architecture ppc
    > /usr/bin/ld: can't locate file for: -lmcrypt
    > collect2: ld returned 1 exit status
    > /usr/bin/ld: for architecture i386
    > /usr/bin/ld: can't locate file for: -lmcrypt
    > collect2: ld returned 1 exit status
    > lipo: can't open input file: /var/tmp//ccGRKjU2.out (No such file or
    > directory)
    > error: command 'gcc' failed with exit status 1
    >
    >
    > What am I missing here? I linked PHP with the same libmcrypt library
    > just fine. This is only happening for this extension only.


    Try setting the DYLD_LIBRARY_PATH might help. Or altering the setup.py
    to add -L/usr/lib.

    Diez
     
    Diez B. Roggisch, Sep 20, 2007
    #2
    1. Advertising

  3. On Sep 19, 2007, at 11:04 PM, Diez B. Roggisch wrote:

    > Ahmad ã‹¡ Baitalmal schrieb:
    >> Hi,
    >> I'm having a hard time getting python-mcrypt extension to build.
    >> I installed libmcrypt with --prefix=/usr and I checked that the
    >> library
    >> exists
    >>
    >> -rwxr-xr-x 1 root wheel 352K Sep 19 16:53
    >> /usr/lib/libmcrypt.4.4.8.dylib*
    >> lrwxr-xr-x 1 root wheel 21B Sep 19 16:53
    >> /usr/lib/libmcrypt.4.dylib@ -> libmcrypt.4.4.8.dylib
    >> lrwxr-xr-x 1 root wheel 21B Sep 19 16:53
    >> /usr/lib/libmcrypt.dylib@ -> libmcrypt.4.4.8.dylib
    >> -rwxr-xr-x 1 root wheel 801B Sep 19 16:53 /usr/lib/
    >> libmcrypt.la*
    >>
    >> But this is the output from setting up python-mcrypt
    >>
    >> # python setup.py build
    >> running build
    >> running build_ext
    >> building 'mcrypt' extension
    >> creating build
    >> creating build/temp.macosx-10.3-fat-2.5
    >> gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
    >> -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd
    >> -fno-common -dynamic -DNDEBUG -g -O3 -DVERSION="1.1" -I/usr/include
    >> -I/Library/Frameworks/Python.framework/Versions/2.5/include/
    >> python2.5 -c
    >> mcrypt.c -o build/temp.macosx-10.3-fat-2.5/mcrypt.o
    >> creating build/lib.macosx-10.3-fat-2.5
    >> gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g
    >> -bundle -undefined dynamic_lookup
    >> build/temp.macosx-10.3-fat-2.5/mcrypt.o -lmcrypt -o
    >> build/lib.macosx-10.3-fat-2.5/mcrypt.so
    >> /usr/bin/ld: for architecture ppc
    >> /usr/bin/ld: can't locate file for: -lmcrypt
    >> collect2: ld returned 1 exit status
    >> /usr/bin/ld: for architecture i386
    >> /usr/bin/ld: can't locate file for: -lmcrypt
    >> collect2: ld returned 1 exit status
    >> lipo: can't open input file: /var/tmp//ccGRKjU2.out (No such file or
    >> directory)
    >> error: command 'gcc' failed with exit status 1
    >>
    >>
    >> What am I missing here? I linked PHP with the same libmcrypt library
    >> just fine. This is only happening for this extension only.

    >
    > Try setting the DYLD_LIBRARY_PATH might help. Or altering the setup.py
    > to add -L/usr/lib.
    >
    > Diez
    > --
    > http://mail.python.org/mailman/listinfo/python-list


    Nope, that didn't do it.
    The first clue I got that something is wrong was that mcrypt.h could
    not be found. Even though it exists in /usr/include. So I added the
    include_dirs and library_dirs to setup.py


    mcrypt=Extension(
    "mcrypt",
    sources=["mcrypt.c"],
    include_dirs=['/usr/include'],
    libraries=["mcrypt"],
    library_dirs=["/usr/lib"],
    define_macros=[("VERSION", '"%s"'%VERSION)]
    )

    setup(name="python-mcrypt",
    version = VERSION,
    description = "Python interface to mcrypt library",
    author = "Gustavo Niemeyer",
    author_email = "",
    license = "LGPL",
    long_description = \
    """
    Python interface to mcrypt library.
    """,
    ext_modules = [mcrypt],
    )


    I'm still getting the same output:
    unning build
    running build_ext
    building 'mcrypt' extension
    gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g
    -bundle -undefined dynamic_lookup build/temp.macosx-10.3-fat-2.5/
    mcrypt.o -L/usr/lib -lmcrypt -o build/lib.macosx-10.3-fat-2.5/mcrypt.so
    /usr/bin/ld: for architecture ppc
    /usr/bin/ld: can't locate file for: -lmcrypt
    collect2: ld returned 1 exit status
    /usr/bin/ld: for architecture i386
    /usr/bin/ld: can't locate file for: -lmcrypt
    collect2: ld returned 1 exit status
    lipo: can't open input file: /var/tmp//ccqN4eHR.out (No such file or
    directory)
    error: command 'gcc' failed with exit status 1


    It makes no sense, so I went to another brand new mac, installed
    XCode and Python 2.5 and libmcrypt-2.5.8. I got the same results. So
    I'm at a loss, how can ld not see libmcrypt.

    I'm digging into disutils.sysconfig to see what is the build
    environment that disutils is using.
    Does anyone know how to build an extension manually? without using
    distutils. If I can get it to build outside of distutils I might be
    able to figure out what need to be done.

    Thx
     
    =?UTF-8?Q?Ahmad_=E3=8B=A1_Baitalmal?=, Sep 20, 2007
    #3
  4. On Sep 19, 2007, at 11:04 PM, Diez B. Roggisch wrote:

    > Ahmad ã‹¡ Baitalmal schrieb:
    >> Hi,
    >> I'm having a hard time getting python-mcrypt extension to build.
    >> I installed libmcrypt with --prefix=/usr and I checked that the
    >> library
    >> exists
    >>
    >> -rwxr-xr-x 1 root wheel 352K Sep 19 16:53
    >> /usr/lib/libmcrypt.4.4.8.dylib*
    >> lrwxr-xr-x 1 root wheel 21B Sep 19 16:53
    >> /usr/lib/libmcrypt.4.dylib@ -> libmcrypt.4.4.8.dylib
    >> lrwxr-xr-x 1 root wheel 21B Sep 19 16:53
    >> /usr/lib/libmcrypt.dylib@ -> libmcrypt.4.4.8.dylib
    >> -rwxr-xr-x 1 root wheel 801B Sep 19 16:53 /usr/lib/
    >> libmcrypt.la*
    >>
    >> But this is the output from setting up python-mcrypt
    >>
    >> # python setup.py build
    >> running build
    >> running build_ext
    >> building 'mcrypt' extension
    >> creating build
    >> creating build/temp.macosx-10.3-fat-2.5
    >> gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
    >> -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd
    >> -fno-common -dynamic -DNDEBUG -g -O3 -DVERSION="1.1" -I/usr/include
    >> -I/Library/Frameworks/Python.framework/Versions/2.5/include/
    >> python2.5 -c
    >> mcrypt.c -o build/temp.macosx-10.3-fat-2.5/mcrypt.o
    >> creating build/lib.macosx-10.3-fat-2.5
    >> gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -g
    >> -bundle -undefined dynamic_lookup
    >> build/temp.macosx-10.3-fat-2.5/mcrypt.o -lmcrypt -o
    >> build/lib.macosx-10.3-fat-2.5/mcrypt.so
    >> /usr/bin/ld: for architecture ppc
    >> /usr/bin/ld: can't locate file for: -lmcrypt
    >> collect2: ld returned 1 exit status
    >> /usr/bin/ld: for architecture i386
    >> /usr/bin/ld: can't locate file for: -lmcrypt
    >> collect2: ld returned 1 exit status
    >> lipo: can't open input file: /var/tmp//ccGRKjU2.out (No such file or
    >> directory)
    >> error: command 'gcc' failed with exit status 1
    >>
    >>
    >> What am I missing here? I linked PHP with the same libmcrypt library
    >> just fine. This is only happening for this extension only.

    >
    > Try setting the DYLD_LIBRARY_PATH might help. Or altering the setup.py
    > to add -L/usr/lib.
    >
    > Diez
    > --
    > http://mail.python.org/mailman/listinfo/python-list


    Ok, I got it to work, but it still makes no sense. I had to install
    libmcrypt with --prefix=/usr/local.
    If I do it with --prefix=/usr then for some reason ld won't find it
    when building python-mcrypt.

    Obviously I had to also change the include_dirs and library_dirs in
    the setup.py file.


    I thought I'd share that so hopefully someone can explain what that's
    all about.

    Thx
     
    =?UTF-8?Q?Ahmad_=E3=8B=A1_Baitalmal?=, Sep 20, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charlie Kim

    How to use python-mcrypt?

    Charlie Kim, Oct 28, 2003, in forum: Python
    Replies:
    0
    Views:
    422
    Charlie Kim
    Oct 28, 2003
  2. Gustavo Niemeyer

    ANN: python-mcrypt 1.1

    Gustavo Niemeyer, Jul 16, 2004, in forum: Python
    Replies:
    0
    Views:
    440
    Gustavo Niemeyer
    Jul 16, 2004
  3. Omita
    Replies:
    2
    Views:
    341
    Piet van Oostrum
    Apr 30, 2009
  4. Steve555
    Replies:
    3
    Views:
    2,038
    Steve555
    Feb 24, 2010
  5. lsolesen

    Install python-mcrypt on Ubuntu

    lsolesen, Sep 14, 2010, in forum: Python
    Replies:
    2
    Views:
    974
    Benjamin Kaplan
    Sep 14, 2010
Loading...

Share This Page