QPlotWidget trouble

Hi all,

I see that the plot widget was moved to it’s own library – glad to
see that, perhaps we can submit it to Qt, since they lack any plotting
widgets of their own.

I’m having a bit of trouble updating my extension to recognize the
change, though. I’ve changed all includes from <avogadro/plot*.h> to
<qplotwidget/plot*.h>, updated CMakeLists.txt, and updated my
designer.ui files, but I’m still getting an undefined symbol error:

/usr/bin/avogadro: symbol lookup error:
/usr/lib/avogadro/1_1/contrib/xtalopt.so: undefined symbol:
_ZN8Avogadro10PlotWidgetC1EP7QWidget

I’ve done clean builds of both avo and the extension several times,
but to no avail.

Any ideas? More info:

**** CMakeLists.txt:

avogadro_plugin(xtalopt
"{xtalopt_SRCS}" "{xtalopt_UIS}"
)
target_link_libraries(xtalopt QPlotWidget)

**** make VERBOSE=1

/usr/bin/c++ -fPIC -g -shared -Wl,-soname,xtalopt.so -o xtalopt.so
CMakeFiles/xtalopt.dir/src/spglib/bravais.c.o
CMakeFiles/xtalopt.dir/src/spglib/bravais_art.c.o
CMakeFiles/xtalopt.dir/src/spglib/cell.c.o
CMakeFiles/xtalopt.dir/src/spglib/debug.c.o
CMakeFiles/xtalopt.dir/src/spglib/mathfunc.c.o
CMakeFiles/xtalopt.dir/src/spglib/pointgroup.c.o
CMakeFiles/xtalopt.dir/src/spglib/primitive.c.o
CMakeFiles/xtalopt.dir/src/spglib/spacegroup.c.o
CMakeFiles/xtalopt.dir/src/spglib/spacegroup_data.c.o
CMakeFiles/xtalopt.dir/src/spglib/spacegroup_database.c.o
CMakeFiles/xtalopt.dir/src/spglib/spglib.c.o
CMakeFiles/xtalopt.dir/src/spglib/symmetry.c.o
CMakeFiles/xtalopt.dir/src/spglib/symmetry_kpoint.c.o
CMakeFiles/xtalopt.dir/src/generic/structure.cpp.o
CMakeFiles/xtalopt.dir/src/generic/xtal.cpp.o
CMakeFiles/xtalopt.dir/src/extension.cpp.o
CMakeFiles/xtalopt.dir/src/generic/templates.cpp.o
CMakeFiles/xtalopt.dir/src/generic/tracker.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/xtalopt.cpp.o
CMakeFiles/xtalopt.dir/src/generic/queuemanager.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/genetic.cpp.o
CMakeFiles/xtalopt.dir/src/generic/optimizer.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/optimizers/vasp.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/optimizers/gulp.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/optimizers/pwscf.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/testing/xtalopttest.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/dialog.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_init.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_edit.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_opt.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_sys.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_progress.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_plot.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_log.cpp.o
CMakeFiles/xtalopt.dir/src/generic/bt.cpp.o -lAvogadroCore
-lAvogadroWidget -lQPlotWidget

**** ldd xtalopt.so

libQPlotWidget.so.1 => /usr/lib/libQPlotWidget.so.1 (0xb7578000)

So it is linking successfully, and PlotWidget is still in the Avogadro
namespace, still inherets QObject, etc…

Help? :slight_smile:

Dave

14.05.10, 20:58, “David Lonie” loniedavid@gmail.com:

Hi all,

I see that the plot widget was moved to it’s own library – glad to
see that, perhaps we can submit it to Qt, since they lack any plotting
widgets of their own.

Or release as a separate project - in this case other developers will be able to use it before Qt 4.8 will come :slight_smile:

I’m having a bit of trouble updating my extension to recognize the
change, though. I’ve changed all includes from to
, updated CMakeLists.txt, and updated my
designer.ui files, but I’m still getting an undefined symbol error:

/usr/bin/avogadro: symbol lookup error:
/usr/lib/avogadro/1_1/contrib/xtalopt.so: undefined symbol:
_ZN8Avogadro10PlotWidgetC1EP7QWidget

I’ve done clean builds of both avo and the extension several times,
but to no avail.

