shlomif / fc-solve

Freecell Solver - a C library for automatically solving Freecell and some other variants of card Solitaire
https://fc-solve.shlomifish.org/
MIT License
58 stars 12 forks source link

compile with brew for OSX #54

Closed mjobin-mdsol closed 4 years ago

mjobin-mdsol commented 4 years ago

I am trying to write a brew recipe to compile the freecell-solver on OSX.

cmake fails without an error. can you tell me what options I need to add?

class FreecellSolver < Formula
  desc "Solitaire Solver library"
  homepage "https://fc-solve.shlomifish.org/"
  url "https://fc-solve.shlomifish.org/downloads/fc-solve/freecell-solver-6.0.1.tar.xz"
  # https://fc-solve.shlomifish.org/downloads/fc-solve/freecell-solver-5.24.0.tar.xz
  sha256 "9f1a4c6d5c8ac54c6619b3b988efb5562d460cd048d33345e52a0c849fd0d9df"
  revision 1

  def install
    args = std_cmake_args
    args << "-DBUILD_TESTING=OFF"
    args << "-DKDE_INSTALL_QMLDIR=lib/qt5/qml"
    args << "-DKDE_INSTALL_PLUGINDIR=lib/qt5/plugins"
    args << "-DCMAKE_INSTALL_BUNDLEDIR=#{bin}"

    mkdir "build" do
      system "cmake", "..", *args
      system "make"
      system "make", "install"
      prefix.install "install_manifest.txt"
    end
  end
end
mjobin-mdsol commented 4 years ago

the cmake command executes like this

cmake
..
-DCMAKE_C_FLAGS_RELEASE=-DNDEBUG
-DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG
-DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/freecell-solver/6.0.1_1
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_FIND_FRAMEWORK=LAST
-DCMAKE_VERBOSE_MAKEFILE=ON
-Wno-dev
-DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
-DBUILD_TESTING=OFF
-DKDE_INSTALL_QMLDIR=lib/qt5/qml
-DKDE_INSTALL_PLUGINDIR=lib/qt5/plugins
-DCMAKE_INSTALL_BUNDLEDIR=/usr/local/Cellar/freecell-solver/6.0.1_1/bin
shlomif commented 4 years ago

Hi @mjobin-mdsol !

Thanks for your work.

the cmake command executes like this

cmake
..
-DCMAKE_C_FLAGS_RELEASE=-DNDEBUG
-DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG
-DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/freecell-solver/6.0.1_1
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_FIND_FRAMEWORK=LAST
-DCMAKE_VERBOSE_MAKEFILE=ON
-Wno-dev
-DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk
-DBUILD_TESTING=OFF
-DKDE_INSTALL_QMLDIR=lib/qt5/qml
-DKDE_INSTALL_PLUGINDIR=lib/qt5/plugins
-DCMAKE_INSTALL_BUNDLEDIR=/usr/local/Cellar/freecell-solver/6.0.1_1/bin

