Use pkg-config info for osx user and libffi

#346 Merged at 0e33d5f
  1. item4 item4

I think no one install libffi in old path. I installed libffi by brew and encountered libffi issue.

I just re-use source code in at same dir.

  • Issues #2166: Infinite loop in readinto (2.6.1) resolved

Comments (8)

  1. Armin Rigo

    Can the change to _library_dirs_for_libffi() be made a no-op if running pkg-config fails? Right now it returns '/usr/lib', but with your change it would return '/usr/lib/libffi'. (In fact, same issue with _include_dirs_for_libffi.)

  2. item4 item4 author

    hmm. I'm not english well. so I tell you why I do so with some code and result.

    [item4@item4-mbp ~]$ brew info libffi
    libffi: stable 3.0.13 (bottled), HEAD
    Portable Foreign Function Interface library
    This formula is keg-only.
    Some formulae require a newer version of libffi.
    /usr/local/Cellar/libffi/3.0.13 (14 files, 412K) *
      Poured from bottle
    ==> Caveats
    This formula is keg-only, which means it was not symlinked into /usr/local.
    Some formulae require a newer version of libffi.
    Generally there are no consequences of this for you. If you build your
    own software and it requires this formula, you'll need to add to your
    build variables:
        LDFLAGS:  -L/usr/local/opt/libffi/lib

    libffi must be installed in /usr/local/Cellar/libffi/3.0.13.

    your old code cannot find it and it trigger pdb. See this issue (include korean. you just need to read traceback)

    so I used pkg-config command.

    [item4@item4-mbp ~]$ pkg-config --cflags-only-I libffi
    [item4@item4-mbp ~]$ pkg-config --libs-only-L libffi

    Besides, this code is just reusing your code. See this lines

    May I just change '/usr/include/libffi' to '/usr/include/' and '/usr/lib/libffi/' to '/usr/lib/', right?

  3. Armin Rigo

    I am suggesting that you change ['/usr/include/libffi'] to ['/usr/include/ffi'] like it is now, and that you change ['/usr/lib/libffi'] to ['/usr/lib'] like it is now. It should not change anything if you have a system like brew which includes pkg-config, but it avoids breaking translation for other OS/X people that don't use brew.

  4. item4 item4 author

    I have no file in /usr/include/.

    [item4@item4-mbp ~]$ ls /usr/include/
    ls: /usr/include/: No such file or directory
    [item4@item4-mbp ~]$ brew link libffi
    Warning: Already linked: /usr/local/Cellar/libffi/3.0.13
    To relink: brew unlink libffi && brew link libffi

    I think brew do not make /usr/include/*.

  5. Armin Rigo

    Yes, but you have a working pkg-config, which means these paths will be ignored for you. I'm concerned about other people that do not use brew, for whom translating on OS/X works right now. I would like this to continue working for them.