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

CMake files do not automatically download the libraries when ran #16

Open
Bambofy opened this issue Nov 25, 2019 · 26 comments
Open

CMake files do not automatically download the libraries when ran #16

Bambofy opened this issue Nov 25, 2019 · 26 comments

Comments

@Bambofy
Copy link

Bambofy commented Nov 25, 2019

Hi,

The files FindSol.cmake and FindRaylib.cmake do not automatically download the libraries on OS X 10.15.1.

If you change the flag QUIET to VERBOSE it fails but then carries on to download and building steps:


find_package(sol 3.0 VERBOSE)
if (NOT sol_FOUND)
  include(FetchContent)
  FetchContent_Declare(
    sol
    GIT_REPOSITORY https://github.com/ThePhD/sol2.git
    GIT_TAG 6d4a5d3ef66d605c54093edb673c14e373969a08
  )
  FetchContent_GetProperties(sol)
  if (NOT sol_POPULATED) # Have we downloaded sol2 yet?
    set(FETCHCONTENT_QUIET NO)
    FetchContent_Populate(sol)
    add_subdirectory(${sol_SOURCE_DIR} ${sol_BINARY_DIR})
    set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${sol_SOURCE_DIR}/cmake" "${sol_SOURCE_DIR}/cmake/Modules")
  endif()
endif()

The verbose flag is not valid so it carries on, i installed raylib view brew but it didn't find the libraries in the first place.

@Bambofy Bambofy changed the title CMake files do not automatically download when cmake ran CMake files do not automatically download the libraries when ran Nov 25, 2019
@Bambofy
Copy link
Author

Bambofy commented Nov 25, 2019

Even after the libraries are downloaded and built, i get this error:


CMake Error at cmake/FindRaylib.cmake:1 (find_package):
  find_package called with invalid argument "VERBOSE"
Call Stack (most recent call first):
  bin/CMakeLists.txt:1 (find_package)


-- Populating raylib
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/richardbamford/Documents/GitHub/RaylibLuaSol/raylib-lua-sol/build/_deps/raylib-subbuild
[ 11%] Performing update step for 'raylib-populate'
[ 22%] No configure step for 'raylib-populate'
[ 33%] No build step for 'raylib-populate'
[ 44%] No install step for 'raylib-populate'
[ 55%] No test step for 'raylib-populate'
[ 66%] Completed 'raylib-populate'
[100%] Built target raylib-populate
-- Testing if -Werror=pointer-arith can be used -- Failed
-- Testing if -Werror=implicit-function-declaration can be used -- Failed
-- Testing if -fno-strict-aliasing can be used -- Failed
-- Testing if file system supports symlinks
-- Testing if file system supports symlinks -- supported
-- Using raylib's GLFW
-- Using Cocoa for window creation
-- Audio Backend: miniaudio
CMake Warning (dev) at build/_deps/raylib-src/src/CMakeLists.txt:72 (MESSAGE):
  OpenGL is deprecated starting with macOS 10.14 (Mojave)!
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Building raylib static library
-- Compiling with the flags:
--   PLATFORM=PLATFORM_DESKTOP
--   GRAPHICS=GRAPHICS_API_OPENGL_33
CMake Error at cmake/FindSol.cmake:1 (find_package):
  find_package called with invalid argument "VERBOSE"
Call Stack (most recent call first):
  bin/CMakeLists.txt:2 (find_package)


-- Populating sol
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/richardbamford/Documents/GitHub/RaylibLuaSol/raylib-lua-sol/build/_deps/sol-subbuild
Scanning dependencies of target sol-populate
[ 11%] Creating directories for 'sol-populate'
[ 22%] Performing download step (git clone) for 'sol-populate'
Cloning into 'sol-src'...
Note: checking out '6d4a5d3ef66d605c54093edb673c14e373969a08'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 6d4a5d3e Fix library version to be proper
[ 33%] No patch step for 'sol-populate'
[ 44%] Performing update step for 'sol-populate'
[ 55%] No configure step for 'sol-populate'
[ 66%] No build step for 'sol-populate'
[ 77%] No install step for 'sol-populate'
[ 88%] No test step for 'sol-populate'
[100%] Completed 'sol-populate'
[100%] Built target sol-populate
CMake Error at /usr/local/Cellar/cmake/3.15.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find Lua (missing: LUA_LIBRARIES LUA_INCLUDE_DIR) (Required is at
  least version "5.3")
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.15.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  /usr/local/Cellar/cmake/3.15.4/share/cmake/Modules/FindLua.cmake:231 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  bin/CMakeLists.txt:3 (find_package)


-- Configuring incomplete, errors occurred!
See also "/Users/richardbamford/Documents/GitHub/RaylibLuaSol/raylib-lua-sol/build/CMakeFiles/CMakeOutput.log".
See also "/Users/richardbamford/Documents/GitHub/RaylibLuaSol/raylib-lua-sol/build/CMakeFiles/CMakeError.log".

@Bambofy

This comment has been minimized.

@RobLoach
Copy link
Owner

Interesting. which version of CMake are you on?

@Bambofy
Copy link
Author

Bambofy commented Nov 26, 2019

It is version "CMake 3.16.0-rc4" OS X

@Bambofy
Copy link
Author

Bambofy commented Nov 27, 2019

Hey, the CMake files are kinda broken, it took me ages to get it compiling but i managed to wrangle it. I had to replace the version of SOL with the latest version (21c030933f0c470ca328cdec51d847968370cd23) and also, linking the project raylib-lua-sol to the static lua53.lib to compile, and then moving the lua53.dll to the folder at runtime.

Here's a release
Release.zip
build for windows 64-bit!

@RobLoach
Copy link
Owner

Ah! Good find.

@RobLoach
Copy link
Owner

RobLoach commented Dec 1, 2019

Strange that sol doesn't pack-in Lua. Is there a cmake option that we have to pass to SOL to make it work?

Made this PR, but it isn't working for me right meow #17

@RobLoach RobLoach mentioned this issue Dec 1, 2019
@Bambofy
Copy link
Author

Bambofy commented Dec 2, 2019

Yeah there is something funny going on with sol, it really doesn't like to build. I can't remember what the cmake options were but i recall being able to use luajit with sol 😄

@RobLoach
Copy link
Owner

Just updated a few things. Mind having another try at it?

@Bambofy
Copy link
Author

Bambofy commented Feb 28, 2020

Just updated a few things. Mind having another try at it?

Will do

@RobLoach
Copy link
Owner

It still doesn't auto-download Lua, which may be a thing we want to add. a cmake/Lua.cmake

@Bambofy

This comment has been minimized.

@RobLoach
Copy link
Owner

➜  ~ cmake --version
cmake version 3.13.2

RobLoach added a commit that referenced this issue Mar 22, 2020
@xharris
Copy link

xharris commented Apr 3, 2020

crash

cmake-gui crashes for me. Through CLI it makes empty bin and CMakeFiles and does nothing else.

I only have these issues on Windows. On Ubuntu all I had to do was install lua5.3, liblua5.3-dev, xorg-dev, and libglu1-mesa-dev (for some weird xrandr dependency) and it built fine. I really wish I could build on Windows though..

@RobLoach
Copy link
Owner

RobLoach commented Apr 3, 2020

Might be a good idea to move from ExternalProject to git submodules. I'm assuming git is available?

@xharris
Copy link

xharris commented Apr 3, 2020

I'm assuming git is available?

Yes

@RobLoach
Copy link
Owner

RobLoach commented Apr 3, 2020

Great! I'll hope to switch it over to a submodule. Seems ExternalProject isn't that stable across platforms. Thanks so much or the investigation here.

@xharris
Copy link

xharris commented Apr 3, 2020

After lots of messing around, I've gotten this to build successfully on Windows 10 with Visual Studio 2017 and cmake 3.17 . I'm not sure which changes I made were necessary and unnecessary but I'll put them all in a fork. These changes are ONLY FOR WINDOWS since rayliblua-sol seems to build on Ubuntu fine (and probably Mac as well).

Hopefully I'm not forgetting anything:

Building Lua 5.3. Helpful page here on how to do that on Windows.

  • Lua 5.3 needs to be built and placed in raylib-lua-sol/lib with the following structure
│   CMakeLists.txt
│   libraylib-lua-sol.cpp
│
└───lua
    │   lua53.lib
    │
    └───include
            lauxlib.h
            lua.h
            lua.hpp
            luaconf.h
            lualib.h

Building everything:

  1. Open Visual Studio 2017 (make sure you have CMake tools)
  2. File > Open > Folder: raylib-lua-sol
  3. CMake > Install > raylib
  4. CMake > Build All
  5. When it's finished the output window will show a bunch of "pdb not found" lines and then "exited with code 1". This is good. Scrolling to the top of the Output window, it will show a long path to "raylib-lua-sol.exe" which you can copy to any folder and drop your lua files onto it.

@uSources
Copy link

uSources commented Apr 8, 2020

Hi @RobLoach,
Im try to build several times, but always gives me find_package error.

Any chance to have prebuild binaries?
I need Win10 x64 build

Thanks

@xharris
Copy link

xharris commented Apr 8, 2020

@uSources Have you tried the steps/fork I posted above your comment? I was having the same issue.

@RobLoach
Copy link
Owner

RobLoach commented Apr 8, 2020

If you get a VS project up, I'd love to see it added 😉

@uSources
Copy link

uSources commented Apr 9, 2020

@xharris I try, but i dont understand to much about c/c++ tools, maybe i can ask to a friend to help me.

Thanks

@RobLoach
Copy link
Owner

RobLoach commented Apr 9, 2020

I've created a new Pull Request to bring all dependencies in locally: #24 ..... This means we will be able to target a specific version of Lua, and not have to worry about FetchProject not working.

Would love some help testing on it! There is a new issue with Sol not defining the objects correctly, but I think that excited for a while... Hope to add Windows to the automated testing too.

Just make sure you bring down the submodules too... git submodule update --init

@uSources
Copy link

uSources commented Apr 9, 2020

Hi, i have cloned "submodule" branch of the repo. Now finds lua, raylib and sol2 correctly. That its perfect!

I generete "MINGW32" template with cmake correctly but when i try to comple throws a error in libraylib-lua-sol dependecy

Output:

Scanning dependencies of target lua
[  1%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lapi.c.obj
[  3%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lcode.c.obj
[  4%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lctype.c.obj
[  6%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/ldebug.c.obj
[  7%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/ldo.c.obj
[  9%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/ldump.c.obj
[ 11%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lfunc.c.obj
[ 12%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lgc.c.obj
[ 14%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/llex.c.obj
[ 15%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lmem.c.obj
[ 17%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lobject.c.obj
[ 19%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lopcodes.c.obj
[ 20%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lparser.c.obj
[ 22%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lstate.c.obj
[ 23%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lstring.c.obj
[ 25%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/ltable.c.obj
[ 26%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/ltm.c.obj
[ 28%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lundump.c.obj
[ 30%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lvm.c.obj
[ 31%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lzio.c.obj
[ 33%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lauxlib.c.obj
[ 34%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lbaselib.c.obj
[ 36%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lcorolib.c.obj
[ 38%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/ldblib.c.obj
[ 39%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/liolib.c.obj
[ 41%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lmathlib.c.obj
[ 42%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/loslib.c.obj
[ 44%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lstrlib.c.obj
[ 46%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/ltablib.c.obj
[ 47%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/lutf8lib.c.obj
[ 49%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/loadlib.c.obj
[ 50%] Building C object CMakeFiles/lua.dir/vendor/lua-5.3.5/linit.c.obj
[ 52%] Linking C static library liblua.a
[ 52%] Built target lua
Scanning dependencies of target glfw_objlib
[ 53%] Building C object vendor/raylib/src/external/glfw/src/CMakeFiles/glfw_objlib.dir/context.c.obj
[ 55%] Building C object vendor/raylib/src/external/glfw/src/CMakeFiles/glfw_objlib.dir/init.c.obj
[ 57%] Building C object vendor/raylib/src/external/glfw/src/CMakeFiles/glfw_objlib.dir/input.c.obj
[ 58%] Building C object vendor/raylib/src/external/glfw/src/CMakeFiles/glfw_objlib.dir/monitor.c.obj
[ 60%] Building C object vendor/raylib/src/external/glfw/src/CMakeFiles/glfw_objlib.dir/vulkan.c.obj
[ 61%] Building C object vendor/raylib/src/external/glfw/src/CMakeFiles/glfw_objlib.dir/window.c.obj
[ 63%] Building C object vendor/raylib/src/external/glfw/src/CMakeFiles/glfw_objlib.dir/win32_init.c.obj
[ 65%] Building C object vendor/raylib/src/external/glfw/src/CMakeFiles/glfw_objlib.dir/win32_joystick.c.obj
[ 66%] Building C object vendor/raylib/src/external/glfw/src/CMakeFiles/glfw_objlib.dir/win32_monitor.c.obj
[ 68%] Building C object vendor/raylib/src/external/glfw/src/CMakeFiles/glfw_objlib.dir/win32_time.c.obj
[ 69%] Building C object vendor/raylib/src/external/glfw/src/CMakeFiles/glfw_objlib.dir/win32_thread.c.obj
[ 71%] Building C object vendor/raylib/src/external/glfw/src/CMakeFiles/glfw_objlib.dir/win32_window.c.obj
[ 73%] Building C object vendor/raylib/src/external/glfw/src/CMakeFiles/glfw_objlib.dir/wgl_context.c.obj
[ 74%] Building C object vendor/raylib/src/external/glfw/src/CMakeFiles/glfw_objlib.dir/egl_context.c.obj
[ 76%] Building C object vendor/raylib/src/external/glfw/src/CMakeFiles/glfw_objlib.dir/osmesa_context.c.obj
[ 76%] Built target glfw_objlib
Scanning dependencies of target glfw
[ 77%] Linking C static library libglfw3.a
[ 77%] Built target glfw
Scanning dependencies of target raylib_static
[ 79%] Building C object vendor/raylib/src/CMakeFiles/raylib_static.dir/core.c.obj
[ 80%] Building C object vendor/raylib/src/CMakeFiles/raylib_static.dir/models.c.obj
[ 82%] Building C object vendor/raylib/src/CMakeFiles/raylib_static.dir/raudio.c.obj
[ 84%] Building C object vendor/raylib/src/CMakeFiles/raylib_static.dir/shapes.c.obj
[ 85%] Building C object vendor/raylib/src/CMakeFiles/raylib_static.dir/text.c.obj
[ 87%] Building C object vendor/raylib/src/CMakeFiles/raylib_static.dir/textures.c.obj
[ 88%] Building C object vendor/raylib/src/CMakeFiles/raylib_static.dir/utils.c.obj
[ 90%] Linking C static library libraylib_static.a
[ 90%] Built target raylib_static
Scanning dependencies of target libraylib-lua-sol
[ 92%] Building CXX object lib/CMakeFiles/libraylib-lua-sol.dir/libraylib-lua-sol.cpp.obj
In file included from C:/Users/usour/OneDrive/Desktop/raylib-lua-sol/vendor/sol2/include/sol/forward.hpp:31:0,
                 from C:/Users/usour/OneDrive/Desktop/raylib-lua-sol/vendor/sol2/include/sol/sol.hpp:47,
                 from C:/Users/usour/OneDrive/Desktop/raylib-lua-sol/include/raylib-lua-sol.hpp:5,
                 from C:\Users\usour\OneDrive\Desktop\raylib-lua-sol\lib\libraylib-lua-sol.cpp:11:
C:/Users/usour/OneDrive/Desktop/raylib-lua-sol/vendor/sol2/include/sol/demangle.hpp:48:29:   in constexpr expansion of  std::basic_string_view<char>(((const char*)"{anonymous}"))'
C:/raylib/mingw/lib/gcc/i686-w64-mingw32/7.2.0/include/c++/string_view:100:58: error: call to non-constexpr function 'static std::size_t std::char_traits<char>::length(const char_type*)'
       : _M_len{__str == nullptr ? 0 : traits_type::length(__str)},
                                       ~~~~~~~~~~~~~~~~~~~^~~~~~~
mingw32-make[2]: *** [lib\CMakeFiles\libraylib-lua-sol.dir\build.make:80: lib/CMakeFiles/libraylib-lua-sol.dir/libraylib-lua-sol.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:1149: lib/CMakeFiles/libraylib-lua-sol.dir/all] Error 2
mingw32-make: *** [Makefile:179: all] Error 2

@RobLoach
Copy link
Owner

RobLoach commented Apr 10, 2020

I've also setup Windows testing on GitHub Actions for this. Here is the specific error you've found....

[ 92%] Building CXX object lib/CMakeFiles/libraylib-lua-sol.dir/libraylib-lua-sol.cpp.obj
In file included from C:/Users/usour/OneDrive/Desktop/raylib-lua-sol/vendor/sol2/include/sol/forward.hpp:31:0,
                 from C:/Users/usour/OneDrive/Desktop/raylib-lua-sol/vendor/sol2/include/sol/sol.hpp:47,
                 from C:/Users/usour/OneDrive/Desktop/raylib-lua-sol/include/raylib-lua-sol.hpp:5,
                 from C:\Users\usour\OneDrive\Desktop\raylib-lua-sol\lib\libraylib-lua-sol.cpp:11:
C:/Users/usour/OneDrive/Desktop/raylib-lua-sol/vendor/sol2/include/sol/demangle.hpp:48:29:   in constexpr expansion of  std::basic_string_view<char>(((const char*)"{anonymous}"))'
C:/raylib/mingw/lib/gcc/i686-w64-mingw32/7.2.0/include/c++/string_view:100:58: error: call to non-constexpr function 'static std::size_t std::char_traits<char>::length(const char_type*)'
       : _M_len{__str == nullptr ? 0 : traits_type::length(__str)},
                                       ~~~~~~~~~~~~~~~~~~~^~~~~~~
mingw32-make[2]: *** [lib\CMakeFiles\libraylib-lua-sol.dir\build.make:80: lib/CMakeFiles/libraylib-lua-sol.dir/libraylib-lua-sol.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:1149: lib/CMakeFiles/libraylib-lua-sol.dir/all] Error 2
mingw32-make: *** [Makefile:179: all] Error 2

On GitHub Actions Windows testing over at #27 , I'm getting this error...

D:\a\raylib-lua-sol\raylib-lua-sol\include\raylib-lua-sol.hpp(664): message : see reference to function template instantiation 'sol::state_view &sol::state_view::set_function<double(__cdecl &)(void),const char(&)[8]>(Key,double (__cdecl &)(void))' being compiled [D:\a\raylib-lua-sol\raylib-lua-sol\build\bin\raylib-lua-sol.vcxproj]
          with
          [
              Key=const char (&)[8]
          ]
  raylib-lua-sol.vcxproj -> D:\a\raylib-lua-sol\raylib-lua-sol\build\bin\Debug\raylib-lua-sol.exe
  Building Custom Rule D:/a/raylib-lua-sol/raylib-lua-sol/tests/CMakeLists.txt
  raylib-lua-sol_test.cpp
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\winuser.h(4405,1): error C2733: 'UnhideWindow': you cannot overload a function with 'extern "C"' linkage [D:\a\raylib-lua-sol\raylib-lua-sol\build\tests\raylib-lua-sol_test.vcxproj]
D:\a\raylib-lua-sol\raylib-lua-sol\vendor\raylib\src\raylib.h(881,12): message : see declaration of 'UnhideWindow' [D:\a\raylib-lua-sol\raylib-lua-sol\build\tests\raylib-lua-sol_test.vcxproj]
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\um\winuser.h(4597,1): error C2733: 'CloseWindow': you cannot overload a function with 'extern "C"' linkage [D:\a\raylib-lua-sol\raylib-lua-sol\build\tests\raylib-lua-sol_test.vcxproj]
D:\a\raylib-lua-sol\raylib-lua-sol\vendor\raylib\src\raylib.h(874,12): message : see declaration of 'CloseWindow' [D:\a\raylib-lua-sol\raylib-lua-sol\build\tests\raylib-lua-sol_test.vcxproj]

@uSources
Copy link

Hi, yes with "ninja" compiler im getting the same error, so i created makefile for mingw64 using cmake -G "MinGW Makefile"

Maybe they give us different errors for using different compilers?

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

4 participants