I don't expect it to succeed without the backslashes. For what it's worth, this command succeeds here - followed by a successful gmake (i'm on mageia v8 x86-64):

#! /bin/sh
#
# brew-build-fcs.sh

cmake \
.. \
-DCMAKE_C_FLAGS_RELEASE=-DNDEBUG \
-DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG \
-DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/freecell-solver/6.0.1_1 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_FIND_FRAMEWORK=LAST \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-Wno-dev \
-DCMAKE_OSX_SYSROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk \
-DBUILD_TESTING=OFF \
-DKDE_INSTALL_QMLDIR=lib/qt5/qml \
-DKDE_INSTALL_PLUGINDIR=lib/qt5/plugins \
-DCMAKE_INSTALL_BUNDLEDIR=/usr/local/Cellar/freecell-solver/6.0.1_1/bin \

What you can try is using dtruss or similar or lldb or gdb ( https://en.wikipedia.org/wiki/LLDB_(debugger) ) on the cmake to see why it fails without an error (which is abnormal behaviour). Then you can try using newer and/or older cmake versions.

Good luck, and thanks!

shlomif commented 4 years ago

@mjobin-mdsol : ping! any news?

mjobin-mdsol commented 4 years ago

I don't believe the missing backslashes were the problem. I think that just brew who display the command in multi-line for easy reading, but it runs as a string without multi-line breaker

I'm not too sure how to insert a debugger into a brew compile stack maybe I can actually add a ruby debugger, trace it until cmake gets called and see if I can capture the actual error message

mjobin-mdsol commented 4 years ago
-- Check if the system is big endian - little endian
CMake Warning at CMakeLists.txt:229 (find_package):
  By not providing "FindRinutils.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Rinutils",
  but CMake did not find one.

  Could not find a package configuration file provided by "Rinutils" with any
  of the following names:

    RinutilsConfig.cmake
    rinutils-config.cmake

  Add the installation prefix of "Rinutils" to CMAKE_PREFIX_PATH or set
  "Rinutils_DIR" to a directory containing one of the above files.  If
  "Rinutils" provides a separate development package or SDK, be sure it has
  been installed.

Can't locate Moo.pm in @INC (you may need to install the Moo module) (@INC contains: /usr/local/Cellar/perl/5.32.0/lib/perl5/site_perl/5.32.0/darwin-thread-multi-2level /usr/local/Cellar/perl/5.32.0/lib/perl5/site_perl/5.32.0 /usr/local/Cellar/perl/5.32.0/lib/perl5/5.32.0/darwin-thread-multi-2level /usr/local/Cellar/perl/5.32.0/lib/perl5/5.32.0 /usr/local/lib/perl5/site_perl/5.32.0) at /tmp/freecell-solver-20200916-32738-14zamxm/freecell-solver-6.0.1/scripts/gen-c-lookup-files.pl line 10.
BEGIN failed--compilation aborted at /tmp/freecell-solver-20200916-32738-14zamxm/freecell-solver-6.0.1/scripts/gen-c-lookup-files.pl line 10.
CMake Error at CMakeLists.txt:279 (MESSAGE):
  /usr/local/bin/perl
  /tmp/freecell-solver-20200916-32738-14zamxm/freecell-solver-6.0.1/scripts/gen-c-lookup-files.pl
  failed!

-- Configuring incomplete, errors occurred!
See also "/tmp/freecell-solver-20200916-32738-14zamxm/freecell-solver-6.0.1/build/CMakeFiles/CMakeOutput.log".
mjobin-mdsol commented 4 years ago

ok, looks like I can just cpan Moo

I wonder if that fits find in the recipe...

shlomif commented 4 years ago

ok, looks like I can just cpan Moo

I wonder if that fits find in the recipe...

cpan Moo is needed by the some of the Perl code (perhaps I should verify it is present though). "rinutils" is https://github.com/shlomif/rinutils/ which is used by the C code and should also be installed (albeit I recall bundling it inside the source tarball so it may not be separately needed).

shlomif commented 4 years ago

@mjobin-mdsol : hi! I checked and rinutils is indeed included in the source tarball.

mjobin-mdsol commented 4 years ago

next two errors

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'random2'
CMake Warning at CMakeLists.txt:1008 (MESSAGE):
  Could not find the python3's random2 module - please install it.

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pysol_cards'
CMake Error at CMakeLists.txt:997 (MESSAGE):
  Could not find the python3's pysol_cards module - please install it.
Call Stack (most recent call first):
  CMakeLists.txt:1011 (ASSERT_PYTHON3_MODULE_PRESENCE)
mjobin-mdsol commented 4 years ago

dependencies on both python and perl, this must be a fun project to maintain ;)

mjobin-mdsol commented 4 years ago

ok, I got it to build locally, I still have an issue with my homebrew recipe, but its clearly not related to fc-solve

thanks for your help

this is my updated recipe.

https://invent.kde.org/mjobin/homebrew-kde/-/blob/master/Formula/freecell-solver.rb

shlomif commented 4 years ago

dependencies on both python and perl, this must be a fun project to maintain ;)

Heh, heh. Use the right tool for the job... And it is fun to maintain.

shlomif commented 4 years ago

ok, I got it to build locally, I still have an issue with my homebrew recipe, but its clearly not related to fc-solve

thanks for your help

this is my updated recipe.

https://invent.kde.org/mjobin/homebrew-kde/-/blob/master/Formula/freecell-solver.rb

Great! Thanks for sharing the recipe and updating me about the progress. You're welcome. Good luck in making more progress.