Any ideas?

Try to use plotwidget instead… Maybe tricks in AvogadroUse.cmake are needed.
Also, I’ve forgotten to make pkg-config file for QPlotWidget and QperiodicTable

More info:

**** CMakeLists.txt:

avogadro_plugin(xtalopt
{xtalopt_SRCS}" "{xtalopt_UIS}”
)
target_link_libraries(xtalopt QPlotWidget)

**** make VERBOSE=1

/usr/bin/c++ -fPIC -g -shared -Wl,-soname,xtalopt.so -o xtalopt.so
CMakeFiles/xtalopt.dir/src/spglib/bravais.c.o
CMakeFiles/xtalopt.dir/src/spglib/bravais_art.c.o
CMakeFiles/xtalopt.dir/src/spglib/cell.c.o
CMakeFiles/xtalopt.dir/src/spglib/debug.c.o
CMakeFiles/xtalopt.dir/src/spglib/mathfunc.c.o
CMakeFiles/xtalopt.dir/src/spglib/pointgroup.c.o
CMakeFiles/xtalopt.dir/src/spglib/primitive.c.o
CMakeFiles/xtalopt.dir/src/spglib/spacegroup.c.o
CMakeFiles/xtalopt.dir/src/spglib/spacegroup_data.c.o
CMakeFiles/xtalopt.dir/src/spglib/spacegroup_database.c.o
CMakeFiles/xtalopt.dir/src/spglib/spglib.c.o
CMakeFiles/xtalopt.dir/src/spglib/symmetry.c.o
CMakeFiles/xtalopt.dir/src/spglib/symmetry_kpoint.c.o
CMakeFiles/xtalopt.dir/src/generic/structure.cpp.o
CMakeFiles/xtalopt.dir/src/generic/xtal.cpp.o
CMakeFiles/xtalopt.dir/src/extension.cpp.o
CMakeFiles/xtalopt.dir/src/generic/templates.cpp.o
CMakeFiles/xtalopt.dir/src/generic/tracker.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/xtalopt.cpp.o
CMakeFiles/xtalopt.dir/src/generic/queuemanager.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/genetic.cpp.o
CMakeFiles/xtalopt.dir/src/generic/optimizer.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/optimizers/vasp.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/optimizers/gulp.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/optimizers/pwscf.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/testing/xtalopttest.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/dialog.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_init.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_edit.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_opt.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_sys.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_progress.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_plot.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_log.cpp.o
CMakeFiles/xtalopt.dir/src/generic/bt.cpp.o -lAvogadroCore
-lAvogadroWidget -lQPlotWidget

**** ldd xtalopt.so

libQPlotWidget.so.1 => /usr/lib/libQPlotWidget.so.1 (0xb7578000)

So it is linking successfully, and PlotWidget is still in the Avogadro
namespace, still inherets QObject, etc…

Help? :slight_smile:

Dave



Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
avogadro-devel List Signup and Options


Regards,
Konstantin

Яндекс.Почта. Письма есть. Спама - нет. http://mail.yandex.ru/nospam/sign

Actually, I haven’t tried to use library outside Avogadro. Thanks for testing!

14.05.10, 20:58, “David Lonie” loniedavid@gmail.com:

Hi all,

I see that the plot widget was moved to it’s own library – glad to
see that, perhaps we can submit it to Qt, since they lack any plotting
widgets of their own.

I’m having a bit of trouble updating my extension to recognize the
change, though. I’ve changed all includes from to
, updated CMakeLists.txt, and updated my
designer.ui files, but I’m still getting an undefined symbol error:

/usr/bin/avogadro: symbol lookup error:
/usr/lib/avogadro/1_1/contrib/xtalopt.so: undefined symbol:
_ZN8Avogadro10PlotWidgetC1EP7QWidget

I’ve done clean builds of both avo and the extension several times,
but to no avail.

Any ideas? More info:

**** CMakeLists.txt:

avogadro_plugin(xtalopt
{xtalopt_SRCS}" "{xtalopt_UIS}”
)
target_link_libraries(xtalopt QPlotWidget)

**** make VERBOSE=1

