Thread overview | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
April 18, 2015 nginx module bindings | ||||
---|---|---|---|---|
| ||||
Hello DForum! I wanted to attempt to write an nginx module in Dlang. However, the first step of generating some bindings is proving to be a pain on linux. Htod is windows only, and the other projects either generate incomprehensible modules, or are way out of date (it seems). Any pointers, or pre-existing bindings for nginx modules would be appreciated. -Shammah |
April 18, 2015 Re: nginx module bindings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shammah Chancellor | On Saturday, 18 April 2015 at 02:03:40 UTC, Shammah Chancellor wrote: > Hello DForum! > > I wanted to attempt to write an nginx module in Dlang. However, the first step of generating some bindings is proving to be a pain on linux. Htod is windows only, and the other projects either generate incomprehensible modules, or are way out of date (it seems). > > Any pointers, or pre-existing bindings for nginx modules would be appreciated. > > -Shammah Have you tried dstep? https://github.com/jacob-carlborg/dstep |
April 18, 2015 Re: nginx module bindings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Meta | On 2015-04-18 02:24:52 +0000, Meta said:
> On Saturday, 18 April 2015 at 02:03:40 UTC, Shammah Chancellor wrote:
>> Hello DForum!
>>
>> I wanted to attempt to write an nginx module in Dlang. However, the first step of generating some bindings is proving to be a pain on linux. Htod is windows only, and the other projects either generate incomprehensible modules, or are way out of date (it seems).
>>
>> Any pointers, or pre-existing bindings for nginx modules would be appreciated.
>>
>> -Shammah
>
> Have you tried dstep?
>
> https://github.com/jacob-carlborg/dstep
I did try to compile it, but it started pulling in tango 1.0 and whatnot -- I figured it was not up to date. Is this wrong?
-Shammah
|
April 18, 2015 Re: nginx module bindings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shammah Chancellor Attachments: | On Fri, 17 Apr 2015 22:50:28 -0700, Shammah Chancellor wrote:
>> Have you tried dstep?
>>
>> https://github.com/jacob-carlborg/dstep
>
> I did try to compile it, but it started pulling in tango 1.0 and whatnot -- I figured it was not up to date. Is this wrong?
it will not compile with 2.067, only with 2.066.
dunno if it really works though, as built dstep segfaults when i'm trying to convert anything. the only thing i can see is CLI help.
|
April 18, 2015 Re: nginx module bindings | ||||
---|---|---|---|---|
| ||||
Posted in reply to ketmar | On Saturday, 18 April 2015 at 06:34:34 UTC, ketmar wrote:
> On Fri, 17 Apr 2015 22:50:28 -0700, Shammah Chancellor wrote:
>
>>> Have you tried dstep?
>>>
>>> https://github.com/jacob-carlborg/dstep
>>
>> I did try to compile it, but it started pulling in tango 1.0 and whatnot
>> -- I figured it was not up to date. Is this wrong?
>
> it will not compile with 2.067, only with 2.066.
>
> dunno if it really works though, as built dstep segfaults when i'm trying
> to convert anything. the only thing i can see is CLI help.
Yeah, I am at an impasse. It either segfaults or spits out lots
of errors about not being able to find headers despite adding all
the -I paths.
|
April 18, 2015 Re: nginx module bindings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shammah Chancellor | On 2015-04-18 07:50, Shammah Chancellor wrote: > I did try to compile it, but it started pulling in tango 1.0 and whatnot > -- I figured it was not up to date. Is this wrong? It's up to date and is working. It builds with DMD 2.066.1 and the test suite passes. Pre-compiled binaries are available here [1] for Linux, OS X and FreeBSD. I noticed the binaries are a bit outdated but it shouldn't be that bad. Please report any issues you encounter to [2]. [1] https://github.com/jacob-carlborg/dstep/releases/latest [2] https://github.com/jacob-carlborg/dstep/issues -- /Jacob Carlborg |
April 18, 2015 Re: nginx module bindings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shammah Chancellor | On 2015-04-18 09:33, Shammah Chancellor wrote: > Yeah, I am at an impasse. It either segfaults or spits out lots > of errors about not being able to find headers despite adding all > the -I paths. Which headers are it complaining about? -- /Jacob Carlborg |
April 18, 2015 Re: nginx module bindings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shammah Chancellor | On Saturday, 18 April 2015 at 02:03:40 UTC, Shammah Chancellor wrote:
> Hello DForum!
>
> I wanted to attempt to write an nginx module in Dlang. However, the first step of generating some bindings is proving to be a pain on linux. Htod is windows only, and the other projects either generate incomprehensible modules, or are way out of date (it seems).
>
> Any pointers, or pre-existing bindings for nginx modules would be appreciated.
>
> -Shammah
You might have to create the bindings yourself, if you do, please put them on GitHub and in a DUB package so others can benefit from them.
I have been creating bindings for the Pebble SDK recently, and during my time working on that, I have come up with a process for creating the C bindings.
1. Apply dstep to the headers. Remove any parts from the header files which it won't accept.
2. Open the .d files and the .h files, and compare the two.
3. Implement whatever dstep missed out.
dstep doesn't get you 100% of the way there, but it's a lot better than starting from nothing. I also have spent hours and hours working on the Pebble SDK headers recently, but that's only because I have been obsessed with translating all of the documentation to DDoc comments.
|
April 18, 2015 Re: nginx module bindings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Saturday, 18 April 2015 at 08:17:15 UTC, Jacob Carlborg wrote: > On 2015-04-18 09:33, Shammah Chancellor wrote: > >> Yeah, I am at an impasse. It either segfaults or spits out lots >> of errors about not being able to find headers despite adding all >> the -I paths. > > Which headers are it complaining about? Here is the command I was running. >>> dstep -I~/nginx-build/nginx-1.6.2/objs/ngx_auto_headers.h -I../../src/os/unix/ -I ../../src/core -I ../../src/event -I~/d/llvm/tools/clang/lib/Headers/ ngx_conf_file.h File(10B2B20F0, "")warning: ../../src/event: 'linker' input unused [-Wunused-command-line-argument] File(10B2B20F0, "")warning: ../../src/core: 'linker' input unused [-Wunused-command-line-argument] File(10B2B20F0, "")/usr/include/module.map:1:25: warning: unknown attribute 'extern_c' [-Wignored-attributes] File(10B2B20F0, "")/usr/include/module.map:36:14: error: header 'float.h' not found File(10B2B20F0, "")/usr/include/module.map:81:14: error: header 'stdarg.h' not found File(10B2B20F0, "")/usr/include/module.map:113:14: error: header 'tgmath.h' not found File(10B2B20F0, "")/usr/include/module.map:1561:21: warning: unknown attribute 'extern_c' [-Wignored-attributes] File(10B2B20F0, "")/usr/include/module.map:1577:26: warning: unknown attribute 'extern_c' [-Wignored-attributes] File(10B2B20F0, "")/usr/include/module.map:1602:23: warning: unknown attribute 'extern_c' [-Wignored-attributes] File(10B2B20F0, "")/usr/include/module.map:1635:23: warning: unknown attribute 'extern_c' [-Wignored-attributes] File(10B2B20F0, "")/usr/include/module.map:1662:22: warning: unknown attribute 'extern_c' [-Wignored-attributes] File(10B2B20F0, "")./ngx_config.h:12:10: fatal error: 'ngx_auto_headers.h' file not found |
April 18, 2015 Re: nginx module bindings | ||||
---|---|---|---|---|
| ||||
Posted in reply to Shammah Chancellor | On 2015-04-18 17:25, Shammah Chancellor wrote: > File(10B2B20F0, "")/usr/include/module.map:36:14: error: header > 'float.h' not found > File(10B2B20F0, "")/usr/include/module.map:81:14: error: header > 'stdarg.h' not found > File(10B2B20F0, "")/usr/include/module.map:113:14: error: header > 'tgmath.h' not found These three are Clang built-in headers. They're shipped with Clang and need to be place in the standard include paths or explicitly added using the -I flag. See the information about libclang [1]. This is fixed in master, the files are shipped with DStep now. Although, I may not have included all, I have mostly added them as I need. > File(10B2B20F0, "")./ngx_config.h:12:10: fatal error: > 'ngx_auto_headers.h' file not found I'm not sure about this but it could be an related to how these headers are used. DStep is built to generate bindings from one file at a time. That might not always be compatible with the build system a library uses. For example, some headers could be generated in a build step. I've seen some headers using types without including a single header, that still works since another header will include this one plus the other headers that are needed. Please read the limitations at the bottom of the documentation [2] to see if any of those apply in your case. BTW, I updated the code so it can be built with DMD 2.067.0. I'm just waiting for the Travis build to pass before merging it to master. [1] https://github.com/jacob-carlborg/dstep#libclang [2] https://github.com/jacob-carlborg/dstep#limitationsknown-issues -- /Jacob Carlborg |
Copyright © 1999-2021 by the D Language Foundation