Why can meson find hunt-net but not hunt-proton in dependency resolution?

YD diyu60607 at yahoo.com
Wed Apr 1 01:21:22 UTC 2020

On Tuesday, 31 March 2020 at 19:59:25 UTC, YD wrote:
> On Tuesday, 31 March 2020 at 19:51:31 UTC, YD wrote:
>> Hi, I am trying to use Meson, and I did the followings to get 
>> dub packages:
>>    dub fetch hunt-net
>>    dub fetch hunt-proton
>>    dub build hunt-net
>>    dub build hunt-proton
>> when I have this line in my meson.build file:
>>    dependency('hunt-net', method: 'dub')
>> It works fine:
>>    Run-time dependency hunt-net found: YES 0.4.6
>> But when I change it to
>>    dependency('hunt-proton', method: 'dub')
>> It simply says:
>>    Run-time dependency hunt-proton found: NO
>>    ... ERROR: Dependency "hunt-proton" not found
>> And when I looked at meson-log.txt, I couldn't find any clue 
>> on why that happens:
>>     Determining dependency 'hunt-proton' with DUB executable 
>> '.../dlang/dmd-2.091.0/linux/bin64/dub'
>>     Run-time dependency hunt-proton found: NO
>> So I completely cannot figure out why hunt-net is resolvable 
>> but hunt-proton is not. Can anyone help me understand how 
>> meson resolves these dependencies? Thanks!
> I have a feeling that it might be because of the fact that 
> hunt-proton has a "beta" in its version:
>   hunt-net 0.4.6: 
> /home/.../.dub/packages/hunt-net-0.4.6/hunt-net/
>   hunt-proton 1.0.0-beta.3: 
> /home/.../.dub/packages/hunt-proton-1.0.0-beta.3/hunt-proton/
> However, this does not help me solve the problem. Even if I add 
> a "version" parameter to the dependency() function, it still 
> does not resolve hunt-proton.
> Any help will be greatly appreciated, thanks.

So I found that the issue is that dub.json file in hunt-proton 
has an entry referring to the parent package with a relative file 
path in it. When that relative file path is removed, Meson can 
find hunt-proton.

However, even after Meson found it, there are two bad behaviors:

(1) Meson refused to automatically add the dependencies of 
hunt-proton, and I had to manually add them to meson.build.
(2) Meson did not automatically add the appropriate 
d_module_versions setting that is required by hunt (the 
HAVE_EPOLL/HAVE_IOCP/... setting), and I had to manually add that 

Anyway, after manually tweaking the meson.build file like above, 
I got it to work (except that compiling/linking seems quite slow).

More information about the Digitalmars-d-learn mailing list