public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: "cygwin-apps@cygwin.com" <cygwin-apps@cygwin.com>
Subject: Re: Help needed with gobject-introspection
Date: Sun, 24 May 2020 16:56:00 +0100	[thread overview]
Message-ID: <93b48fc8-61f9-ce33-ac76-0e6cc56aa18c@dronecode.org.uk> (raw)
In-Reply-To: <b8a18c00-cea3-d7f9-746c-5b627bb85867@cornell.edu>

On 21/05/2020 18:07, Ken Brown via Cygwin-apps wrote:
> On 5/21/2020 11:48 AM, Jon Turney wrote:
>> On 21/05/2020 16:13, Ken Brown via Cygwin-apps wrote:
>>> On 5/21/2020 9:24 AM, Jon Turney wrote:
>>>> On 20/05/2020 15:50, Ken Brown via Cygwin-apps wrote:
>>>>> On 5/19/2020 7:04 PM, Ken Brown via Cygwin-apps wrote:
>>>>>> I would like to adopt gimp and related packages.  At the moment 
>>>>>> I'm having trouble with babl, which is needed for gegl0.4, which 
>>>>>> is needed for gimp. The problem involves gobject-introspection.
>>>>>>
>>>>>> If I disable introspection, the build works fine.  This would be 
>>>>>> OK, since babl has been built without introspection for several 
>>>>>> years. But then the gegl0.4 build complains about the missing babl 
>>>>>> introspection files, so I would have to disable introspection 
>>>>>> there too, which hasn't been done in the past.
>>>>>>
>>>>>> So my preference is to figure out what the problem is and get the 
>>>>>> babl build working with introspection.  I'm attaching my cygport 
>>>>>> file and patch.
>>>>>>
>>>>>> Here's the failing command...
>>>>>>
>>>>>> /usr/bin/g-ir-scanner -I/usr/include/gobject-introspection-1.0 
>>>>>> -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -D_REENTRANT 
>>>>>> --no-libtool --namespace=Babl --nsversion=0.1 --warn-all --output 
>>>>>> babl/Babl-0.1.gir --c-include=babl.h 
>>>>>> '--identifier-filter-cmd=/usr/bin/python3 
>>>>>> /tmp/cygbabl/babl-0.1.74-1.x86_64/src/babl-0.1.74/babl/identfilter.py' 
>>>>>> -DBABL_IS_BEING_COMPILED 
>>>>>> -I/tmp/cygbabl/babl-0.1.74-1.x86_64/src/babl-0.1.74/babl 
>>>>>> -I/tmp/cygbabl/babl-0.1.74-1.x86_64/src/babl-0.1.74/x86_64-pc-cygwin/babl 
>>>>>> -I./. -I../. -I./babl/base/. -I../babl/base/. 
>>>>>> --filelist=/tmp/cygbabl/babl-0.1.74-1.x86_64/src/babl-0.1.74/x86_64-pc-cygwin/babl/4170c83@@babl-0.1@sha/Babl_0.1_gir_filelist 
>>>>>> --cflags-begin -fno-unsafe-math-optimizations 
>>>>>> -Wdeclaration-after-statement -Winit-self -Wmissing-declarations 
>>>>>> -Wmissing-prototypes -Wold-style-definition -Wpointer-arith -mmmx 
>>>>>> -msse -mfpmath=sse -I./. -I../. -I./babl/base/. -I../babl/base/. 
>>>>>> --cflags-end --library babl-0.1 
>>>>>> -L/tmp/cygbabl/babl-0.1.74-1.x86_64/src/babl-0.1.74/x86_64-pc-cygwin/babl 
>>>>>> --extra-library=m --extra-library=dl --extra-library=lcms2
>>>>>>
>>>>>> ...and the error message:
>>>>>>
>>>>>> g-ir-scanner: link: gcc -o 
>>>>>> /tmp/cygbabl/babl-0.1.74-1.x86_64/src/babl-0.1.74/x86_64-pc-cygwin/tmp-introspectCwCaUc/Babl-0.1.exe 
>>>>>> -ggdb -O2 -pipe -Wall -Werror=format-security 
>>>>>> -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong 
>>>>>> --param=ssp-buffer-size=4 
>>>>>> -fdebug-prefix-map=/tmp/cygbabl/babl-0.1.74-1.x86_64/build=/usr/src/debug/babl-0.1.74-1 
>>>>>> -fdebug-prefix-map=/tmp/cygbabl/babl-0.1.74-1.x86_64/src/babl-0.1.74=/usr/src/debug/babl-0.1.74-1 
>>>>>> /tmp/cygbabl/babl-0.1.74-1.x86_64/src/babl-0.1.74/x86_64-pc-cygwin/tmp-introspectCwCaUc/Babl-0.1.o 
>>>>>> -L. -lbabl-0.1 -lm -ldl -llcms2 
>>>>>> -L/tmp/cygbabl/babl-0.1.74-1.x86_64/src/babl-0.1.74/x86_64-pc-cygwin/babl 
>>>>>> -Wl,-rpath,/tmp/cygbabl/babl-0.1.74-1.x86_64/src/babl-0.1.74/x86_64-pc-cygwin/babl 
>>>>>> -lgio-2.0 -lgobject-2.0 -Wl,--export-all-symbols -lgmodule-2.0 
>>>>>> -lglib-2.0 -lintl
>>>>>> ERROR: can't resolve libraries to shared libraries: babl-0.1
>>>>>>
>>>>>> I don't understand the error message, because the command line 
>>>>>> contains
>>>>>>
>>>>>> -L/tmp/cygbabl/babl-0.1.74-1.x86_64/src/babl-0.1.74/x86_64-pc-cygwin/babl 
>>>>>>
>>>>>>
>>>>>> and that directory contains libbabl-0.1.dll.a and 
>>>>>> cygbabl-0.1-0.dll. I even tried adding that directory to my PATH 
>>>>>> to make sure the right cygbabl-0.1-0.dll would be found, but that 
>>>>>> didn't help.
>>>>
>>>> This might possibly be related to the problem described in the 
>>>> comment for:
>>>>
>>>> https://github.com/mesonbuild/meson/pull/2880/commits/8a27c08b05e4537d5061d30ddd8aad9dc52cf1c4 

