asdfjkl / jfxchess

JFXChess - Chess Program
https://asdfjkl.github.io/jfxchess
GNU General Public License v2.0
102 stars 21 forks source link

How to build on Linux #32

Closed rain0r closed 5 years ago

rain0r commented 5 years ago

How can I build Jerry myself on Linux?

I tried to pull some information on this from build_ubuntu_64.sh but it's just copying files and creating folders.

asdfjkl commented 5 years ago

I'll push the debian build files in the next days in the repo....

asdfjkl commented 5 years ago

1.) To just create a build, download Qt5 development tools and Qt5 Creator. Open the .pro in QtCreator and a build environment will be automatically created 2.) To build a debian package, download https://github.com/asdfjkl/jerry/releases/download/v3.1.0/jerry_3.1.0.orig.tar.gz extract, install pbuilder and run pdebuild in the extracted root directory.

Spill-The-Tea commented 5 years ago

Hi Dominik @asdfjkl ,

I'm actually having a problem compiling this too. Specifically : main_window.cpp:426:58: error: address of overloaded function 'valueChanged' does not match required type

line 426 From main_window.cpp File:

connect(this->spinMultiPv, QOverload\(&QSpinBox::valueChanged), this->modeController, &ModeController::onMultiPVChanged);

I'm not exactly sure how to change this section to be able to compile it. I tried removing the address ampersand, but received the following error : call to non-static member function without an object argument

Any insight would be helpful. Cheers

asdfjkl commented 5 years ago

There are two signals valueChanged() for QSpinBox which is why the overload is required. From memory, there are three possibilities:

connect(this->spinMultiPv, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this->modeController, &ModeController::onMultiPVChanged);

Spill-The-Tea commented 5 years ago

Interesting. I double checked the pro file and it defaulted to C++11. I was able to modify it to the following, to become c++11 compatible:

connect(this->spinMultiPv, QOverload::of(&QSpinBox::valueChanged), this->modeController, &ModeController::onMultiPVChanged);

And you are right, after adding CONFIG += c++14 to the .pro file, it works fine as is. But then I ran into similar linker problems in both cases (c++11 and c++14):

NOTE: a missing vtable usually means the first non-inline virtual member function has no definition. ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

asdfjkl commented 5 years ago

hard to guess from here. Are you building the debian source package, or within QtCreator? If the later, one guess would be that your .pro file is not correct, i.e. that there are source-files missing, that source files are not listed in the correct order of dependency, or that libraries (such as +svg etc) are not correctly stated. Reference file is jerry3.pro.

Spill-The-Tea commented 5 years ago

I figured out the issue. I am actually building on mac OSx. So, the problem was arising from various/resource_finder.cpp lines 9-17:

ifdef linux

QString appPath = "/usr/share/jerry/";
return appPath;

endif

ifdef _WIN32

QString appPath = QCoreApplication::applicationDirPath();
return appPath.append(QDir::separator());

endif

Slightly Altering this , allows Mac users to compile:

ifdef linux

QString appPath = "/usr/share/jerry/";
return appPath;

else

QString appPath = QCoreApplication::applicationDirPath();
return appPath.append(QDir::separator());

endif

Please, note that this also requires modification of model/internalengine.cpp, otherwise, the internal engine will not be found for mac users. Something like this should work:

ifdef linux

QString path = QString("/usr/games/stockfish");
this->setPath(path);

elseif _WIN32

QString path = ResourceFinder::getPath().append("/engine/");
path = path.append(QString("stockfish.exe"));
path = QString('"').append(path).append('"');
path = QDir::toNativeSeparators(QDir::cleanPath(path));
this->setPath(path);

else

QString path = ResourceFinder::getPath().append("/engine/");
path = path.append(QString("stockfish"));
path = QString('"').append(path).append('"');
path = QDir::toNativeSeparators(QDir::cleanPath(path));
this->setPath(path);

endif

Atrament666 commented 5 years ago

Hi, the directive #elseif in internalengine.cpp is not defined and causes the compilation to fail on linux, I suggest replacing it with #elif

Thanks

asdfjkl commented 5 years ago

elseif fixed in ec24f96fbb8184489d8336bc5f431d817bd44605

If anyone encounters other build problems in Linux, please reopen a new issue.