joelkoz / xtwsd

Json Tide and Current Prediction Web Service for XTide
GNU General Public License v3.0
20 stars 4 forks source link

CMake produces Makefile expecting libtcd.a/libxtide.so #7

Closed ayan4m1 closed 2 years ago

ayan4m1 commented 2 years ago

I have tried everything I can think of, but I'm not very familiar with CMake so this is out of my depth...

Followed the build instructions, only difference is I used the Debian libboost-system-dev package to provide Boost 1.74 instead of building it from source.

Running cmake -Wno-dev .. from the xtwsd/build directory gives me:

-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.70.0") found components: system
-- Using the single-header code from /home/ayan4m1/xtwsd/dependencies/nlohmann_json/json/single_include/
Include dirs used in for compiling:
-- include_dir='/home/ayan4m1/xtwsd/build/libtcd-2.2.7/src/project_libtcd-build'
-- include_dir='/usr/include'
-- include_dir='/usr/include'
-- include_dir='/home/ayan4m1/xtwsd/build/xtide-2.15.2/src/project_xtide'
-- include_dir='/home/ayan4m1/xtwsd/build/xtide-2.15.2/src/project_xtide-build/libxtide'
-- include_dir='/usr/include'
-- include_dir='/home/ayan4m1/xtwsd/dependencies/fifo_map/fifo_map/src'
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.53") found components: system
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ayan4m1/xtwsd/build

Then running make gives:

[  8%] Built target nos2xt
[ 48%] Built target served
make[2]: *** No rule to make target 'libtcd-2.2.7/src/project_libtcd-build/.libs/libtcd.a', needed by 'xtwsd'.  Stop.
make[1]: *** [CMakeFiles/Makefile2:470: CMakeFiles/xtwsd.dir/all] Error 2
make: *** [Makefile:171: all] Error 2

I see a libtcd-2.2.7/src directory but it has no source code in it. Same for the xtide-2.15.2 directory in my build dir.

I can manually compile libtcd and xtide fine, are you aware of a way I could modify the build script to use those directories instead? Anything else that might help resolve the issue is appreciated.

joelkoz commented 2 years ago

libtcd is the "Tide Constiuent Database" file required by xtide. The source for it is available here. It looks like that file has been updated from "rev 2" to "rev 3", and the storage method has changed. Modify the CMakeLists.txt file and change libtcd-2.2.7-r2.tar.bz2 to libtcd-2.2.7-r3.tar.xz and see if that makes a difference. I'll take a closer look at the build file and see if there are any other changes that need to be made to get it to compile.

joelkoz commented 2 years ago

It looks like the source code for XTide has been updated also. Another change necessary to CMakeLists.txt is changing xtide-2.15.2.tar.bz2 to xtide-2.15.3.tar.xz and any references to 2.15.2 to 2.15.3

joelkoz commented 2 years ago

So, I just tried to reproduce this on my machine, but I couldn't, as even though there are new versions of those files, the old ones are still available for download, and my CMake downloaded them and built them. Did you say your /build/libtcd-2.2.7/src was empty? Mine contains a directory named project_libtcd, and the source was extracted to that dir.

Note that I've only build this on Mac OS X and on a Raspberry Pi. I've not tried on any other Linux distros, so there may be issues in the build scripts.

joelkoz commented 2 years ago

What do you see when you type:

cmake --version

I get cmake version 3.2.1

ayan4m1 commented 2 years ago

cmake version 3.18.4

Right, I tried wgetting the URLs in the CMakeConfig and they download / hash to the same md5sum as in the config file, but cmake doesn't actually seem to be performing those steps. I'll try to look into it a bit more on my end. Thanks for the quick response!

ayan4m1 commented 2 years ago

So, I was able to make some progress... After manually building the libtcd and xtide outside the build/ dir and copying the .libs/libtcd.a and .libs/libxtide.so files into the places it was expecting, I was able to get it to build when running make. The strange thing is, it seems like after I placed the missing files there, it went out and did the download/extract/compile of libtcd/xtide like I wanted from the beginning.

ayan4m1 commented 2 years ago

Closing this as my primary issue is resolved, there appears to be a bug/issue related to the cmake version I am using. Trying this install on an Pi running buster works as expected; libtcd and xtide are fetched and compiled by cmake.