Yeah, this looks extremely plausible, there seem to be no GObject 
derived types in babl's interface.

It might be possible to work around this by patching in a dummy GObject 
derived type which does nothing.

I'll have to see if I can find my notes about how I debugged this before.

>>>>> By the way, in case you're wondering why I disabled the building of 
>>>>> docs, it's because I was getting a build failure there too.  I 
>>>>> don't know if this is related to the introspection failure.  The 
>>>>> failing command there is
>>>>>
>>>>> /usr/bin/meson --internal exe --unpickle 
>>>>> /tmp/cygbabl/babl-0.1.74-2.x86_64/src/babl-0.1.74/x86_64-pc-cygwin/meson-private/meson_exe_env_7bf39b99114d34540b83d26a5d8f097e05882836.dat 
>>>>>
>>>>> cp: target 'docs/index.html.tmp' is not a directory
>>>>>
>>>>> I don't know why it's not showing me the actual cp command that fails. 
>>>>
>>>> I believe it's is an infelicity in meson that it doesn't echo the 
>>>> actual failing command here.
>>>>
>>>> Noted here: 
>>>> https://github.com/mesonbuild/meson/pull/3716#issuecomment-395746838
>>>>
>>>>> The corresponding information in docs/meson.build is
>>>>>
>>>>> Reference_html = custom_target('Reference.html',
>>>>>    input : [
>>>>>      'Reference-static.html',
>>>>>      'toc',
>>>>>      index_html_tmp,
>>>>>    ],
>>>>>    output: [ 'Reference.html', ],
>>>>>    command: [
>>>>>      env_bin,
>>>>>      'cp', '@INPUT0@', '@OUTPUT@',
>>>>>      '&&', xml_insert, '@OUTPUT@', 'TOC', '@INPUT1@',
>>>>>      '&&', xml_insert, '@OUTPUT@', 'BablBase', '@INPUT2@',
>>>>>    ],
>>>>>    build_by_default: true,
>>>>> )
>>>>>
>>>>> There are several such custom targets in the file, and for all 
>>>>> except this one, I see the actual cp command in the log.  This is 
>>>>> the only one for which meson generates a 'meson --unpickle' command 
>>>>> instead of a cp command.
>>>>
>>>> Yeah, I wasn't expecting it to use this method of executing the 
>>>> command line (storing it in a pickle and then using a python wrapper 
>>>> to execute it) to be used except on Windows, so I'll have to take a 
>>>> more detailed look at why that's happening.

