in reply to Re^2: Help with compiling glib
in thread Help with compiling glib

I hoped to get a better understanding (?) in trying to compile this stuff myself...

Yes, that's the way to learn - though picking something as large as glib is just as likely to lead to "utter confusion" as to "understanding" ;-)
(At least I sure am glad I didn't try to learn what I know by building glib.)

I thought that the copying trick (*.dell.a -> *.a) removed the need to gives the -lxxx in the LIBS parameter

No, no - you always need to give the -lxxx argument. But if you provide the -lxxx argument && the 'perl Makefile.PL' step emits the warning that no library was found for -lxxx && you know that libxxx.dll.a was in the library search path THEN you need to copy libxxx.dll.a to libxxx.a (because your version of ExtUtils::MakeMaker was obviously too stupid to equate -lxxx with libxxx.dll.a but will be quite capable of equating -lxxx with libxxx.a).

And what is the :nosearch added to the beginning of the LIBS parameter doing ?

Where in this thread is ":nosearch" mentioned ?
Ok ... there are already 2 occurrences of the term in this post of mine, and I can see it in your previous post (to which I'm replying) but I can't see it anywhere else and I therefore don't see the relevance of the question.

I reckon I've seen ":nosearch" in other places, but I don't know what it means and it's not something I've had to bother about in the past. Google can probably provide an explanation.

Cheers,
Rob

Replies are listed 'Best First'.
Re^4: Help with compiling glib
by frazap (Monk) on Jun 22, 2016 at 14:08 UTC
    :nosearch was used here
    https://project-renard.github.io/doc/development/meeting-log/posts/201 +6/05/03/windows-build-with-msys2/

    "And from the doc: An entry of the form -lfoo specifies the library foo, which may be spelled differently depending on what kind of compiler you are using. If you are using GCC, it gets translated to libfoo.a, but for other win32 compilers, it becomes foo.lib. ... An entry that matches /:nosearch/i disables all searching for the libraries specified after it"

    It was my understanding that :nosearch get the dll.a lib used instead of the .a lib by the linker.

    What am I missing with having undefined reference to `g_value_get_variant' with the code below ?

    Thanks

    François
    g++ Glib.def -o blib\arch\auto\Glib\Glib.xs.dll -mdll -s -L"C:\STRAWB~ +1\perl\lib\CORE" -L"C:\STRAWB~1\c\lib" Glib.o GError.o GUtils.o GLog. +o GType.o GBoxed.o GObject.o GValue.o GClosure.o GSignal.o GMainLoop. +o GIOChannel.o GParamSpec.o GKeyFile.o GOption.o GBookmarkFile.o GVar +iant.o gperl-gtypes.o "C:\STRAWB~1\perl\lib\CORE\libperl524.a" "C:\ +prog\gtk+\lib\libglib-2.0.a" "C:\prog\gtk+\lib\libintl.a" "C:\prog\gt +k+\lib\libgobject-2.0.a" "C:\prog\gtk+\lib\libgthread-2.0.a" "C:\STRA +WB~1\c\i686-w64-mingw32\lib\libmoldname.a" "C:\STRAWB~1\c\i686-w64-mi +ngw32\lib\libkernel32.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libuser3 +2.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libgdi32.a" "C:\STRAWB~1\c\i +686-w64-mingw32\lib\libwinspool.a" "C:\STRAWB~1\c\i686-w64-mingw32\li +b\libcomdlg32.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libadvapi32.a" " +C:\STRAWB~1\c\i686-w64-mingw32\lib\libshell32.a" "C:\STRAWB~1\c\i686- +w64-mingw32\lib\libole32.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libol +eaut32.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libnetapi32.a" "C:\STRA +WB~1\c\i686-w64-mingw32\lib\libuuid.a" "C:\STRAWB~1\c\i686-w64-mingw3 +2\lib\libws2_32.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libmpr.a" "C:\ +STRAWB~1\c\i686-w64-mingw32\lib\libwinmm.a" "C:\STRAWB~1\c\i686-w64-m +ingw32\lib\libversion.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libodbc3 +2.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libodbccp32.a" "C:\STRAWB~1\ +c\i686-w64-mingw32\lib\libcomctl32.a" -Wl,--enable-auto-image-base
      I can't spot the problem there.
      I haven't built the Glib module beyond version 1.305 because the later versions reference some symbols that my glib libraries do not define.
      For example, with Glib-1.321 I get undefined reference to 'g_variant_lookup_value', but I would expect that your glib libraries would define 'g_value_get_variant' (as mine do).

      The snippet of your build that you provided looks quite different to anything that my build outputs.
      For me, it's dlltool (not g++) that's being given the task of creating the Glib dll. Is Strawberry doing it differently ? (I know that the Strawberry developer does not like dlltool.)

      Which version of the Glib module are you attempting to build ?
      Do you get better results with version 1.305 ?
      Which version of Strawberry Perl are you using ?
      Could you post all of the output you're getting from your attempted build.

      Cheers,
      Rob
        Sooooo... I did install strawberry 5.24.0.1 (32 bit) again, download Cairo, Glib, Pango using cpan get ...

        I fetched gtk+-bundle_2.24.10-20120208_win32.zip from

        http://ftp.gnome.org/pub/GNOME/binaries/win32/gtk+/2.24/ That I unzipped in
        c:/prog
        and renamed the top unzipped folder to gtk+
        • I created the environment variable GTK_DIR = C:\prog\gtk+
        • My %path% contains C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;C:\prog\gtk+\bin
        • My PKG_CONFIG_PATH is C:\strawberry\c\lib\pkgconfig;%GTK_DIR%\lib\pkgconfig

        Cairo compiled ok with this call to makefile.pl

        perl Makefile.pl INC="-IC:/strawberry/c/include/freetype2 -IC:/prog/gt +k+/include/cairo -IC:/prog/gtk+/include/ -I. -I.\build" LIBS="-LC:/pr +og/gtk+/lib -lcairo" verbose
        Then
        dmake dmake test dmake insall

        passed ok

        In the capn/build/Glib... folder, I called

        perl Makefile.pl INC="-IC:\prog\gtk+\include\glib-2.0 -IC:\prog\Gtk+\l +ib\glib-2.0\include" LIBS="-LC:/prog/gtk+/lib -lgobject-2.0 -lglib-2. +0 -lintl -lgthread-2.0"
        and dmake passed without errors...

        Yesterday when I got undefined ref, I was trying to compile with the gtk+-bundle_2.20.1 version of the libs.

        By the way, the Glib version now installed is

        U:\docs\backup\Gtk+>pkg-config glib-2.0 --modversion 2.28.8

        dmake test gives errors with a.t

        C:\strawberry\cpan\build\Glib-1.321-hjAlkH>dmake test "C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonemp +ty -- Glib .bs blib\arch\auto\Glib\Glib.bs 644 "C:\strawberry\perl\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::H +arness" "- e" "undef *Test::Harness::Switches; test_harness(0, 'blib\lib', 'blib\ +arch')" t/ *.t t/1.t ...................... ok t/2.t ...................... ok t/3.t ...................... ok t/4.t ...................... ok t/5.t ...................... ok t/6.t ...................... ok t/64bit.t .................. ok t/7.t ...................... ok t/8.t ...................... ok t/9.t ...................... ok t/a.t ...................... 1/30 # Failed test 'default log handler: install undef, prev default' # at t/a.t line 78. # got: undef # expected: 'CODE(0x25dfdbc)' # Looks like you failed 1 test of 30. t/a.t ...................... Dubious, test returned 1 (wstat 256, 0x10 +0) Failed 1/30 subtests t/b.t ...................... ok t/boxed_errors.t ........... ok t/bytes.t .................. skipped: GBytes is new in 2.32 t/c.t ...................... ok t/constants.t .............. ok t/d.t ...................... ok t/e.t ...................... ok t/f.t ...................... ok t/filename.t ............... ok t/g.t ...................... ok t/h.t ...................... ok t/lazy_loader.t ............ ok t/make_helper.t ............ ok t/module_versions.t ........ skipped: Test::ConsistentVersion required + for check ing module versions t/options.t ................ ok t/signal_emission_hooks.t .. ok t/signal_marshal.t ......... ok t/signal_query.t ........... ok t/tied_definedness.t ....... ok t/tied_flags.t ............. ok t/tied_set_property.t ...... ok t/variant.t ................ ok Test Summary Report ------------------- t/a.t (Wstat: 256 Tests: 30 Failed: 1) Failed test: 10 Non-zero exit status: 1 Files=33, Tests=1164, 8 wallclock secs ( 0.17 usr + 0.06 sys = 0.23 + CPU) Result: FAIL Failed 1/33 test programs. 1/1164 subtests failed. dmake: Error code 255, while making 'test_dynamic'
        I installed Glib anyway.

        From the build/pango... folder, I called makefile.pl with

        perl Makefile.pl INC="-IC:\prog\gtk+\include -IC:/prog/gtk+/include/fr +eetype2 -IC:/prog/Gtk+/include/cairo -IC:\prog\Gtk+\include\Pango-1.0 + -IC:\prog\Gtk+\include\glib-2.0 -IC:\prog\Gtk+\lib\glib-2.0\include +-I. -I./build -IC:\strawberry\perl\site\lib\Glib\Install -IC:\strawbe +rry\perl\site\lib\Cairo\Install" LIBS="-LC:/prog/gtk+/lib -lpango-1.0 + -lglib-2.0 -lintl -lgobject-2.0 -lgthread-2.0 -lgmodule-2.0 -lpangoc +airo-1.0"
        dmake failed with undefined references
        [ CC xs\PangoMatrix.c ] "C:\strawberry\perl\bin\perl.exe" -MExtUtils::Mksymlists \ -e "Mksymlists('NAME'=>\"Pango\", 'DLBASE' => 'Pango', 'DL_FUNCS' + => { Pango=>[] }, 'FUNCLIST' => [q[newSVPangoRectangle], q[SvPangoRe +ctangle], q[gtk2perl_pango_attribute_get_type], q[gtk2perl_pango_attr +ibute_register_custom_type], q[gtk2perl_pango_attr_iterator_get_type] +, q[gtk2perl_pango_layout_iter_get_type], q[gtk2perl_pango_layout_lin +e_get_type], q[gtk2perl_pango_script_iter_get_type]], 'IMPORTS' => { + }, 'DL_VARS' => []);" [ LD blib\arch\auto\Pango\Pango.xs.dll ] xs/Pango.o:Pango.c:(.text+0x345): undefined reference to `gperl_regist +er_fundamental' xs/Pango.o:Pango.c:(.text+0x362): undefined reference to `gperl_regist +er_boxed' ... xs/Pango.o:Pango.c:(.text+0x6fa): undefined reference to `_gperl_call_ +XS' xs/Pango.o:Pango.c:(.text+0x714): undefined reference to `_gperl_call_ +XS' xs/Pango.o:Pango.c:(.text+0x72e): undefined reference to `_gperl_call_ +XS' xs/Pango.o:Pango.c:(.text+0x748): undefined reference to `_gperl_call_ +XS' xs/Pango.o:Pango.c:(.text+0x762): undefined reference to `_gperl_call_ +XS' xs/Pango.o:Pango.c:(.text+0x77c): more undefined references to `_gperl +_call_XS' follow xs/Pango.o:Pango.c:(.text+0x83e): undefined reference to `gperl_handle +_logs_for' xs/PangoAttributes.o:PangoAttributes.c:(.text+0x1f): undefined referen +ce to `gperl_sv_is_defined' ...

        Update: The command that fails, run by dmake is

        gcc -c -IC:\prog\gtk+\include -IC:/prog/gtk+/include/freetype2 -IC:/p +rog/Gtk+/include/cairo -IC:\prog\Gtk+\include\Pango-1.0 -IC:\prog\Gtk ++\include\glib-2.0 -IC:\prog\Gtk+\lib\glib-2.0\include -I. -I./build +-IC:\strawberry\perl\site\lib\Glib\Install -IC:\strawberry\perl\site\ +lib\Cairo\Install -s -O2 -DWIN32 -DPERL_TEXTMODE_SCRIPTS -DPERL_I +MPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fwrapv -fno-strict-aliasing -mms +-bitfields -s -O2 -DVERSION=\"1.227\" -DXS_VERSION=\"1.227\ +" -o xs\PangoMatrix.o "-IC:\STRAWB~3\perl\lib\CORE" xs\PangoMatrix +.c "C:\strawberry\perl\bin\perl.exe" -MExtUtils::Mksymlists \ -e "Mksymlists('NAME'=>\"Pango\", 'DLBASE' => 'Pango', 'DL_FUNCS' + => { Pango=>[] }, 'FUNCLIST' => [q[newSVPangoRectangle], q[SvPangoRe +ctangle], q[gtk2perl_pango_attribute_get_type], q[gtk2perl_pango_attr +ibute_register_custom_type], q[gtk2perl_pango_attr_iterator_get_type] +, q[gtk2perl_pango_layout_iter_get_type], q[gtk2perl_pango_layout_lin +e_get_type], q[gtk2perl_pango_script_iter_get_type]], 'IMPORTS' => { + }, 'DL_VARS' => []);" g++ Pango.def -o blib\arch\auto\Pango\Pango.xs.dll -mdll -s -L"C:\STRA +WB~3\perl\lib\CORE" -L"C:\STRAWB~3\c\lib" xs/Pango.o xs/PangoAttribut +es.o xs/PangoContext.o xs/PangoFont.o xs/PangoFontset.o xs/PangoFontM +ap.o xs/PangoLayout.o xs/PangoRenderer.o xs/PangoScript.o xs/PangoTab +s.o xs/PangoTypes.o xs/PangoCairo.o xs/PangoGravity.o xs/PangoMatrix. +o "C:\STRAWB~3\perl\lib\CORE\libperl524.a" "C:\prog\gtk+\lib\libpan +go-1.0.dll.a" "C:\prog\gtk+\lib\libglib-2.0.dll.a" "C:\prog\gtk+\lib\ +libintl.dll.a" "C:\prog\gtk+\lib\libgobject-2.0.dll.a" "C:\prog\gtk+\ +lib\libgthread-2.0.dll.a" "C:\prog\gtk+\lib\libgmodule-2.0.dll.a" "C: +\prog\gtk+\lib\libpangocairo-1.0.dll.a" "C:\STRAWB~3\c\i686-w64-mingw +32\lib\libmoldname.a" "C:\STRAWB~3\c\i686-w64-mingw32\lib\libkernel32 +.a" "C:\STRAWB~3\c\i686-w64-mingw32\lib\libuser32.a" "C:\STRAWB~3\c\i +686-w64-mingw32\lib\libgdi32.a" "C:\STRAWB~3\c\i686-w64-mingw32\lib\l +ibwinspool.a" "C:\STRAWB~3\c\i686-w64-mingw32\lib\libcomdlg32.a" "C:\ +STRAWB~3\c\i686-w64-mingw32\lib\libadvapi32.a" "C:\STRAWB~3\c\i686-w6 +4-mingw32\lib\libshell32.a" "C:\STRAWB~3\c\i686-w64-mingw32\lib\libol +e32.a" "C:\STRAWB~3\c\i686-w64-mingw32\lib\liboleaut32.a" "C:\STRAWB~ +3\c\i686-w64-mingw32\lib\libnetapi32.a" "C:\STRAWB~3\c\i686-w64-mingw +32\lib\libuuid.a" "C:\STRAWB~3\c\i686-w64-mingw32\lib\libws2_32.a" "C +:\STRAWB~3\c\i686-w64-mingw32\lib\libmpr.a" "C:\STRAWB~3\c\i686-w64-m +ingw32\lib\libwinmm.a" "C:\STRAWB~3\c\i686-w64-mingw32\lib\libversion +.a" "C:\STRAWB~3\c\i686-w64-mingw32\lib\libodbc32.a" "C:\STRAWB~3\c\i +686-w64-mingw32\lib\libodbccp32.a" "C:\STRAWB~3\c\i686-w64-mingw32\li +b\libcomctl32.a" -Wl,--enable-auto-image-base xs/Pango.o:Pango.c:(.text+0x345): undefined reference to `gperl_regist +er_fundamental'
        My pango version is
        C:\strawberry\cpan\build\Pango-1.227-H3fg7_>pkg-config pango --modvers +ion 1.29.4
        But maybe I should start a new thread "Help with compiling Pango ?"

        Best

        François