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

Malformed path for Qt5::Core in build using macOS homebrew. Update build instructions? #2177

Closed
kellenff opened this issue Jan 28, 2019 · 22 comments

Comments

@kellenff
Copy link

kellenff commented Jan 28, 2019

Hello,

With the next branch checked out, I'm following the build instructions for macOS, and CMake is failing to build with the following error:

CMake Error at /usr/local/lib/cmake/Qt5Core/Qt5CoreConfig.cmake:15 (message):
  The imported target "Qt5::Core" references the file

     "/usr/local/.//mkspecs/macx-clang"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/local/lib/cmake/Qt5Core/Qt5CoreConfigExtras.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /usr/local/lib/cmake/Qt5Core/Qt5CoreConfigExtras.cmake:50 (_qt5_Core_check_file_exists)
  /usr/local/lib/cmake/Qt5Core/Qt5CoreConfig.cmake:169 (include)
  CMakeLists.txt:50 (find_package)

I'm running macOS High Sierra version 10.13.6 (build 17G4015)

@gcp
Copy link
Member

gcp commented Feb 1, 2019

This is a macOS homebrew bug, it doesn't add the qt5 binaries to the path correctly.

Can be worked around by manually adding /usr/local/opt/qt5/bin to the PATH.

@gcp gcp added the invalid label Feb 1, 2019
@gcp
Copy link
Member

gcp commented Feb 1, 2019

Closing as AFAIK this can't be fixed on our side.

@kellenff
Copy link
Author

kellenff commented Feb 1, 2019

@gcp hmm... manually adding the qt5 bin path to my PATH did not work. Upon further inspection, it looks like it might be a bug in Qt5 itself, as it is referencing the malformed path.

Thanks!

@gcp
Copy link
Member

gcp commented Feb 2, 2019

Wipe out the build dir after fixing the PATH and rerun cmake.

@kellenff
Copy link
Author

kellenff commented Feb 2, 2019

That worked for me, thanks! Would it be possible to add this to the macOS build instructions, as Homebrew is probably how users will be installing QT5

@Hersmunch
Copy link
Member

Ah I might have closed this prematurely. Apologies.
@wonderingabout you might be interested re building instructions.

@Hersmunch Hersmunch reopened this Feb 3, 2019
@Hersmunch Hersmunch changed the title Malformed path for Qt5::Core in build Malformed path for Qt5::Core in build using macOS homebrew. Update build instructions? Feb 3, 2019
@wonderingabout
Copy link
Contributor

wonderingabout commented Feb 3, 2019

@Hersmunch

thanks for remembering

i dont use mac myself (i'm on linux), but i had already written these clearer instructions quite some time ago : #2071

i added specific mac instructions based on the feedback of mac users, see the PR discussion (i documented the links of the discussion and summarized it)

the PR was then kinda forgotten for some reason

@gcp gcp removed the invalid label Feb 4, 2019
@gcp
Copy link
Member

gcp commented Feb 4, 2019

That worked for me, thanks! Would it be possible to add this to the macOS build instructions, as Homebrew is probably how users will be installing QT5

Should probably try to find the bug filed against Homebrew and link to that.

I'd rather not have done this but this issue has been there for so long it looks like they're unable to fix it.

@wonderingabout
Copy link
Contributor

so, what do we do with the mac instructions ?

put them back to default and ignore the mac users feedback ?

personally both are fine to me because i dont use mac, but if it really helps to add these mac specific instructions i'd like to add them even if we remove them later on

@kellenff
Copy link
Author

kellenff commented Feb 4, 2019

I think it makes sense that if a specific package manager is already mentioned in the build instructions, then other steps which are necessary when using the same should also be included. For example, these instructions would help new users from encountering the same problem I did:

# Clone github repo
git clone https://github.com/gcp/leela-zero
cd leela-zero
git submodule update --init --recursive

# Install build depedencies using homebrew
brew install boost cmake qt5

# Use stand alone directory to keep source dir clean
mkdir build && cd build

# include QT5 in the PATH
PATH="$(brew --prefix qt5)/bin:$PATH" cmake ..
cmake --build .
./tests
curl -O https://zero.sjeng.org/best-network
./leelaz --weights best-network

I've added qt5 to the brew install step and used the brew --prefix command to ensure that the correct path is used if the user has changed the path which homebrew installs into from the default.

@wonderingabout
Copy link
Contributor

except that qt5 is needed only if you want to use autogtp @rakenodiax

if someone only wants leelaz without wanting to contribute, theres no need to bother him with qt5
i'll try to see how i can implement that in my PR if it can help 👍

ty for the feedback

@wonderingabout
Copy link
Contributor

@kellenff
Copy link
Author

kellenff commented Feb 4, 2019

@wonderingabout Thanks! Moving there

@wonderingabout
Copy link
Contributor

i'll push a modification, tell me if its ok for you

@kellenff
Copy link
Author

kellenff commented Feb 4, 2019

It looks good. You might want to use the brew --prefix qt5 command in case users are using a non-default homebrew prefix directory.

@wonderingabout
Copy link
Contributor

wonderingabout commented Feb 4, 2019

@kellenff
Copy link
Author

kellenff commented Feb 4, 2019

Wouldn't the PATH have to either be exported, or at the beginning of the cmake .. command? So it would be PATH="$(brew --prefix qt5)/bin:$PATH" cmake ..

i dont use mac so i'm clueless about how to use brew (i'm on ubuntu)

No worries, I appreciate the responsiveness!

@wonderingabout
Copy link
Contributor

wonderingabout commented Feb 4, 2019

@rakenodiax adding path way sooner or just sooner is the same,

but again some mac users will want only leelaz and not autogtp, so since they dont want to contribute no need to bother them with qt5 (and it seems messy on mac)

welcome, i appreciate yours too 👍

@wonderingabout
Copy link
Contributor

@rakenodiax #2300 addresses this, and i hope fixes it 👍

@kellenff
Copy link
Author

kellenff commented Apr 9, 2019

@wonderingabout Looks great! Thanks! 👍

@kellenff kellenff closed this as completed Apr 9, 2019
@bcordoba555
Copy link

Ok, it is June 19 2019 and I am trying to install leela-zero 0.17 on macos 10.14.5.

I followed the instructions in the README files, which do not match the revised instructions shown in this thread BTW.

Homebrew did not install Qt5 so I installed it manually. (I did not know it was only needed for autogtp, which I did not know what it did until reading this thread).

Anyways, I am not a programmer and I don't know Unix well either so this is hard for this Go player on macos to fix.

My issue is that Qt5 is not in /usr/local/Cellar since I manually installed it.

Here is the error log after I run "cmake .." (inside the build folder as instructed by the README included with 0.17.


Benoits-MacBook-Pro:build Benoit$ cmake ..
-- Boost version: 1.70.0
-- Found the following Boost libraries:
-- program_options
-- filesystem
-- Using built-in matrix library.
CMake Warning at CMakeLists.txt:50 (find_package):
By not providing "FindQt5Core.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5Core", but
CMake did not find one.

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

Qt5CoreConfig.cmake
qt5core-config.cmake

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

CMake Warning at CMakeLists.txt:129 (message):
Qt is not found, build for autogtp and validation is disabled

-- Configuring done
-- Generating done
-- Build files have been written to: /Users/Benoit/Go/Lizzie/L06/leela-zero/build


Thank you SO MUCH for all the contributors to make this project come to light. It is exciting!

I still have not been able to achieve a successful install on macos for two years now).

Thank you for the help!

Benoît

@RehmatSChawla
Copy link

@bcordoba555 You can try running find . -name Qt5CoreConfig.cmake inside the Qt5Core installation directories to find where the file is and provide that as Qt5Core_DIR. I faced a similar issue when trying to use my brew-installed qt@5 to install Geant4:

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

Qt5Config.cmake
qt5-config.cmake

And using the find command, located the first file to be in /opt/homebrew/Cellar/qt@5/5.15.12/lib/cmake/Qt5. I provided this as the Qt5_DIR and the installation proceeded.

For posterity, I will record my solution to the original problem as well. I too faced the issue of the cmake files for qt5 listing several files that did not exist, including /opt/homebrew/.//mkspecs/macx-clang and some other files in /opt/homebrew/plugins - a directory which does not exist.

Combining information I found across various issues (including this one), I figured out that there was an error with some environment variable used by the cmake files, which was pointing to /opt/homebrew/ when it should have been pointing to /opt/homebrew/Cellar/qt@5/5.15.12/, where both the mkspecs and plugins directories were to be found (again, the find command helped me track them down). I symlinked the directories to allow the installation to proceed smoothly:

$ ln -s /opt/homebrew/Cellar/qt@5/5.15.12/mkspecs /opt/homebrew/mkspecs
$ ln -s /opt/homebrew/Cellar/qt@5/5.15.12/plugins /opt/homebrew/plugins

Note that you may need to use sudo to execute ln.

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

6 participants