#31 undefined references

closed-fixed
Jonathan Yong
5
2011-03-24
2010-03-03
James Tilton
No

I am trying to build gtkmm with MinGW-64 for 64 bit Windows (native - not cross compile) on a 64 -bit Windows 7 machine.

I was able to build all the prerequisite packages (with the big help of using pre-built binaries for GTK+).

The build appears to go fine until the first link step. Then I get hundreds of undefined references.
I tried setting LD_LIBRARY_PATH to an appropriate value (LD_LIBRARY_PATH=/usr/local/lib:/c/GTK+/lib:/mingw_w64/lib:/mingw/lib),
but that didn't help.

Can anyone give me advise on what is causing this problem? Thanks!

Here is an abridged version of the terminal output:

Making all in demos
make[2]: Entering directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos'
Making all in gtk-demo
make[3]: Entering directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos/gtk
-demo'
/bin/sh ../../libtool --tag=CXX --mode=link x86_64-w64-mingw32-g++ -g -O2 -mm
s-bitfields -Wall -o gtkmm-demo.exe example_appwindow.o example_buttonbox.o ex
ample_change_display.o example_colorsel.o example_dialog.o example_drawingarea.o
example_images.o example_iconview.o example_menus.o example_panes.o example_pix
bufs.o example_sizegroup.o example_stockbrowser.o example_uimanager.o example_te
xtview.o example_treeview_editable_cells.o example_treeview_liststore.o example_
treeview_treestore.o demowindow.o main.o textwidget.o demo-common.o ../../gdk/
gdkmm/libgdkmm-2.4.la ../../gtk/gtkmm/libgtkmm-2.4.la -LC:/msys/1.0/local/lib -L
c:/GTK+/lib -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lgt
k-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lgdk_pixbuf-2.0 -lpangowin32-1.
0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgli
b-2.0 -lintl
x86_64-w64-mingw32-g++ -g -O2 -mms-bitfields -Wall -o .libs/gtkmm-demo.exe examp
le_appwindow.o example_buttonbox.o example_change_display.o example_colorsel.o e
xample_dialog.o example_drawingarea.o example_images.o example_iconview.o exampl
e_menus.o example_panes.o example_pixbufs.o example_sizegroup.o example_stockbro
wser.o example_uimanager.o example_textview.o example_treeview_editable_cells.o
example_treeview_liststore.o example_treeview_treestore.o demowindow.o main.o te
xtwidget.o demo-common.o ../../gdk/gdkmm/.libs/libgdkmm-2.4.a -LC:/msys/1.0/loc
al/lib -Lc:/GTK+/lib ../../gtk/gtkmm/.libs/libgtkmm-2.4.a /home/JamesCTilton/Dow
nloads/gtkmm-2.16.0/gdk/gdkmm/.libs/libgdkmm-2.4.a /home/JamesCTilton/Downloads/
gtkmm-2.16.0/atk/atkmm/.libs/libatkmm-1.6.dll.a /usr/local/lib/libgiomm-2.4.dll.
a /usr/local/lib/libpangomm-1.4.a /usr/local/lib/libglibmm-2.4.dll.a /usr/local/
lib/libcairomm-1.0.a -lfreetype -lfontconfig -lpng12 -lz /usr/local/lib/libsigc-
2.0.dll.a -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lgdk_pixbuf-2.0 -
lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmo
dule-2.0 -lglib-2.0 -lintl -L/usr/local/lib
example_buttonbox.o:C:\msys\1.0\home\JamesCTilton\Downloads\gtkmm-2.16.0\demos\g
tk-demo/example_buttonbox.cc:83: undefined reference to `_imp___ZN3Gtk5Stock2OKE
'
example_buttonbox.o:C:\msys\1.0\home\JamesCTilton\Downloads\gtkmm-2.16.0\demos\g
tk-demo/example_buttonbox.cc:86: undefined reference to `_imp___ZN3Gtk5Stock6CAN
CELE'

(Many other similar messages)

demowindow.o:C:\msys\1.0\home\JamesCTilton\Downloads\gtkmm-2.16.0\demos\gtk-demo
/demowindow.cc:144: undefined reference to `_imp___ZN3Gtk14TreeViewColumnC1ERKN4
Glib7ustringERNS_12CellRendererE'
demowindow.o:C:\msys\1.0\home\JamesCTilton\Downloads\gtkmm-2.16.0\demos\gtk-demo
/demowindow.cc:146: undefined reference to `_imp___ZN3Gtk14TreeViewColumn13add_a
ttributeERKN4Glib18PropertyProxy_BaseERKNS_19TreeModelColumnBaseE'
collect2: ld returned 1 exit status
make[3]: *** [gtkmm-demo.exe] Error 1
make[3]: Leaving directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos/gtk-
demo'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0'
make: *** [all] Error 2

