sdroege / gobject-example-rs

Example for exporting a GObject/C API from Rust
41 stars 6 forks source link

typelib won't build #2

Closed grindhold closed 7 years ago

grindhold commented 7 years ago

sorry to bother again, but the typelib target won't yield anything useful. Is there any path-stuff i have to set manually?

g-ir-scanner -v --warn-all \
    --namespace Ex --nsversion=0.1 \
    -Iinclude --c-include "ex/ex.h" \
    --library=gobject_example --library-path=target/debug \
    --include=GObject-2.0 -pkg gobject-2.0 \
    --output Ex-0.1.gir \
    include/ex/ex.h include/ex/foo.h include/ex/bar.h include/ex/nameable.h include/ex/rstring.h include/ex/shared-rstring.h 
/usr/bin/libtool: line 2459: printf: write error: Bad file descriptor
g-ir-scanner: link: libtool --mode=link --tag=CC x86_64-linux-gnu-gcc -pthread -o /home/grindhold/_git_archive/gobject-example-rs/tmp-introspect7zjyawul/Ex-0.1 -export-dynamic tmp-introspect7zjyawul/home/grindhold/_git_archive/gobject-example-rs/tmp-introspect7zjyawul/Ex-0.1.o -L. -lgobject_example -Ltarget/debug -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0
libtool: link: x86_64-linux-gnu-gcc -pthread -o /home/grindhold/_git_archive/gobject-example-rs/tmp-introspect7zjyawul/Ex-0.1 tmp-introspect7zjyawul/home/grindhold/_git_archive/gobject-example-rs/tmp-introspect7zjyawul/Ex-0.1.o -Wl,--export-dynamic -pthread -Wl,--export-dynamic  -L. -lgobject_example -Ltarget/debug -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -pthread
/usr/bin/libtool: line 2459: printf: write error: Bad file descriptor
ERROR: can't resolve libraries to shared libraries: gobject_example
Makefile:33: recipe for target 'Ex-0.1.gir' failed
make: *** [Ex-0.1.gir] Error 1
sdroege commented 7 years ago

This looks like your gobject-introspection installation is broken. Does it work when building any other software?

grindhold commented 7 years ago

yup, i regularly build typelibs for my own libraries, libgtkflow libhttpseverywhere and liboparl. recently i built a GIR file from libgegl-0.3's headers through g-ir-scanner a which g-ir-scanner also points to my regular g-ir-scanner from the distro in /usr/bin, not any self-build experimental stuff

sdroege commented 7 years ago

That's curious. Can you put your /usr/bin/libtool somewhere, especially around line 2459?

grindhold commented 7 years ago
func_version ()
{
    $debug_cmd

    printf '%s\n' "$progname $scriptversion"
    $SED -n '
        /(C)/!b go
        :more
        /\./!{
          N
          s|\n# | |
          b more
        }
        :go
        /^# Written by /,/# warranty; / {
          s|^# ||
          s|^# *$||
          s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
          p
        }
        /^# Written by / {
          s|^# ||
          p
        }
        /^warranty; /q' < "$progpath"

    exit $?
}

the version-function as requested. but isn't its output far more valuable? :) i am on debian testing btw.

sdroege commented 7 years ago

I'm on Debian unstable, but didn't dist-upgrade since a while

So the problem here is not libtool actually, but that the printf there is printing to a bad file descriptor. So whatever is calling libtool is doing something bad with stdout. That would be gobject-introspection I guess. I'm running 1.53.2-4

sdroege commented 7 years ago

Any new insights here?

grindhold commented 7 years ago

not yet, unfortunately. didn't get to it

noverby commented 7 years ago

Similar issue on Fedora 26 with gobject-introspection 1.52.1-1:

g-ir-scanner -v --warn-all \
    --namespace Ex --nsversion=0.1 \
    -Iinclude --c-include "ex/ex.h" \
    --library=gobject_example --library-path=target/debug \
    --include=GObject-2.0 -pkg gobject-2.0 \
    --output Ex-0.1.gir \
    include/ex/ex.h include/ex/foo.h include/ex/bar.h include/ex/nameable.h include/ex/rstring.h include/ex/shared-rstring.h 
/usr/bin/libtool: line 2460: printf: write error: Bad file descriptor
g-ir-scanner: link: libtool --mode=link --tag=CC gcc -pthread -o /home/noverby/Work/git/gobject-example-rs/tmp-introspect7DbaFp/Ex-0.1 -export-dynamic tmp-introspect7DbaFp/home/noverby/Work/git/gobject-example-rs/tmp-introspect7DbaFp/Ex-0.1.o -L. -lgobject_example -Ltarget/debug -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0
libtool: link: gcc -pthread -o /home/noverby/Work/git/gobject-example-rs/tmp-introspect7DbaFp/Ex-0.1 tmp-introspect7DbaFp/home/noverby/Work/git/gobject-example-rs/tmp-introspect7DbaFp/Ex-0.1.o -Wl,--export-dynamic -pthread -Wl,--export-dynamic  -L. -lgobject_example -Ltarget/debug -lgio-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -pthread
/usr/bin/libtool: line 2460: printf: write error: Bad file descriptor
/home/noverby/Work/git/gobject-example-rs/tmp-introspect7DbaFp/Ex-0.1: error while loading shared libraries: libgobject_example.so: cannot open shared object file: No such file or directory
Command '[u'/home/noverby/Work/git/gobject-example-rs/tmp-introspect7DbaFp/Ex-0.1', u'--introspect-dump=/home/noverby/Work/git/gobject-example-rs/tmp-introspect7DbaFp/functions.txt,/home/noverby/Work/git/gobject-example-rs/tmp-introspect7DbaFp/dump.xml']' returned non-zero exit status 127
grindhold commented 7 years ago

it now works on both of my test systems. i assume there has been a relevant fix incoming via distribution-updates.

i now have

And now that it works: Nice work you've done there. I think i will code my next library in Rust to try it out.

sdroege commented 7 years ago

Weird. Can you check if there were any updates in versions in the meantime, and which? I would add this as a requirement to the README then.