crosswire / xiphos

Xiphos is a Bible study tool written for Linux, UNIX, and Windows using GTK, offering a rich and featureful environment for reading, study, and research using modules from The SWORD Project and elsewhere.
http://xiphos.org
GNU General Public License v2.0
208 stars 51 forks source link

cmake fails at biblesync - can't build on kubuntu 18.04 #967

Open mozmck opened 5 years ago

mozmck commented 5 years ago

Trying to build on Kubuntu 18.04 and not having success. I built and installed Sword from git, biblesync from git, and I installed all the other dependencies.

When running cmake for xiphos I get the following output and errors - and I can't figure out why or how to fix it. HELP!

$ cmake -DCMAKE_BUILD_TYPE=Release -DSTRIP=ON ../xiphos -- The C compiler identification is GNU 7.4.0 -- The CXX compiler identification is GNU 7.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for glib-genmarshal -- Looking for glib-genmarshal - found -- Looking for xmllint -- Looking for xmllint - found -- Looking for xsltproc -- Looking for xsltproc - found -- Looking for dbus-binding-tool -- Looking for dbus-binding-tool - found -- Looking for itstool -- Looking for itstool - found -- Looking for desktop-file-validate -- Looking for desktop-file-validate - found -- Looking for appstream-util -- Looking for appstream-util - found -- Looking for yelp-build -- Looking for yelp-build - found -- Looking for uuidgen -- Looking for uuidgen - found -- Found Biblesync: /usr/include/biblesync (found version "2.0.1") CMake Error at cmake/modules/FindBiblesync.cmake:75 (target_include_directories): Cannot specify include directories for imported target "PkgConfig::Biblesync".
Call Stack (most recent call first):
cmake/XiphosDependencies.cmake:51 (find_package)
CMakeLists.txt:76 (include)

CMake Error at cmake/modules/FindBiblesync.cmake:76 (target_link_libraries):
Cannot specify link libraries for target "PkgConfig::Biblesync" which is
not built by this project.
Call Stack (most recent call first):
cmake/XiphosDependencies.cmake:51 (find_package)
CMakeLists.txt:76 (include)

-- Configuring incomplete, errors occurred!

mozmck commented 5 years ago

A little more info if I use -Wdev with cmake:

CMake Warning (dev) at cmake/modules/FindBiblesync.cmake:18 (find_path):
  uninitialized variable 'BIBLESYNC_INCLUDE_DIRS'
Call Stack (most recent call first):
  cmake/XiphosDependencies.cmake:51 (find_package)
  CMakeLists.txt:76 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) at cmake/modules/FindBiblesync.cmake:25 (find_library):
  uninitialized variable 'BIBLESYNC_LIBRARY_DIRS'
Call Stack (most recent call first):
  cmake/XiphosDependencies.cmake:51 (find_package)
  CMakeLists.txt:76 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

I searched and the only instances I can find of BIBLESYNC_INCLUDE_DIRS and BIBLESYNC_LIBRARY_DIRS is in FindBiblesync.cmake where they are used. How are those variables supposed to be set?

mozmck commented 5 years ago

I finally got it to work by changing XiphosDependencies.cmake to use pkg_check_modules instead of find_package. It currently uses pkg_check_modules in WIN32 but find_package in Linux. That seems backwards since pkg_check_modules uses pkg_config, and that is native on linux distributions. Anyhow, I don't know what the correct fix is here - so I'll leave this issue open for now.

greg-hellings commented 5 years ago

It's likely that the install of Biblesync on your system installed the files to /usr/local. By default, pkg-config only looks in /usr. You could try reverting your change but exporting PKG_CONFIG_PATH=/usr/local/lib/pkgconfig before running CMake. That should tell pkg-config to also check the /usr/local prefix (or point it to wherever you installed the Biblesync files).

At least, I think that's the variable name...

mozmck commented 5 years ago

Well, I just checked and biblesync is installed in /usr - not /usr/local. Interestingly though, sword is installed in /usr/local and Xiphos configured and compiled just fine that way. I had problems at first with sword installed in /usr using autotools, so I tried using cmake and it put it in /usr/local by default and I just left it there.

mozmck commented 5 years ago

Just verified that the pkg-config default path includes /usr/local.

$ pkg-config --variable pc_path pkg-config /usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig

LAfricain commented 4 years ago

If you want I have created a deb for Ubuntu on my ppa. Is your problem related to this commit?

karlkleinpaste commented 4 years ago

trying to understand if this is still a problem. i intend to release B2.0.2 with (or briefly before) the next Xiphos, as much to refresh various distros' countdown-to-death counters, there will be no new capability. is there anything actually wrong with either FindBiblesync.cmake or biblesync itself?

timsoftgit commented 4 years ago

I had a similar issue, and it was that cmake was too old. checking Kubuntu 18.04 comes with cmake 3.10 which is below the 3.11 required. Specifying include dirs for imported modules doesn't work on earlier versions of cmake. You could try manually installing a newer version of cmake in a separate private location (by setting --prefix="~/tmpcmake"in the configure stage of compiling cmake), and setting (export) PATH to point to it before other paths, for eg. OLDPATH=$PATH; export PATH=~/tmpcmake:$PATH before trying to create xiphos package. once done, you could remove your private newer cmake and restore the PATH with export PATH=$OLDPATH

LAfricain commented 4 years ago

Or you can juste install the deb present in the Crosswire ppa: https://launchpad.net/~pkgcrosswire/+archive/ubuntu/ppa For 18.04 a new version of cmake is also present in this ppa.