Discussion

1 2 > >> (Page 1 of 2)
  • Jonathan Yong
    Jonathan Yong
    2010-03-04

    Hi,

    first of all, LD_LIBRARY_PATH does not work on Windows, and it is not used for linking at all.

    Secondly, where did you download your files from?

    You should contact GTK and ask where all those C++ functions come from.

     
  • Jonathan Yong
    Jonathan Yong
    2010-03-04

    • labels: --> Build 3rd party app
     
  • James Tilton
    James Tilton
    2010-03-04

    Thanks jon_y for your response. However, I have been able to figure out the solution to my problem myself.

    I had extracted the GTK+ bundle to C:\GTK+, following approximately the suggestion from the GTK+ website.

    However, msys could not find the files at that location in the link stage of my build (at least, I don't know a good way to
    get msys find them there, since, as jon_y pointed out, LD_LIBRARY_PATH does not work on Windows).

    Also, I only need GTK+ for program builds performed under msys - meaning GTK+ does not need to be visible to applications
    outside of msys.

    Thus my solution: Instead of extracting the GTK+ bundle to C:\GTK+, instead extract the GTK+ bundel to /usr/local under the
    msys directory tree (actually C:\msys\1.0\local)

    My build for gtkmm is now running smoothly (it hasn't completed yet as of this writing, but it has been proceeding smoothly
    for about a half hour now!)

    I would gladly provide advice to anyone else who needs to build gtkmm for 64-bit windows.

     
  • James Tilton
    James Tilton
    2010-03-04

    Oops! I thought the build had past the critical point prior to my last posting. However, it just failed with the same error despite moving the GTK+ material to /usr/local.

    I'll continue to investigate - I'll try inquiring with the GTK+ community as well.

     
  • Jonathan Yong
    Jonathan Yong
    2010-03-04

    Hi,

    Use -L /usr/local under MSYS to make the linker check the specific directory.

    /usr/* area isn't checked automatically for windows targets, see gcc -print-search-dirs for a list of directories searched.

     
  • James Tilton
    James Tilton
    2010-03-05

    Per jon_y's suggestion, I ran my configure command as follows:

    /configure CC=x86_64-w64-mingw32-gcc CPP=x86_64-w64-mingw32-cpp \ CXX=x86_64-w64-mingw32-g++ F77=x86_64-w64-mingw32-gfortran \ AR=x86_64-w64-mingw32-ar RANLIB=x86_64-w64-mingw32-ranlib \ STRIP=x86_64-w64-mingw32-strip AS=x86_64-w64-mingw32-as \ DLLTOOL=x86_64-w64-mingw32-dlltool LD=x86_64-w64-mingw32-ld \ NM=x86_64-w64-mingw32-nm OBJDUMP=x86_64-w64-mingw32-objdump \ LDFLAGS="-L /usr/local"

    (A side question - is there a way to make sure the correct set of tools is used without
    explicitly specifying them as I have in my configure command line??)

    Now when I execute the make command, the undefined references go away, but I now get the following:

    ...
    Making all in gtk-demo
    make[3]: Entering directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos/gtk-demo'
    /bin/sh ../../libtool --tag=CXX --mode=link x86_64-w64-mingw32-g++ -g -O2 -mms-bitfields
    -Wall -L /usr/local -o gtkmm-demo.exe example_appwindow.o example_buttonbox.o
    example_change_display.o example_colorsel.o example_dialog.o example_drawingarea.o
    example_images.o example_iconview.o example_menus.o example_panes.o example_pixbufs.o
    example_sizegroup.o example_stockbrowser.o example_uimanager.o example_textview.o
    example_treeview_editable_cells.o example_treeview_liststore.o example_treeview_treestore.o
    demowindow.o main.o textwidget.o demo-common.o
    ../../gdk/gdkmm/libgdkmm-2.4.la ../../gtk/gtkmm/libgtkmm-2.4.la -LC:/msys/1.0/local/lib
    -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lgtk
    -win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0
    -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl
    x86_64-w64-mingw32-g++ -g -O2 -mms-bitfields -Wall /usr/local -o .libs/gtkmm-demo.exe
    example_appwindow.o example_buttonbox.o example_change_display.o example_colorsel.o
    example_dialog.o example_drawingarea.o example_images.o example_iconview.o example_menus.o
    example_panes.o example_pixbufs.o example_sizegroup.o example_stockbrowser.o example_uimanager.o
    example_textview.o example_treeview_editable_cells.o example_treeview_liststore.o
    example_treeview_treestore.o demowindow.o main.o textwidget.o demo-common.o
    -L/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos/gtk-demo ../../gdk/gdkmm/.libs/libgdkmm-2.4.a
    -L/usr/local -LC:/msys/1.0/local/lib ../../gtk/gtkmm/.libs/libgtkmm-2.4.a
    /home/JamesCTilton/Downloads/gtkmm-2.16.0/gdk/gdkmm/.libs/libgdkmm-2.4.a
    /home/JamesCTilton/Downloads/gtkmm-2.16.0/atk/atkmm/.libs/libatkmm-1.6.dll.a
    /usr/local/lib/libgiomm-2.4.dll.a /usr/local/lib/libpangomm-1.4.a
    /usr/local/lib/libglibmm-2.4.dll.a /usr/local/lib/libcairomm-1.0.a
    -lfreetype -lfontconfig -lpng12 -lz /usr/local/lib/libsigc-2.0.dll.a -lgtk-win32-2.0
    -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32
    -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl
    -L/usr/local/lib
    c:/mingw_w64/bin/../lib/gcc/x86_64-w64-mingw32/4.4.4/../../../../x86_64-w64-mingw32/bin/ld.exe:
    cannot find C:/msys/1.0/local: Permission denied
    collect2: ld returned 1 exit status
    make[3]: *** [gtkmm-demo.exe] Error 1
    make[3]: Leaving directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos/gtk-demo'
    make[2]: *** [all-recursive] Error 1
    make[2]: Leaving directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0'
    make: *** [all] Error 2

    I note that C:/msys/1.0/local is synonymous with /usr/local under msys. Would changing
    C:/msys/1.0/local to /usr/local everywhere solve the problem? If so, how can this be done (perhaps through a configure option)
    without editing each Makefile individually?

    Or is the problem something else entirely?

    Thanks in advance for any insight into this problem.

    I note that I also have exactly the same problem trying to build netcdf. After invoking the same configure command,
    the make for netcdf goes as follows:

    $ make
    make all-recursive
    make[1]: Entering directory `/home/JamesCTilton/Downloads/netcdf-4.0.1'
    Making all in f90
    make[2]: Entering directory `/home/JamesCTilton/Downloads/netcdf-4.0.1/f90'
    make all-am
    make[3]: Entering directory `/home/JamesCTilton/Downloads/netcdf-4.0.1/f90'
    make[3]: Nothing to be done for `all-am'.
    make[3]: Leaving directory `/home/JamesCTilton/Downloads/netcdf-4.0.1/f90'
    make[2]: Leaving directory `/home/JamesCTilton/Downloads/netcdf-4.0.1/f90'
    Making all in fortran
    make[2]: Entering directory `/home/JamesCTilton/Downloads/netcdf-4.0.1/fortran'
    make all-am
    make[3]: Entering directory `/home/JamesCTilton/Downloads/netcdf-4.0.1/fortran'
    make[3]: Leaving directory `/home/JamesCTilton/Downloads/netcdf-4.0.1/fortran'
    make[2]: Leaving directory `/home/JamesCTilton/Downloads/netcdf-4.0.1/fortran'
    Making all in libsrc
    make[2]: Entering directory `/home/JamesCTilton/Downloads/netcdf-4.0.1/libsrc'
    depbase=`echo v2i.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ /bin/sh ../libtool --tag=CC
    --mode=compile x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I../fortran
    -g -O2 -MT v2i.lo -MD -MP -MF $depbase.Tpo -c -o v2i.lo v2i.c &&\ mv -f $depbase.Tpo $depbase.Plo
    libtool: compile: x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I../fortran
    -g -O2 -MT v2i.lo -MD -MP -MF .deps/v2i.Tpo -c v2i.c -o v2i.o
    /bin/sh ../libtool --tag=CC --mode=link x86_64-w64-mingw32-gcc -g -O2
    -L /usr/local -o libnetcdf2.la v2i.lo
    libtool: link: x86_64-w64-mingw32-ar cru .libs/libnetcdf2.a v2i.o
    libtool: link: x86_64-w64-mingw32-ranlib .libs/libnetcdf2.a
    libtool: link: ( cd ".libs" && rm -f "libnetcdf2.la" && ln -s "../libnetcdf2.la" "libnetcdf2.la" )
    /bin/sh ../libtool --tag=CC --mode=link x86_64-w64-mingw32-gcc -g -O2
    -version-info 4:0:0 -L /usr/local -o libnetcdf.la -rpath /usr/local/lib attr.lo
    ncx.lo putget.lo dim.lo error.lo libvers.lo nc.lo string.lo v1hpg.lo var.lo
    utf8proc.lo posixio.lo libnetcdf2.la ../fortran/libnetcdff.la
    libtool: link: warning: undefined symbols not allowed in i686-pc-mingw32 shared libraries
    libtool: link: (cd .libs/libnetcdf.lax/libnetcdf2.a && x86_64-w64-mingw32-ar x "
    /home/JamesCTilton/Downloads/netcdf-4.0.1/libsrc/./.libs/libnetcdf2.a")
    libtool: link: (cd .libs/libnetcdf.lax/libnetcdff.a && x86_64-w64-mingw32-ar x "
    /home/JamesCTilton/Downloads/netcdf-4.0.1/libsrc/../fortran/.libs/libnetcdff.a")
    libtool: link: x86_64-w64-mingw32-ar cru .libs/libnetcdf.a attr.o ncx.o
    putget.o dim.o error.o libvers.o nc.o string.o v1hpg.o var.o utf8proc.o posixio.o
    .libs/libnetcdf.lax/libnetcdf2.a/v2i.o .libs/libnetcdf.lax/libnetcdff.a/fort-attio.o
    .libs/libnetcdf.lax/libnetcdff.a/fort-control.o .libs/libnetcdf.lax/libnetcdff.a/fort-dim.o
    .libs/libnetcdf.lax/libnetcdff.a/fort-genatt.o .libs/libnetcdf.lax/libnetcdff.a/fort-geninq.o
    .libs/libnetcdf.lax/libnetcdff.a/fort-genvar.o
    .libs/libnetcdf.lax/libnetcdff.a/fort-lib.o .libs/libnetcdf.lax/libnetcdff.a/fort-misc.o
    .libs/libnetcdf.lax/libnetcdff.a/fort-v2compat.o .libs/libnetcdf.lax/libnetcdff.a/fort-var1io.o
    .libs/libnetcdf.lax/libnetcdff.a/fort-varaio.o .libs/libnetcdf.lax/libnetcdff.a/fort-vario.o
    .libs/libnetcdf.lax/libnetcdff.a/fort-varmio.o
    .libs/libnetcdf.lax/libnetcdff.a/fort-varsio.o .libs/libnetcdf.lax/libnetcdff.a/netcdf.o
    .libs/libnetcdf.lax/libnetcdff.a/typeSizes.o
    libtool: link: x86_64-w64-mingw32-ranlib .libs/libnetcdf.a
    libtool: link: rm -fr .libs/libnetcdf.lax
    libtool: link: ( cd ".libs" && rm -f "libnetcdf.la" && ln -s "../libnetcdf.la" "libnetcdf.la" )
    make[2]: Leaving directory `/home/JamesCTilton/Downloads/netcdf-4.0.1/libsrc'
    Making all in nctest
    make[2]: Entering directory `/home/JamesCTilton/Downloads/netcdf-4.0.1/nctest'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/home/JamesCTilton/Downloads/netcdf-4.0.1/nctest'
    Making all in ncgen
    make[2]: Entering directory `/home/JamesCTilton/Downloads/netcdf-4.0.1/ncgen'
    depbase=`echo main.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I../fortran -I..
    -I../libsrc -I../libsrc -g -O2 -MT main.o -MD -MP -MF $depbase.Tpo -c -o main.o main.c &&\ mv -f $depbase.Tpo $depbase.Po
    depbase=`echo load.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I../fortran -I..
    -I../libsrc -I../libsrc -g -O2 -MT load.o -MD -MP -MF $depbase.Tpo -c -o load.o load.c &&\ mv -f $depbase.Tpo $depbase.Po
    depbase=`echo escapes.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I../fortran -I..
    -I../libsrc -I../libsrc -g -O2 -MT escapes.o -MD -MP -MF $depbase.Tpo -c
    -o escapes.o escapes.c &&\ mv -f $depbase.Tpo $depbase.Po
    depbase=`echo getfill.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I../fortran -I..
    -I../libsrc -I../libsrc -g -O2 -MT getfill.o -MD -MP -MF $depbase.Tpo -c
    -o getfill.o getfill.c &&\ mv -f $depbase.Tpo $depbase.Po
    depbase=`echo init.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I../fortran -I..
    -I../libsrc -I../libsrc -g -O2 -MT init.o -MD -MP -MF $depbase.Tpo -c -o init.o init.c &&\ mv -f $depbase.Tpo $depbase.Po
    depbase=`echo genlib.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I../fortran -I..
    -I../libsrc -I../libsrc -g -O2 -MT genlib.o -MD -MP -MF $depbase.Tpo -c -o genlib.o genlib.c &&\ mv -f $depbase.Tpo $depbase.Po
    depbase=`echo ncgentab.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ x86_64-w64-mingw32-gcc -DHAVE_CONFIG_H -I. -I.. -I../fortran -I.. -I../libsrc
    -I../libsrc -g -O2 -MT ncgentab.o -MD -MP -MF $depbase.Tpo -c -o ncgentab.o ncgentab.c &&\ mv -f $depbase.Tpo $depbase.Po
    /bin/sh ../libtool --tag=CC --mode=link x86_64-w64-mingw32-gcc -g -O2
    -L /usr/local -o ncgen.exe main.o load.o escapes.o getfill.o init.o genlib.o ncgentab.
    o ../libsrc/libnetcdf.la
    libtool: link: x86_64-w64-mingw32-gcc -g -O2 /usr/local -o ncgen.exe main.o load.o escapes.o
    getfill.o init.o genlib.o ncgentab.o -L/home/JamesCTilton/Downloads/netcdf-4.0.1/ncgen
    ../libsrc/.libs/libnetcdf.a -L/home/JamesCTilton/Downloads/netcdf-4.0.1/libsrc
    -L/home/JamesCTilton/Downloads/netcdf-4.0.1/fortran -L/usr/local
    c:/mingw_w64/bin/../lib/gcc/x86_64-w64-mingw32/4.4.4/../../../../x86_64-w64-ming
    w32/bin/ld.exe: cannot find C:/msys/1.0/local: Permission denied
    collect2: ld returned 1 exit status
    make[2]: *** [ncgen.exe] Error 1
    make[2]: Leaving directory `/home/JamesCTilton/Downloads/netcdf-4.0.1/ncgen'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/home/JamesCTilton/Downloads/netcdf-4.0.1'
    make: *** [all] Error 2

     
  • NightStrike
    NightStrike
    2010-03-06

    Most configure scripts support the --host option for just that purpose.

     
  • James Tilton
    James Tilton
    2010-03-08

    I tried using the --host option to get around explicitly specifying the correct set of build tools in my configure command line, but I couldn't get that to work. So to eliminate this as a potential cause of my linking problem, I removed the 32-bit tools and made symbolic links for every application and file in C:\mingw_w64\bin.
    E.g.: make a link from gcc.exe to x86_64-w64-mingw32-gcc.exe using the command:
    ln -s x86_64-w64-mingw32-gcc.exe gcc.exe

    Now I can just configure with:

    ./configure LDFLAGS="-L /usr/local"

    and be sure to get the correct set of build tools.

    BUT - I still end up with the same linking problem. My make now produces the same error:

    ...
    Making all in demos
    make[2]: Entering directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos'
    Making all in gtk-demo
    make[3]: Entering directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos/gtk-demo'
    /bin/sh ../../libtool --tag=CXX --mode=link g++ -g -O2 -mms-bitfields -Wall
    -L /usr/local -o gtkmm-demo.exe example_appwindow.o example_buttonbox.o
    example_change_display.o example_colorsel.o example_dialog.o example_drawingarea.o
    example_images.o example_iconview.o example_menus.o example_panes.o example_pixbufs.o
    example_sizegroup.o example_stockbrowser.o example_uimanager.o example_textview.o
    example_treeview_editable_cells.o example_treeview_liststore.o
    example_treeview_treestore.o demowindow.o main.o textwidget.o demo-common.o
    ../../gdk/gdkmm/libgdkmm-2.4.la ../../gtk/gtkmm/libgtkmm-2.4.la
    -LC:/msys/1.0/local/lib -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lcairomm-1.0
    -lsigc-2.0 -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lgdk_pixbuf-2.0
    -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0
    -lgmodule-2.0 -lglib-2.0 -lintl
    g++ -g -O2 -mms-bitfields -Wall /usr/local -o .libs/gtkmm-demo.exe
    example_appwindow.o example_buttonbox.o example_change_display.o example_colorsel.o
    example_dialog.o example_drawingarea.o example_images.o example_iconview.o
    example_menus.o example_panes.o example_pixbufs.o example_sizegroup.o
    example_stockbrowser.o example_uimanager.o example_textview.o
    example_treeview_editable_cells.o example_treeview_liststore.o
    example_treeview_treestore.o demowindow.o main.o textwidget.o demo-common.o
    -L/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos/gtk-demo
    ../../gdk/gdkmm/.libs/libgdkmm-2.4.a -LC:/msys/1.0/local/lib
    ../../gtk/gtkmm/.libs/libgtkmm-2.4.a
    /home/JamesCTilton/Downloads/gtkmm-2.16.0/gdk/gdkmm/.libs/libgdkmm-2.4.a
    /home/JamesCTilton/Downloads/gtkmm-2.16.0/atk/atkmm/.libs/libatkmm-1.6.dll.a
    /usr/local/lib/libgiomm-2.4.dll.a /usr/local/lib/libpangomm-1.4.a
    /usr/local/lib/libglibmm-2.4.dll.a /usr/local/lib/libcairomm-1.0.a
    -lfreetype -lfontconfig -lpng12 -lz /usr/local/lib/libsigc-2.0.dll.a
    -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lgdk_pixbuf-2.0
    -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0
    -lgmodule-2.0 -lglib-2.0 -lintl -L/usr/local/lib
    c:/mingw_w64/bin/../lib/gcc/x86_64-w64-mingw32/4.4.4/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find C:/msys/1.0/local: Permission denied
    collect2: ld returned 1 exit status
    make[3]: *** [gtkmm-demo.exe] Error 1
    make[3]: Leaving directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos/gtk-demo'
    make[2]: *** [all-recursive] Error 1
    make[2]: Leaving directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0'
    make: *** [all] Error 2

    Can anyone give me any insight into what is causing this link error?

    Thanks.

     
  • Jonathan Yong
    Jonathan Yong
    2010-03-09

    Hi,

    I saw "g++ -g -O2 -mms-bitfields -Wall /usr/local -o ...", /usr/local should not be there. Try looking into the makefile to find out why is it there.

     
  • James Tilton
    James Tilton
    2010-03-09

    Concerning "g++ -g -O2 -mms-bitfields -Wall /usr/local -o ...", the /usr/local is put there by including -L /usr/local in the configure line.

    I am coming to believe that the suggestion to configure with

    ./configure LDFLAGS="-L /usr/local" is a bad one.

    Using LDFLAGS="-L /usr/local" appears to cause the "cannot find C:/msys/1.0/local: Permission denied" error, which covers up (i.e. occurs before the build gets to) my original "undefined reference" error.

    Noting that I have removed the 32-bit mingw build tools from my system, and have set up symbolic links for every application and file in C:\mingw_w64\bin,
    I should be able to configure for my gtkmm build with just:

    ./configure

    In this environment and configuration I now get pretty much the original error:


    Making all in demos
    make[2]: Entering directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos'
    Making all in gtk-demo
    make[3]: Entering directory `/home/JamesCTilton/Downloads/gtkmm-2.16.0/demos/gtk-demo'
    /bin/sh ../../libtool --tag=CXX --mode=link g++ -g -O2 -mms-bitfields -Wall
    -o gtkmm-demo.exe example_appwindow.o example_buttonbox.o example_change_display.o
    example_colorsel.o example_dialog.o example_drawingarea.o example_images.o
    example_iconview.o example_menus.o example_panes.o example_pixbufs.o
    example_sizegroup.o example_stockbrowser.o example_uimanager.o example_textview.o
    example_treeview_editable_cells.o example_treeview_liststore.o
    example_treeview_treestore.o demowindow.o main.o textwidget.o demo-common.o
    ../../gdk/gdkmm/libgdkmm-2.4.la ../../gtk/gtkmm/libgtkmm-2.4.la
    -LC:/msys/1.0/local/lib -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lcairomm-1.0
    -lsigc-2.0 -lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lgdk_pixbuf-2.0
    -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0
    -lgmodule-2.0 -lglib-2.0 -lintl
    g++ -g -O2 -mms-bitfields -Wall -o .libs/gtkmm-demo.exe example_appwindow.o
    example_buttonbox.o example_change_display.o example_colorsel.o example_dialog.o
    example_drawingarea.o example_images.o example_iconview.o example_menus.o
    example_panes.o example_pixbufs.o example_sizegroup.o example_stockbrowser.o
    example_uimanager.o example_textview.o example_treeview_editable_cells.o
    example_treeview_liststore.o example_treeview_treestore.o demowindow.o main.o
    textwidget.o demo-common.o ../../gdk/gdkmm/.libs/libgdkmm-2.4.a
    -LC:/msys/1.0/local/lib ../../gtk/gtkmm/.libs/libgtkmm-2.4.a
    /home/JamesCTilton/Downloads/gtkmm-2.16.0/gdk/gdkmm/.libs/libgdkmm-2.4.a
    /home/JamesCTilton/Downloads/gtkmm-2.16.0/atk/atkmm/.libs/libatkmm-1.6.dll.a
    /usr/local/lib/libgiomm-2.4.dll.a /usr/local/lib/libpangomm-1.4.a
    /usr/local/lib/libglibmm-2.4.dll.a /usr/local/lib/libcairomm-1.0.a
    -lfreetype -lfontconfig -lpng14 -lz /usr/local/lib/libsigc-2.0.dll.a -lgtk-win32-2.0
    -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32
    -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl
    -L/usr/local/lib
    example_buttonbox.o:C:\msys\1.0\home\JamesCTilton\Downloads\gtkmm-2.16.0\demos\gtk-demo/example_buttonbox.cc:83: undefined reference to `_imp___ZN3Gtk5Stock2OKE'
    example_buttonbox.o:C:\msys\1.0\home\JamesCTilton\Downloads\gtkmm-2.16.0\demos\gtk-demo/example_buttonbox.cc:86: undefined reference to `_imp___ZN3Gtk5Stock6CANCELE'
    example_buttonbox.o:C:\msys\1.0\home\JamesCTilton\Downloads\gtkmm-2.16.0\demos\gtk-demo/example_buttonbox.cc:89: undefined reference to `_imp___ZN3Gtk5Stock4HELPE'
    example_change_display.o:C:\msys\1.0\home\JamesCTilton\Downloads\gtkmm-2.16.0\demos\ gtk-demo/example_change_display.cc:252: undefined reference to `_imp___ZN3Gtk5Stock6CANCELE'
    example_change_display.o:C:\msys\1.0\home\JamesCTilton\Downloads\gtkmm-2.16.0\demos\ gtk-demo/example_change_display.cc:253: undefined reference to `_imp___ZN3Gtk5Stock2OKE'
    example_change_display.o: In function `Example_ChangeDisplay':
    C:\msys\1.0\home\JamesCTilton\Downloads\gtkmm-2.16.0\demos\gtk-demo/
    example_change_display.cc:127: undefined reference to `_imp___ZN3Gtk5Stock5CLOSEE'
    example_change_display.o: In function `TreeViewColumn<Glib::ustring>':
    C:\msys\1.0\home\JamesCTilton\Downloads\gtkmm-2.16.0\demos\gtk-demo/../../gtk/gtkmm/
    treeviewcolumn.h:972: undefined reference to `_imp___ZTTN3Gtk14TreeViewColumnE'

    I also note that this is not unique to the gtkmm build. The gtkmm build actually proceeds far enough that all the libraries are build, and running "make install" does install the libraries. When I subsequently try to build my own application (my actual goal!!), I get an error very similar to what I get from the gtkmm build when it tries to link the gtkmm-demo application. Here is what I get from the build of my own application:

    ...
    g++ -Wall -O3 -I/home/JamesCTilton/src/CommonV1.50
    -I/home/JamesCTilton/src/RHSEG/rhsegV1.50 -mms-bitfields
    -IC:/msys/1.0/local/include/gtkmm-2.4 -IC:/msys/1.0/local/lib/gtkmm-2.4/include
    -IC:/msys/1.0/local/include/glibmm-2.4 -IC:/msys/1.0/local/lib/glibmm-2.4/include
    -IC:/msys/1.0/local/include/giomm-2.4 -IC:/msys/1.0/local/lib/giomm-2.4/include
    -IC:/msys/1.0/local/include/gdkmm-2.4 -IC:/msys/1.0/local/lib/gdkmm-2.4/include
    -IC:/msys/1.0/local/include/pangomm-1.4 -IC:/msys/1.0/local/lib/pangomm-1.4/include
    -IC:/msys/1.0/local/include/atkmm-1.6 -IC:/msys/1.0/local/include/gtk-2.0
    -IC:/msys/1.0/local/include/sigc++-2.0 -IC:/msys/1.0/local/lib/sigc++-2.0/include
    -IC:/msys/1.0/local/include/glib-2.0 -IC:/msys/1.0/local/lib/glib-2.0/include
    -IC:/msys/1.0/local/lib/gtk-2.0/include -IC:/msys/1.0/local/include/cairomm-1.0
    -IC:/msys/1.0/local/lib/cairomm-1.0/include -IC:/msys/1.0/local/include/pango-1.0
    -IC:/msys/1.0/local/include/cairo -IC:/msys/1.0/local/include/freetype2
    -IC:/msys/1.0/local/include -IC:/msys/1.0/local/include/libpng14
    -IC:/msys/1.0/local/include/atk-1.0 -c main.cc
    g++ -Wall -O3 -I/home/JamesCTilton/src/CommonV1.50
    -I/home/JamesCTilton/src/RHSEG/rhsegV1.50 -mms-bitfields
    -IC:/msys/1.0/local/include/gtkmm-2.4 -IC:/msys/1.0/local/lib/gtkmm-2.4/include
    -IC:/msys/1.0/local/include/glibmm-2.4 -IC:/msys/1.0/local/lib/glibmm-2.4/include
    -IC:/msys/1.0/local/include/giomm-2.4 -IC:/msys/1.0/local/lib/giomm-2.4/include
    -IC:/msys/1.0/local/include/gdkmm-2.4 -IC:/msys/1.0/local/lib/gdkmm-2.4/include
    -IC:/msys/1.0/local/include/pangomm-1.4 -IC:/msys/1.0/local/lib/pangomm-1.4/include
    -IC:/msys/1.0/local/include/atkmm-1.6 -IC:/msys/1.0/local/include/gtk-2.0
    -IC:/msys/1.0/local/include/sigc++-2.0 -IC:/msys/1.0/local/lib/sigc++-2.0/include
    -IC:/msys/1.0/local/include/glib-2.0 -IC:/msys/1.0/local/lib/glib-2.0/include
    -IC:/msys/1.0/local/lib/gtk-2.0/include -IC:/msys/1.0/local/include/cairomm-1.0
    -IC:/msys/1.0/local/lib/cairomm-1.0/include -IC:/msys/1.0/local/include/pango-1.0
    -IC:/msys/1.0/local/include/cairo -IC:/msys/1.0/local/include/freetype2
    -IC:/msys/1.0/local/include -IC:/msys/1.0/local/include/libpng14
    -IC:/msys/1.0/local/include/atk-1.0 -c hsegextract.cc
    linking...
    g++ -mwindows -o hsegextract.exe main.o hsegextract.o params/initialParams.o
    params/params.o params/paramsGUI.o image/image.o spatial/spatial.o region/region_class.o
    region/region_object.o results/results.o
    /home/JamesCTilton/src/CommonV1.50/gui/fileObject.o
    /home/JamesCTilton/src/CommonV1.50/gui/numberObject.o
    -LC:/msys/1.0/local/lib -lgtkmm-2.4 -lgiomm-2.4 -lgdkmm-2.4 -latkmm-1.6 -lgtk-win32-2.0
    -lpangomm-1.4 -lcairomm-1.0 -lglibmm-2.4 -lsigc-2.0 -lgdk-win32-2.0 -latk-1.0
    -lgio-2.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpangocairo-1.0 -lpango-1.0
    -lcairo -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl
    C:/msys/1.0/home/JamesCTilton/src/CommonV1.50/gui/fileObject.o:fileObject.cc:
    (.text+0x2c59): undefined reference to `_imp___ZN3Gtk5Stock2OKE'
    C:/msys/1.0/home/JamesCTilton/src/CommonV1.50/gui/fileObject.o:fileObject.cc:
    (.text+0x2cad): undefined reference to `_imp___ZN3Gtk5Stock6CANCELE'
    C:/msys/1.0/home/JamesCTilton/src/CommonV1.50/gui/fileObject.o:fileObject.cc:
    (.text+0x3013): undefined reference to `_imp___ZN3Gtk5Stock4OPENE'
    collect2: ld returned 1 exit status
    make: *** [hsegextract.exe] Error 1

    For example, the `_imp___ZN3Gtk5Stock2OKE' comes from the definition (#define) of "GTK_STOCK_OK" in the include fild "gtk-2.0/gtk/gtkstock.h"

    I don't think this is a problem with the link not finding the correct libraries.
    It appears to me to be a problem with a mismatch in compiler translation of the define constant names. The GTK+ library build was performed with a MinGW_w64 cross compiler from Linux, and my builds were performed as I have described.

    I am wondering if I will have to perform my own build of the GTK+ libraries to get everything to match up properly.

    Anyone - any comments or advise?

     
1 2 > >> (Page 1 of 2)