/usr/bin/c++ -fPIC -g -shared -Wl,-soname,xtalopt.so -o xtalopt.so
CMakeFiles/xtalopt.dir/src/spglib/bravais.c.o
CMakeFiles/xtalopt.dir/src/spglib/bravais_art.c.o
CMakeFiles/xtalopt.dir/src/spglib/cell.c.o
CMakeFiles/xtalopt.dir/src/spglib/debug.c.o
CMakeFiles/xtalopt.dir/src/spglib/mathfunc.c.o
CMakeFiles/xtalopt.dir/src/spglib/pointgroup.c.o
CMakeFiles/xtalopt.dir/src/spglib/primitive.c.o
CMakeFiles/xtalopt.dir/src/spglib/spacegroup.c.o
CMakeFiles/xtalopt.dir/src/spglib/spacegroup_data.c.o
CMakeFiles/xtalopt.dir/src/spglib/spacegroup_database.c.o
CMakeFiles/xtalopt.dir/src/spglib/spglib.c.o
CMakeFiles/xtalopt.dir/src/spglib/symmetry.c.o
CMakeFiles/xtalopt.dir/src/spglib/symmetry_kpoint.c.o
CMakeFiles/xtalopt.dir/src/generic/structure.cpp.o
CMakeFiles/xtalopt.dir/src/generic/xtal.cpp.o
CMakeFiles/xtalopt.dir/src/extension.cpp.o
CMakeFiles/xtalopt.dir/src/generic/templates.cpp.o
CMakeFiles/xtalopt.dir/src/generic/tracker.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/xtalopt.cpp.o
CMakeFiles/xtalopt.dir/src/generic/queuemanager.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/genetic.cpp.o
CMakeFiles/xtalopt.dir/src/generic/optimizer.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/optimizers/vasp.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/optimizers/gulp.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/optimizers/pwscf.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/testing/xtalopttest.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/dialog.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_init.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_edit.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_opt.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_sys.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_progress.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_plot.cpp.o
CMakeFiles/xtalopt.dir/src/xtalopt/ui/tab_log.cpp.o
CMakeFiles/xtalopt.dir/src/generic/bt.cpp.o -lAvogadroCore
-lAvogadroWidget -lQPlotWidget

**** ldd xtalopt.so

libQPlotWidget.so.1 => /usr/lib/libQPlotWidget.so.1 (0xb7578000)

So it is linking successfully, and PlotWidget is still in the Avogadro
namespace, still inherets QObject, etc…

Help? :slight_smile:

Dave



Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
avogadro-devel List Signup and Options


Regards,
Konstantin

Здесь спама нет http://mail.yandex.ru/nospam/sign

2010/5/14 Konstantin Tokarev annulen@yandex.ru:

Try to use plotwidget instead… Maybe tricks in AvogadroUse.cmake are needed.
Also, I’ve forgotten to make pkg-config file for QPlotWidget and QperiodicTable

I’m not sure what you mean here – use plotwidget how?

Dave

14.05.10, 22:01, “David Lonie” loniedavid@gmail.com:

2010/5/14 Konstantin Tokarev :

Try to use plotwidget instead… Maybe tricks in AvogadroUse.cmake are needed.
Also, I’ve forgotten to make pkg-config file for QPlotWidget and QperiodicTable

I’m not sure what you mean here – use plotwidget how?

Internal name of QPlotWidget target is plotwidget. Not sure if it’s exported though…


Regards,
Konstantin

2010/5/14 Konstantin Tokarev annulen@yandex.ru:

14.05.10, 22:01, “David Lonie” loniedavid@gmail.com:

2010/5/14 Konstantin Tokarev :

Try to use plotwidget instead… Maybe tricks in AvogadroUse.cmake are needed.
Also, I’ve forgotten to make pkg-config file for QPlotWidget and QperiodicTable

I’m not sure what you mean here – use plotwidget how?

Internal name of QPlotWidget target is plotwidget. Not sure if it’s exported though…

AFAIK, setting target_link_libraries(xtalopt QPlotWidget) will just
put -lQPlotWidget in the link command, and it seems to be finding it
ok.

A test program:

#include <qplotwidget/plotwidget.h>
#include <Qt/qapplication.h>
#include <Qt/qdialog.h>
#include <Qt/qdebug.h>
#include

int main(int argc, char *argv) {
qDebug() << “Attempting to create plotwidget”;
QApplication qa (argc, argv);
QDialog qd;
Avogadro::PlotWidget pw (&qd);
qDebug() << “success!”;
return 0;
}

compiles and runs fine with the -lQPlotWidget option to g++. Seems to
be a problem in my code somewhere, but everything was working fine
before I pulled the changes that moved the plotwidget. Hrm…

Dave

A couple more pieces to the puzzle are below. Any ideas are very welcome! :slight_smile:

Runtime error is:

/usr/bin/avogadro: symbol lookup error:
/usr/lib/avogadro/1_1/contrib/xtalopt.so: undefined symbol:
_ZN8Avogadro10PlotWidgetC1EP7QWidget

The symbol resolves to Avogadro::PlotWidget::PlotWidget(QWidget*)
(master) dl@ez02:/git/xtalopt/build$ nm xtalopt.so |nl|grep
_ZN8Avogadro10PlotWidgetC1EP7QWidget
2893 U _ZN8Avogadro10PlotWidgetC1EP7QWidget
(master) dl@ez02:/git/xtalopt/build$ nm xtalopt.so |c++filt|nl|grep -i 2893
2893 U Avogadro::PlotWidget::PlotWidget(QWidget*)

Which is most definitely declared in the plotwidget header…

I never call the constructor implicitly, since I use a promoted widget
within designer, same as the spectra dialog. The relevant parts of the
.ui file:

QFrame::StyledPanel QFrame::Raised [snip] Avogadro::PlotWidget QFrame qplotwidget/plotwidget.h 1

This matches the spectra extension, which works…

The ui*.h file that Qt generates seems to be fine, too:
plot_plot = new Avogadro::PlotWidget(Tab_Plot); is clearly the line
that is causing problems. The proper header is included in this file
as well.

Thoughts?

Dave

On Fri, 14 May 2010 14:58:16 -0400
David Lonie loniedavid@gmail.com wrote:

A couple more pieces to the puzzle are below. Any ideas are very
welcome! :slight_smile:

Runtime error is:

/usr/bin/avogadro: symbol lookup error:
/usr/lib/avogadro/1_1/contrib/xtalopt.so: undefined symbol:
_ZN8Avogadro10PlotWidgetC1EP7QWidget

The symbol resolves to Avogadro::PlotWidget::PlotWidget(QWidget*)
(master) dl@ez02:/git/xtalopt/build$ nm xtalopt.so |nl|grep
_ZN8Avogadro10PlotWidgetC1EP7QWidget
2893 U _ZN8Avogadro10PlotWidgetC1EP7QWidget
(master) dl@ez02:/git/xtalopt/build$ nm xtalopt.so |c++filt|nl|grep
-i 2893 2893 U Avogadro::PlotWidget::PlotWidget(QWidget*)

Which is most definitely declared in the plotwidget header…

I never call the constructor implicitly, since I use a promoted widget
within designer, same as the spectra dialog. The relevant parts of the
.ui file:

QFrame::StyledPanel QFrame::Raised [snip] Avogadro::PlotWidget QFrame qplotwidget/plotwidget.h 1

This matches the spectra extension, which works…

The ui*.h file that Qt generates seems to be fine, too:
plot_plot = new Avogadro::PlotWidget(Tab_Plot); is clearly the line
that is causing problems. The proper header is included in this file
as well.

Thoughts?

Dave

  1. If proper header wasn’t include, it would be compile error, not link
    error
  2. Didn’t you try to use old header (avogadro/plotwidget.h)? It’s still
    installed for compatibility
  3. Maybe another compiler is able to generate more sensible error (not
    sure though)


Regards,
Konstantin

On Fri, May 14, 2010 at 4:04 PM, Konstantin Tokarev annulen@yandex.ru wrote:

  1. If proper header wasn’t include, it would be compile error, not link
    error
  2. Didn’t you try to use old header (avogadro/plotwidget.h)? It’s still
    installed for compatibility
  3. Maybe another compiler is able to generate more sensible error (not
    sure though)

Thanks for the ideas – it worked on another system on the first try.
It appears that I had an old version installed in ~ that was blocking
the new one in /usr/. Sorry for the list noise :slight_smile:

Dave