So, it's correct that it runs this command indirectly via the pickle, 
because it needs to interpose itself to do some PATH manipulation to add 
the DLL, because this target has the 'babl-html-dump' tool, which is 
linked with the DLL, in it's input (indirectly).

>>> Thanks.  FWIW, the recipe for building docs/Reference.html translates to
>>>
>>>    /usr/bin/env \
>>>       cp ../docs/Reference-static.html docs/Reference.html \
>>>        && ../docs/tools/xml_insert.sh docs/Reference.html TOC 
>>> ../docs/toc \
>>>        && ../docs/tools/xml_insert.sh \
>>>           docs/Reference.html BablBase docs/index.html.tmp
>>>
>>> This succeeds when run manually in the build directory.  So something 
>>> must have gone wrong in the pickling/unpickling process.
>>
>>
>> patching 
>> /usr/lib/python3.6/site-packages/mesonbuild/scripts/meson_exe.py 
>> something like this might shed some light:
>>
>> --- meson_exe.py.bak    2020-05-21 15:01:19.187046500 +0100
>> +++ meson_exe.py        2020-05-21 15:09:29.485915300 +0100
>> @@ -57,6 +57,8 @@
>>                   ['Z:' + p for p in exe.extra_paths] + 
>> child_env.get('WINEPATH', '').split(';')
>>               )
>>
>> +    print(cmd_args)
>> +
>>       p = subprocess.Popen(cmd_args, env=child_env, cwd=exe.workdir,
>>                            close_fds=False,
>>                            stdout=subprocess.PIPE,
> 
> OK, now the log shows
> 
> cp: target 'docs/index.html.tmp' is not a directory
> ['/usr/bin/env', 'cp', '../docs/Reference-static.html', 
> 'docs/Reference.html', '&&', 
> '/home/kbrown/src/cygpackages/babl/babl-0.1.74-1.x86_64/src/babl-0.1.74/docs/tools/xml_insert.sh', 
> 'docs/Reference.html', 'TOC', '../docs/toc', '&&', 
> '/home/kbrown/src/cygpackages/babl/babl-0.1.74-1.x86_64/src/babl-0.1.74/docs/tools/xml_insert.sh', 
> 'docs/Reference.html', 'BablBase', 'docs/index.html.tmp']
> 
> This does indeed shed some light.  If I remove all the commas but leave 
> the single quotes, the command fails with the same error message as before:
> 
> cp: target 'docs/index.html.tmp' is not a directory
> 
> If I also remove the single quotes, the command succeeds.  I think the 
> problem is the quotes around the double ampersands, so they are treated 
> as arguments to the cp command instead of being interpreted by the shell 
> executing the command.

So, yeah, this is a meson bug, which I will work on (if this command 
ends up in the build.ninja, it's executed by ninja with 'sh -c', but if 
it ends up in a pickle, it's executed by meson with execve())

(Ofc, everything behaves differently if we are building on Windows, and 
CreateProcess() is used in both places, so allowing shell control 
operators here is not very portable)

  reply	other threads:[~2020-05-24 15:56 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 23:04 Ken Brown
2020-05-20 14:50 ` Ken Brown
2020-05-21 13:24   ` Jon Turney
2020-05-21 15:13     ` Ken Brown
2020-05-21 15:48       ` Jon Turney
2020-05-21 17:07         ` Ken Brown
2020-05-24 15:56           ` Jon Turney [this message]
2020-05-24 16:45             ` Ken Brown
2020-05-24 17:00               ` Ken Brown
2020-05-25 15:04                 ` Ken Brown
2020-05-29 15:56                   ` Jon Turney
2020-05-27 20:32             ` Ken Brown
2020-05-29 15:54               ` Jon Turney
2020-05-31 20:52                 ` Jon Turney
2020-05-31 23:58                   ` Ken Brown
2020-06-01 11:30                     ` Jon Turney
2020-06-02 14:26                       ` Jon Turney
2020-06-02 14:31                         ` Ken Brown
2020-06-02 21:28                           ` Jon Turney
2020-06-03 16:51                             ` Jon Turney
2020-06-03 18:30                               ` Ken Brown
2020-06-06 14:15                                 ` Ken Brown
2020-06-11 21:39                                   ` Jon Turney
2020-06-11 23:23                                     ` Ken Brown
2020-06-12 14:44                                       ` Jon Turney
2020-08-01 18:01                                     ` Ken Brown
2020-08-01 18:34                                       ` Jon Turney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=93b48fc8-61f9-ce33-ac76-0e6cc56aa18c@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).