Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to build with ENABLE_GIST=ON: undefined reference to vtable for Gecode::Gist::GistMainWindow #96

Closed
yurivict opened this issue Oct 11, 2020 · 8 comments

Comments

@yurivict
Copy link

[241/241] : && /usr/bin/c++ -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -std=c++11 -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -fstack-protector-strong CMakeFiles/fzn-gecode.dir/fzn-gecode_autogen/mocs_compilation.cpp.o CMakeFiles/fzn-gecode.dir/tools/flatzinc/fzn-gecode.cpp.o -o bin/fzn-gecode  -Wl,-rpath,/usr/ports/devel/gecode/work/.build:/usr/local/lib/qt5:/usr/local/lib:  libgecodeflatzinc.so  libgecodeminimodel.so  libgecodedriver.so  libgecodeset.so  libgecodesearch.so  libgecodefloat.so  libgecodeint.so  libgecodekernel.so  libgecodesupport.so  -pthread  libgecodegist.so  /usr/local/lib/qt5/libQt5PrintSupport.so.5.15.0  /usr/local/lib/qt5/libQt5Widgets.so.5.15.0  /usr/local/lib/qt5/libQt5Gui.so.5.15.0  /usr/local/lib/qt5/libQt5Core.so.5.15.0  -Wl,-rpath-link,/usr/local/lib && :
FAILED: bin/fzn-gecode 
: && /usr/bin/c++ -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -std=c++11 -O2 -pipe -fno-omit-frame-pointer -fstack-protector-strong -fno-strict-aliasing -fno-omit-frame-pointer -fstack-protector-strong CMakeFiles/fzn-gecode.dir/fzn-gecode_autogen/mocs_compilation.cpp.o CMakeFiles/fzn-gecode.dir/tools/flatzinc/fzn-gecode.cpp.o -o bin/fzn-gecode  -Wl,-rpath,/usr/ports/devel/gecode/work/.build:/usr/local/lib/qt5:/usr/local/lib:  libgecodeflatzinc.so  libgecodeminimodel.so  libgecodedriver.so  libgecodeset.so  libgecodesearch.so  libgecodefloat.so  libgecodeint.so  libgecodekernel.so  libgecodesupport.so  -pthread  libgecodegist.so  /usr/local/lib/qt5/libQt5PrintSupport.so.5.15.0  /usr/local/lib/qt5/libQt5Widgets.so.5.15.0  /usr/local/lib/qt5/libQt5Gui.so.5.15.0  /usr/local/lib/qt5/libQt5Core.so.5.15.0  -Wl,-rpath-link,/usr/local/lib && :
ld: error: libgecodegist.so: undefined reference to vtable for Gecode::Gist::GistMainWindow
ld: error: libgecodegist.so: undefined reference to vtable for Gecode::Gist::TextOutputI
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::TreeCanvas::contextMenu(QContextMenuEvent*)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::TreeCanvas::scaleChanged(int)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::TreeCanvas::addedBookmark(QString const&)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::TreeCanvas::statusChanged(Gecode::Gist::VisualNode*, Gecode::Gist::Statistics const&, bool)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::TreeCanvas::autoZoomChanged(bool)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::TreeCanvas::removedBookmark(int)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::TreeCanvas::staticMetaObject
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::TreeCanvas::solution(Gecode::Space const*)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::SearcherThread::moveToNode(Gecode::Gist::VisualNode*, bool)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::SearcherThread::statusChanged(bool)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::SearcherThread::searchFinished()
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::SearcherThread::update(int, int, int)
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::SearcherThread::solution(Gecode::Space const*)
ld: error: libgecodegist.so: undefined reference to vtable for Gecode::Gist::TreeCanvas
ld: error: libgecodegist.so: undefined reference to vtable for Gecode::Gist::SearcherThread
ld: error: libgecodegist.so: undefined reference to Gecode::Gist::Gist::statusChanged(Gecode::Gist::Statistics const&, bool)
ld: error: libgecodegist.so: undefined reference to vtable for Gecode::Gist::Gist
ld: error: libgecodegist.so: undefined reference to vtable for Gecode::Gist::NodeStatInspector
ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
c++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

clang-10
FreeBSD 12.2

@zayenz
Copy link
Member

zayenz commented Oct 11, 2020

For the record, how did you compile Gecode and what vesion of Qt do you have installed?

With that said, we do not typically test on FreeBSD, nor do we actually have any FreeBSD machines, so we might not be able to help.

If anyone else has any idea what the problem is, please don't hesitate to chime in.

@yurivict
Copy link
Author

I compiled the FreeBSD port devel/gecode with the option GIST=ON.
qt-5.15.0
cmake-3.18.3
clang-10

@yurivict
Copy link
Author

yurivict commented Oct 11, 2020

Here is the build log: https://people.freebsd.org/~yuri/gecode-6.2.0-build-failure.log

Some object modules, particularly treecanvas.cpp.o , don't get linked into the library libgecodegist.so, which is an immediate cause of this problem.

Do you know why might it not get added to this library?

Version 6.2.0.

@zayenz
Copy link
Member

zayenz commented Oct 12, 2020

Unfortunately I don't have much insight here at this moment, I've not tried to build with Qt for a long time, and never with the CMake build system.

@guidotack Do you have any idea what might be wrong here?

@yurivict
Copy link
Author

and never with the CMake build system.

Then the problem is likely that cmake scripts don't add gist sources to the library when the option is selected.

@Dekker1
Copy link
Contributor

Dekker1 commented Oct 12, 2020

I use the following script to build Gecode using CMake with gist for Windows, Mac, and 2 Linux distributions without any issues:

# Usage: gecode.sh {build_with_gist:0/1}
set -e
set -x

DIR="gecode"
if [ $1 = 1 ]; then
	ENABLE_GIST=TRUE
	if [ ! -x "$(command -v qmake)" ]; then
		  echo "!!!!!!!!!!!!!! CANNOT FIND QMAKE !!!!!!!!!!!!"
		  exit 1
	fi
	DIR="gecode_gist"
else
	ENABLE_GIST=FALSE
fi

mkdir -p {build,vendor}/$DIR
cd build/$DIR

cmake -G"$CMAKEARCH" $CI_PROJECT_DIR/gecode -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$CI_PROJECT_DIR/vendor/$DIR -DENABLE_GIST=${ENABLE_GIST} -DENABLE_CPPROFILER=TRUE
cmake --build . --config Release
cmake --build . --config Release --target install

My guess would be that either the version of CMake or the version of Qt is interfering with the build.

@yurivict
Copy link
Author

I build about the same way.

cmake-3.18.3
qt5-qmake-5.15.0

@yurivict
Copy link
Author

yurivict commented Mar 3, 2021

#102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants