Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix grovel for MacPorts #18

Closed
wants to merge 1 commit into from
Closed

Conversation

yitzchak
Copy link
Contributor

Grovel apparently doesn't know about /opt/local/include for MacPorts. Even in CFFI's own libffi cc-flags are explicitly specified. See yitzchak/common-lisp-jupyter#32

I also added an explicit darwin case for define-foreign-library to prevent MacOS from falling into the unix case.

@yitzchak
Copy link
Contributor Author

@orivej Any chance on this one? Would help me on yitzchak/common-lisp-jupyter#32

@orivej
Copy link
Owner

orivej commented Jul 15, 2019

I think that these changes do not belong in pzmq. cffi is supposed to compile with -I/opt/local/include and to add .dylib to the library name:
https://github.com/cffi/cffi/blob/v0.20.0/toolchain/c-toolchain.lisp#L212
https://github.com/cffi/cffi/blob/v0.20.0/src/libraries.lisp#L345
It is worth investigating why cffi does not work as intended on the target system.

@orivej
Copy link
Owner

orivej commented Jul 15, 2019

You have mentioned (:darwin (:or "libzmq.dylib" "/opt/local/lib/libzmq.dylib")) in yitzchak/common-lisp-jupyter#32 . @jrjsmrtn has added /opt/local/lib/ to cffi search path in cffi/cffi#139 . This was released in cffi 0.20.1.

@yitzchak
Copy link
Contributor Author

Awesome. Thanks!

@yitzchak yitzchak closed this Jul 15, 2019
@jrjsmrtn
Copy link

As I mentioned in yitzchak/common-lisp-jupyter#32 (comment), I added /opt/local/lib in CFFI, not /opt/local/include.

IMHO, this issue should not be closed. I am still investigating grovel.

@orivej orivej reopened this Jul 18, 2019
@orivej
Copy link
Owner

orivej commented Jul 18, 2019

/opt/local/include was already there: https://github.com/cffi/cffi/blob/v0.20.0/toolchain/c-toolchain.lisp#L212
I can keep this PR open until this issue is fixed somewhere, but so far it looks like it should be fixed in cffi.

@yitzchak
Copy link
Contributor Author

@orivej That commit is two years old and is already available in quicklisp. It doesn't appear to me that it is ever actually evaluated since right before it are implementation specific definitions for SBCL, etc. I think that it is actually fallback code for an unknown CL implementation.

This goes right back to my original point, even CFFI's own libffi interface defines its own Darwin specific includes:

https://github.com/cffi/cffi/blob/ffbeaf78de8e9659ef159101b125253a04243581/libffi/libffi-types.lisp#L35

orivej added a commit to orivej/cffi that referenced this pull request Jul 18, 2019
Users should be able to pass custom compilation flags such as include
directories via CFLAGS env var.

It would be convenient for MacPorts users if software installed in /opt/local
worked by default.

Fixes orivej/pzmq#18
orivej added a commit to orivej/cffi that referenced this pull request Jul 18, 2019
Users should be able to pass custom compilation flags such as include
directories via CFLAGS env var.

It would be convenient for MacPorts users if libraries installed in /opt/local
worked by default.

Fixes orivej/pzmq#18
orivej added a commit to orivej/cffi that referenced this pull request Jul 18, 2019
Users should be able to pass custom compilation flags such as include
directories via CFLAGS env var.

It would be convenient for MacPorts users if libraries installed in /opt/local
worked by default. (/opt/local/lib is supported since cffi#139.)

Fixes orivej/pzmq#18
@orivej
Copy link
Owner

orivej commented Jul 18, 2019

You are right, default-toolchain-parameters are only used with unknown lisps: https://github.com/cffi/cffi/blob/v0.20.0/toolchain/c-toolchain.lisp#L231

-I/opt/local/include/ used to be set for all lisps until cffi/cffi#112 . Looking at that code, you can work around this issue by editing CFLAGS in sbcl.mk in your (uiop/filesystem:lisp-implementation-directory).

even CFFI's own libffi interface defines its own Darwin specific includes

Does every Lisp cffi library need to know all possible include directories on all operating systems? No, cffi should provide reasonable defaults, and let users customize them: cffi/cffi#146

@jrjsmrtn
Copy link

jrjsmrtn commented Jul 18, 2019 via email

@orivej
Copy link
Owner

orivej commented Jul 18, 2019

I have already opened cffi/cffi#146

@jrjsmrtn
Copy link

jrjsmrtn commented Jul 18, 2019 via email

orivej added a commit to orivej/cffi that referenced this pull request Jul 18, 2019
Users should be able to pass custom compilation flags such as include
directories via CFLAGS env var.

It would be convenient for MacPorts users if libraries installed in /opt/local
worked by default. (/opt/local/lib is supported since cffi#139.)

Fixes orivej/pzmq#18
orivej added a commit to orivej/cffi that referenced this pull request Jul 19, 2019
Users should be able to pass custom compilation flags such as include
directories via CFLAGS env var.

It would be convenient for MacPorts users if libraries installed in /opt/local
worked by default. (/opt/local/lib is supported since cffi#139.)

Fixes orivej/pzmq#18
orivej added a commit to orivej/cffi that referenced this pull request Jul 19, 2019
Users should be able to pass custom compilation flags such as include
directories via CFLAGS env var.

It would be convenient for MacPorts users if libraries installed in /opt/local
worked by default. (/opt/local/lib is supported since cffi#139.)

/usr/local/include/ was added for OpenBSD because cffi finds it useful in
cc07246

Fixes orivej/pzmq#18
@yitzchak yitzchak closed this Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants