-
Notifications
You must be signed in to change notification settings - Fork 42
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
Bindings not created in SBCL 1.5 #93
Comments
Does the spec have the function in question? |
Yes:
|
There appears to be no Probably time to check the source and/or output to see what's going on. |
Running c2ffi on rdkafka.h puts this out for rd_kafka_version:
Where should I see a value tag? |
This is the result I get: [
{ "tag": "const", "name": "RD_KAFKA_VERSION", "ns": 0, "location": "test.m:2:9", "type": { "tag": ":long", "bit-size": 64, "bit-alignment": 64 }, "value": 16777471 }
] Note I just made a single header with the following as per the source: #define RD_KAFKA_VERSION 0x010000ff Running |
Note I get the same result using any of |
Err actually I get warnings about unhandled triples for anything |
Following your example with the -M flag, I get the same:
(I also got the triples issue.) So I should see that in my .spec files as well? I just deleted and regenerated them all -- none have the value field. Could it be a change in SBCL 1.5? |
You should; perhaps set |
SBCL 1.5 should have nothing to do with this, unless there's something obscure about the environment or that's changing how |
I modified my code to enable trace-c2ffi:
The output included lines like this:
The generated macro file looks like this:
The .spec files still don't contain the value field. When I run c2ffi from the command line, my macro file contains the same lines, in a different order. So I tried generating the macro files and specs myself with:
All of these spec files include the value tag. In this case, c-include didn't fire off c2ffi, but the symbols from rdkafka are still not found. I appreciate your help. Any other suggestions or should I drop back to CFFI? |
Probably the first thing to do is run the second command on the generated file, and possibly double check that file. It should include your original file and the new macro file; it's possible/probable it's not finding your .h (in which case set an include path). Otherwise you should see any exact errors and output directly as autowrap would which may give further leads if necessary. |
Your response gave me a hint. While the .spec files are the same, except for the value field, whether I generate from autowrap or the command line, the macro files are different. The macro files generated in /var/folders/... are 33 lines long and contain only lines beginning with "const long|char* c2ffi". The macro files generated from the command line are 132 lines long and have a bunch of defines at the top like this:
So it appears that you're right about c2ffi not seeing something important. Which include path should I set? |
Can you pastebin/gist the output .. including stderr.. of autowrap's c2ffi commands? These kinds of things are usually errors in the output near the top. If my C++ was less crap when I wrote |
If that would be of any help, I use these routines to figure out include paths (GCC must be installed and properly configured): (ql:quickload :claw)
(claw::dump-all-gcc-include-paths)
(claw::dump-all-darwin-framework-paths) |
This won't matter since you're not passing them to autowrap; I'm guessing it's not finding your original .h in the second run. Unfortunately there's not been a way to get "default paths" from clang, so c2ffi just makes some basic guesses and you have to specify the rest... including paths to your own headers, I think. |
I didn't see how to get stderr from autowrap, so I ran the same c2ffi invocations from the command line. The first one is here: https://pastebin.com/2nL7x8TW and the second one, building from the generated .m file, is here: https://pastebin.com/M45DUUkA There are a lot of "Skipping invalid Decl" in the second paste, which explains why no symbols are interned. The first one supports your suggestions, with "stdio.h not found". Should I set CPATH to the LLVM installation or GCC? |
Basically you just need to add -i or -I to where your stdio.h and other relevant headers live until it stops complaining about missing headers (or you get all the decls you want). Those can then be specified to autowrap. |
That helped make some progress. When I run this:
I get a macro file with 1245 lines and the only error output is:
I get the same if I use i686-apple-darwin9. Unfortunately, running the second invocation with the same include:
still doesn't result in the value field showing up in the .spec file. I noticed that when I run c2ffi to get the instructions, it includes these lines:
I tried using that as the -A flag, but that didn't work either. If other people are using this successfully on Mojave, whatever I'm doing wrong must be simple. I'm damned if I can figure it out, though. |
I spun up an EC2 instance, installed LLVM, cmake, rdkafka, c2ffi, and SBCL, and tried it from there. It generated the .spec files with a bunch of warnings (see here: https://pastebin.com/KhZdwmr3) but the value tag was present. I copied those to my Mac and ran my script again, which generated a few less warnings (see here: https://pastebin.com/6rKWswWu) and when I ran I'll still spend some time getting it to work on my Mac, but this is at least a workaround. Now I can spend some time figuring out why this typedef makes autowrap unhappy:
Thanks for all your help so far. |
@patrickmay I don't know anything about cl-autowrap (never used it), but I can explain that |
On Mac Mojave 10.14.2 using SBCL 1.5, the following code fails:
This results in:
The .spec files are created by c-include, so that part is working. Is my code wrong or is there a known issue with this version of SBCL?
Thanks.
The text was updated successfully, but these errors were encountered: