Linux Cmake build

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Linux Cmake build

Postby arpio » Thu Oct 25, 2018 10:33 am

The latest sources don't build on Linux right now. I started with the files from here viewtopic.php?f=9&t=9282 and made some changes.

Here is my fork https://github.com/arpio/newton-dynamics It builds now on Linux with the demos. But not all the demos are working and I'm not sure if its because of the changes I made.

Also added an option to build shared or static libs, default is static and affects only Linux. A build out of source tree is also possible. The libs will be in the BUILD_DIRECTORY/lib.

Actually the changes should not affect the windows part but still would be nice if someone could test my fork so I can make a pull request

I always only used the cmake build and never had to change anything. So if there is still something wrong or you have any suggestions just let me know.
arpio
 
Posts: 23
Joined: Wed Oct 24, 2018 4:33 pm

Re: Linux Cmake build

Postby Julio Jerez » Thu Oct 25, 2018 1:51 pm

al right I merged all of the cmake scripts, Very nice an clean.
I tested the window build and it work fine,
can you check it out to see if I did not mixed or missed anything.

Also I did see the dProfiler is no optional I will make so that is optional tonight.

for that I need to make some change in some headers so that is doe no assume the define is in some header, instead is added as a command line compiler option.

all in all it seem very nice.
It will be cool if Linux people give some feedback and or recommendations.

Thank up very much,
this is a great contribution to the engine.
Julio Jerez
Moderator
Moderator
 
Posts: 10993
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Linux Cmake build

Postby arpio » Thu Oct 25, 2018 2:51 pm

I have little changes in the source files too.

DemoEntityManager.cpp CleanUp function
#ifdef _MSC_VER
GetModuleFileNameA(NULL, plugInPath, 256);
#endif

Standardjoints.cpp
https://github.com/arpio/newton-dynamic ... 925a97af52

Dgtypes.h
https://github.com/arpio/newton-dynamic ... e944d6715e

Also in the damoentitymanager maybe set the scene0 as default. The current default scene crashes at start up.
arpio
 
Posts: 23
Joined: Wed Oct 24, 2018 4:33 pm

Re: Linux Cmake build

Postby Julio Jerez » Fri Oct 26, 2018 9:39 am

ok I think I god those compatibility issues fixed now.
if you sync and try the linux build let use see what else is broken.
The profile is optional for windows and the Unix Build does consider it, even if is on.

and some point will need to the eliminate GENERATE_DLL and use
NEWTON_BUILD_SHARED_LIBRAIES intead for all target nwo tey are redundant but it ok for now.

that change should ally affect the windows part.

so fart it seems pretty good.
Julio Jerez
Moderator
Moderator
 
Posts: 10993
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Linux Cmake build

Postby Boost113 » Sat Oct 27, 2018 8:26 am

Hi,

I'm still having issues with cmake on Linux.

The requested cmake version is very new and I don't see anything that actually needs that new cmake.
So to actually get everything to work I copy-pasted the required cmake version "cmake_minimum_required(VERSION 3.10.0)" from the top level CMakeLists.txt to all the other ones.

This was the error I was getting for a ton of the different cmake files:
Code: Select all
CMake Error at sdk/CMakeLists.txt:11 (cmake_minimum_required):
  CMake 3.12.0 or higher is required.  You are running version 3.11.2


After that it seems that GLFW is no longer optional, as in cmake configure fails without it (I don't care about building the demos):

Code: Select all
CMake Error at CMakeLists.txt:56 (find_package):
  By not providing "Findglfw3.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "glfw3", but
  CMake did not find one.

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

    glfw3Config.cmake
    glfw3-config.cmake

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


-- Configuring incomplete, errors occurred!


After installing GLFW the demos still failed to compile:
Code: Select all
[100%] Linking CXX executable demosSandbox
/usr/bin/ld: kohteen -lglfw3 löytäminen epäonnistui

(translated it is "finding -lglfw3 failed")

But with -DBUILD_SANDBOX_DEMOS=OFF and GLFW installed and the changes to the minimum required cmake versions I was able to build it.
Boost113
 
Posts: 26
Joined: Thu Oct 23, 2014 3:24 am

Re: Linux Cmake build

Postby Julio Jerez » Sat Oct 27, 2018 9:41 am

I just commited the latest changes.
could you try again?

do not forget to delete teh cache.
Julio Jerez
Moderator
Moderator
 
Posts: 10993
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Linux Cmake build

Postby arpio » Sat Oct 27, 2018 9:54 am

For the Demos you also need OpenAl installed on linux. On Debian based systemsv
Code: Select all
sudo apt update
sudo apt install libopenal-dev


@Julio
If you want I could update the doc for Linux.
arpio
 
Posts: 23
Joined: Wed Oct 24, 2018 4:33 pm

Re: Linux Cmake build

Postby Julio Jerez » Sat Oct 27, 2018 10:55 am

arpio wrote:@Julio
If you want I could update the doc for Linux.

yes that will be awesome, :mrgreen:


I just commited teh tweaks to add teh prcompile header and copy the dll to the demo folder only for woindow system.
now it should all be fine for both systems.

what does it generate for linux a make file?
would that also works for migwg or oteh unit systems?
Julio Jerez
Moderator
Moderator
 
Posts: 10993
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Linux Cmake build

Postby arpio » Sat Oct 27, 2018 11:12 am

Yes it generates makefiles on Linux. MinGw and Mac users need to test and report the errors. The demo cmake right now is only unix and Windows.
arpio
 
Posts: 23
Joined: Wed Oct 24, 2018 4:33 pm

Re: Linux Cmake build

Postby Boost113 » Sat Oct 27, 2018 2:06 pm

I fixed the build for me: https://github.com/MADEAPPS/newton-dynamics/compare/master...hhyyrylainen:master

There is one perhaps questionable change as I renamed the "newton" target to "Newton" because my project links to "Newton" and with case-sensitive file system I was linking to the old version and that caused a crash.

Edit: I was unable to get the static version to link correctly, even when I specified my executable to link against: Newton dAnimation dContainers dCustomJoints
dgCore dgPhysics dMath dNewton dScene dVehicle

with this error:
Code: Select all
[ 13%] Linking CXX shared library ../bin/libEngine.so
/home/hhyyrylainen/Projects/Leviathan/build/ThirdParty/lib/libdgPhysics.a(dgBody.cpp.o): Funktiossa ”dgBody::IntegrateVelocity(float)”:
/home/hhyyrylainen/Projects/Leviathan/ThirdParty/newton-dynamics/sdk/dgPhysics/dgBody.cpp:322: määrittelemätön viite kohteeseen ”dgQuaternion::dgQuaternion(dgVector const&, float)”
/home/hhyyrylainen/Projects/Leviathan/build/ThirdParty/lib/libdgPhysics.a(dgBody.cpp.o): Funktiossa ”dgBody::RayCast(dgLineBox const&, float (*)(dgBody const*, dgCollisionInstance const*, dgVector const&, dgVector const&, long long, void*, float), unsigned int (*)(dgBody const*, dgCollisionInstance const*, void*), void*, float) const”:
/home/hhyyrylainen/Projects/Leviathan/ThirdParty/newton-dynamics/sdk/dgPhysics/dgBody.cpp:270: määrittelemätön viite kohteeseen ”dgRayBoxClip(dgVector&, dgVector&, dgVector const&, dgVector const&)”
/home/hhyyrylainen/Projects/Leviathan/build/ThirdParty/lib/libdgPhysics.a(dgBody.cpp.o): Funktiossa ”dgBody::SetMatrixOriginAndRotation(dgMatrix const&)”:
/home/hhyyrylainen/Projects/Leviathan/ThirdParty/newton-dynamics/sdk/dgPhysics/dgBody.h:573: määrittelemätön viite kohteeseen ”dgQuaternion::dgQuaternion(dgMatrix const&)”
/home/hhyyrylainen/Projects/Leviathan/ThirdParty/newton-dynamics/sdk/dgPhysics/dgBody.h:573: määrittelemätön viite kohteeseen ”dgQuaternion::dgQuaternion(dgMatrix const&)”

I omitted a few hundred lines of similar errors.
Last edited by Boost113 on Sat Oct 27, 2018 3:01 pm, edited 1 time in total.
Boost113
 
Posts: 26
Joined: Thu Oct 23, 2014 3:24 am

Re: Linux Cmake build

Postby Julio Jerez » Sat Oct 27, 2018 2:54 pm

why do you want to use an older version of cmake?
Julio Jerez
Moderator
Moderator
 
Posts: 10993
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Linux Cmake build

Postby Boost113 » Sat Oct 27, 2018 3:01 pm

Julio Jerez wrote:why do you want to use an older version of cmake?

Because my OS doesn't provide a newer version. And because I use CI with my project I would have to also rebuild a new docker image (I use the same base image as my OS, Fedora 28).
Boost113
 
Posts: 26
Joined: Thu Oct 23, 2014 3:24 am

Re: Linux Cmake build

Postby arpio » Sat Oct 27, 2018 9:45 pm

Boost113 wrote:There is one perhaps questionable change as I renamed the "newton" target to "Newton" because my project links to "Newton" and with case-sensitive file system I was linking to the old version and that caused a crash.

Edit: I was unable to get the static version to link correctly, even when I specified my executable to link against: Newton dAnimation dContainers dCustomJoints
dgCore dgPhysics dMath dNewton dScene dVehicle.


I'm also gonna link static libs. But the build was broken on linux. Gonna try it next week. Will see what I get.

The demos in the project working fine, static and shared. I don't think it's still a cmake issue.
arpio
 
Posts: 23
Joined: Wed Oct 24, 2018 4:33 pm

Re: Linux Cmake build

Postby Julio Jerez » Sat Oct 27, 2018 10:23 pm

I changed to cmake_minimum_required(VERSION 3.10.0)
and it seems to work fine.
can you try again?
Julio Jerez
Moderator
Moderator
 
Posts: 10993
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Linux Cmake build

Postby Boost113 » Sun Oct 28, 2018 5:28 am

It still fails because I don't want to have to install GLFW. With this change to the "find_package(glfw3 REQUIRED)" part I can properly configure it:
Code: Select all
    if(BUILD_SANDBOX_DEMOS)
     
        find_package(glfw3 REQUIRED)

        if(NOT_glfw3_FOUND)
            set(BUILD_SANDBOX_DEMOS OFF CACHE BOOL "" FORCE)
            message(WARNING "GLFW headers were not found. Sandbox_Demos disabled")
        else(NOT_glfw3_FOUND)
            message("Found GLFW library")
        endif(NOT_glfw3_FOUND)
    endif(BUILD_SANDBOX_DEMOS)


Additionally the newer version of newton doesn't want to install to a folder I give it so I need to add this:
Code: Select all
# If user selects an install dir it should be respected on unix
if(NOT UNIX OR CMAKE_INSTALL_PREFIX STREQUAL "")
    set(CMAKE_INSTALL_LIBDIR "${PROJECT_BINARY_DIR}/build/lib")
    set(CMAKE_INSTALL_BINDIR "${PROJECT_BINARY_DIR}/build/bin")
    set(CMAKE_INSTALL_INCLUDEDIR "${PROJECT_BINARY_DIR}/build/include")
else(NOT UNIX OR CMAKE_INSTALL_PREFIX STREQUAL "")
    set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib")
    set(CMAKE_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
    set(CMAKE_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/include")
endif(NOT UNIX OR CMAKE_INSTALL_PREFIX STREQUAL "")
Boost113
 
Posts: 26
Joined: Thu Oct 23, 2014 3:24 am

Next

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 8 guests

cron