Jump to content

Ubuntu 20.04 and Leadwerks


aiaf
 Share

Recommended Posts

Hello,

 

New lts version of ubuntu 20.04 is out, so i upgraded my 18.04 laptop.

The editor seem to work ok.

 

gcc version 9.3 is included.

My game compiles ok, below you can see the link errors .

I mention the math lib is linked (-lm):

-lm Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a -ldl -lopenal -lGL -lGLU Source/Libs/Leadwerks/Library/Linux/libsteam_api.so -lX11 -lXrender -lXext -lXft -lpthread -lcurl

 

Looks like an incompatibility between the new c++ library and the leadwerks static lib.

libstdc++.so.6 -> libstdc++.so.6.0.28

 

Anyone has a workaround for this ?

 

/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(OpenGLTexture.o): in function `std::pow(float, float)':
/usr/include/c++/7/cmath:389: undefined reference to `__powf_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(Entity.o): in function `Leadwerks::Entity::CalcAverageOmega(Leadwerks::Quat, Leadwerks::Quat, double const&)':
/home/josh/Leadwerks/Engine/Source/Classes/Entity.cpp:5821: undefined reference to `__sqrt_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(Entity.o): in function `std::asin(float)':
/usr/include/c++/7/cmath:107: undefined reference to `__asinf_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(Entity.o): in function `std::atan2(float, float)':
/usr/include/c++/7/cmath:145: undefined reference to `__atan2f_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(Font.o): in function `__gnu_cxx::__promote_2<double, int, __gnu_cxx::__promote<double, std::__is_integer<double>::__value>::__type, __gnu_cxx::__promote<int, std::__is_integer<int>::__value>::__type>::__type std::pow<double, int>(double, int)':
/usr/include/c++/7/cmath:418: undefined reference to `__pow_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(dVec3.o): in function `Leadwerks::dVec3::Normalize()':
/home/josh/Leadwerks/Engine/Source/Classes/Math/dVec3.cpp:324: undefined reference to `__sqrt_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(dVec3.o): in function `Leadwerks::dVec3::Length()':
/home/josh/Leadwerks/Engine/Source/Classes/Math/dVec3.cpp:336: undefined reference to `__sqrt_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(dVec3.o): in function `Leadwerks::dVec3::DistanceToPoint(Leadwerks::dVec3 const&)':
/home/josh/Leadwerks/Engine/Source/Classes/Math/dVec3.cpp:354: undefined reference to `__sqrt_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(dVec3.o): in function `Leadwerks::dVec3::DistanceToPoint(Leadwerks::Vec3 const&)':
/home/josh/Leadwerks/Engine/Source/Classes/Math/dVec3.cpp:362: undefined reference to `__sqrt_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(Mat4.o): in function `Leadwerks::Mat4::GetQuaternion(Leadwerks::Quat&)':
/home/josh/Leadwerks/Engine/Source/Classes/Math/Mat4.cpp:505: undefined reference to `__sqrt_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(Mat4.o):/home/josh/Leadwerks/Engine/Source/Classes/Math/Mat4.cpp:593: more undefined references to `__sqrt_finite' follow
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(Math_.o): in function `std::log(float)':
/usr/include/c++/7/cmath:339: undefined reference to `__logf_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(Quat.o): in function `Leadwerks::Quat::GetAverageOmega(Leadwerks::Quat const&, double)':
/home/josh/Leadwerks/Engine/Source/Classes/Math/Quat.cpp:92: undefined reference to `__sqrt_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(meshcollider.o): in function `b3d::Vector::length() const':
/home/josh/Leadwerks/Engine/Source/Libraries/b3d/geom.h:102: undefined reference to `__sqrtf_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(pickcollision.o): in function `b3d::Vector::distance(b3d::Vector const&) const':
/home/josh/Leadwerks/Engine/Source/Libraries/b3d/geom.h:105: undefined reference to `__sqrtf_finite'

 

I made this with Leadwerks/UAK:

Structura Stacky Desktop Edition

Website:

Binary Station

Link to comment
Share on other sites

What a mess:

https://developers.redhat.com/blog/2016/02/29/why-cstdlib-is-more-complicated-than-you-might-think/

I only have this header on my machine:

/usr/include/c++/9/cmath

 

Learned some things but I spend way too much time looking at this,

 im actually interested to have my game finished not finding out what the ld and glibc is doing under the hood.

 

For the linux build i will install a virtual machine with 18.04.

 

I made this with Leadwerks/UAK:

Structura Stacky Desktop Edition

Website:

Binary Station

Link to comment
Share on other sites

My solution to all this has been to really minimize the amount of third-party libraries the engine will use in the future. Built-in libs we include in the build are fine but the dependencies stuff is really a nightmare. The biggest offender is GTK which will not be part of our new editor.

A lot of extra functionality has also been moved to plugins. This was originally done for security purposes but also has the benefit of making the Linux build a lot more streamlined and reliable.

Of course this all requires a new engine and editor. At least I learned these things a few years ago and have been building the new engine with that knowledge, rather than finding it all out now.

  • Like 2

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • 2 weeks later...
On 4/20/2020 at 8:01 AM, aiaf said:

Hello,

 

New lts version of ubuntu 20.04 is out, so i upgraded my 18.04 laptop.

The editor seem to work ok.

 

gcc version 9.3 is included.

My game compiles ok, below you can see the link errors .

I mention the math lib is linked (-lm):

-lm Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a -ldl -lopenal -lGL -lGLU Source/Libs/Leadwerks/Library/Linux/libsteam_api.so -lX11 -lXrender -lXext -lXft -lpthread -lcurl

 

Looks like an incompatibility between the new c++ library and the leadwerks static lib.

libstdc++.so.6 -> libstdc++.so.6.0.28

 

Anyone has a workaround for this ?

 


/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(OpenGLTexture.o): in function `std::pow(float, float)':
/usr/include/c++/7/cmath:389: undefined reference to `__powf_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(Entity.o): in function `Leadwerks::Entity::CalcAverageOmega(Leadwerks::Quat, Leadwerks::Quat, double const&)':
/home/josh/Leadwerks/Engine/Source/Classes/Entity.cpp:5821: undefined reference to `__sqrt_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(Entity.o): in function `std::asin(float)':
/usr/include/c++/7/cmath:107: undefined reference to `__asinf_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(Entity.o): in function `std::atan2(float, float)':
/usr/include/c++/7/cmath:145: undefined reference to `__atan2f_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(Font.o): in function `__gnu_cxx::__promote_2<double, int, __gnu_cxx::__promote<double, std::__is_integer<double>::__value>::__type, __gnu_cxx::__promote<int, std::__is_integer<int>::__value>::__type>::__type std::pow<double, int>(double, int)':
/usr/include/c++/7/cmath:418: undefined reference to `__pow_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(dVec3.o): in function `Leadwerks::dVec3::Normalize()':
/home/josh/Leadwerks/Engine/Source/Classes/Math/dVec3.cpp:324: undefined reference to `__sqrt_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(dVec3.o): in function `Leadwerks::dVec3::Length()':
/home/josh/Leadwerks/Engine/Source/Classes/Math/dVec3.cpp:336: undefined reference to `__sqrt_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(dVec3.o): in function `Leadwerks::dVec3::DistanceToPoint(Leadwerks::dVec3 const&)':
/home/josh/Leadwerks/Engine/Source/Classes/Math/dVec3.cpp:354: undefined reference to `__sqrt_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(dVec3.o): in function `Leadwerks::dVec3::DistanceToPoint(Leadwerks::Vec3 const&)':
/home/josh/Leadwerks/Engine/Source/Classes/Math/dVec3.cpp:362: undefined reference to `__sqrt_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(Mat4.o): in function `Leadwerks::Mat4::GetQuaternion(Leadwerks::Quat&)':
/home/josh/Leadwerks/Engine/Source/Classes/Math/Mat4.cpp:505: undefined reference to `__sqrt_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(Mat4.o):/home/josh/Leadwerks/Engine/Source/Classes/Math/Mat4.cpp:593: more undefined references to `__sqrt_finite' follow
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(Math_.o): in function `std::log(float)':
/usr/include/c++/7/cmath:339: undefined reference to `__logf_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(Quat.o): in function `Leadwerks::Quat::GetAverageOmega(Leadwerks::Quat const&, double)':
/home/josh/Leadwerks/Engine/Source/Classes/Math/Quat.cpp:92: undefined reference to `__sqrt_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(meshcollider.o): in function `b3d::Vector::length() const':
/home/josh/Leadwerks/Engine/Source/Libraries/b3d/geom.h:102: undefined reference to `__sqrtf_finite'
/usr/bin/ld: Source/Libs/Leadwerks/Library/Linux/Debug/Leadwerks.a(pickcollision.o): in function `b3d::Vector::distance(b3d::Vector const&) const':
/home/josh/Leadwerks/Engine/Source/Libraries/b3d/geom.h:105: undefined reference to `__sqrtf_finite'

 

I create here a workaround with docker like this:

Install docker: https://www.docker.com/get-started, i will not explain too much about how to install docker but have alot of information on the internet, if some of get's stucked can contact me here, docker is nice container solution using LXC, where you can create `sudo` isolated enviroviments sharing the linux kernel but using base and diferent libraries, o this case the problem is the libc6, and downgrade is not possible, and compile using a diferent libc6 could be a pin a ***.

$ sudo apt install docker-engine 

Install docker-compose: 

sudo apt install docker-compose

1. Create a directory inside your game folder here a will call: docker-build

`mkdir docker-build`

2. Create inside the `docker-build` folder a file with name `Dockerfile` and paste this contents:

FROM ubuntu:18.04
RUN apt update 
RUN apt install -y -qq build-essential \
                        libopenal-dev \
                        libgl1-mesa-dev \
                        libglu1-mesa-dev \
                        libx11-dev \
                        libxext-dev \
                        libxrender-dev \
                        libxft-dev \
                        libcurl4-openssl-dev
RUN useradd leadwerks
ADD ./docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh
RUN mkdir -p /home/leadwerks/.steam
USER leadwerks
WORKDIR /home/leadwerks/
ENTRYPOINT [ "/docker-entrypoint.sh" ]

3. Create inside the `docker-build` folder a file with name `docker-entrypoint` and paste this contents:

This is just place holder to keep the container always up

#!/bin/bash

while true; do
    sleep 1
done

4. Create inside of your game folder root a file with name `docker-compose.yml` and paste this contents and modify the place holders on the text to your machine paths:

version: '2'
services:
    leadwerks-build:
        build: ./docker-build
        volumes:
            - ".:/home/leadwerks/<your-game-folder-inside-the-container>"
            - "/home/<your-linux-host-ueser>/.steam:/home/leadwerks/.steam"

5. Run inside your game root folder to build, create and run the container:

$ sudo docker-compose up --build -d leadwerks-build

with it done your will have the env ready to compile your project.

6. Acessing the container to build your game:

$ sudo docker-compose exec leadwerks-build bash

After this command you will be inside your container, if you do not understand containers just keep in your mind its like a "virtual machine" but alot more efficient and lite and faster...

Anyway now you can just compile your project inside the container and it will build and the build results will inside your game folder.

When your finish you can stop the container by just to free memory:

$ sudo docker-compose stop leadwerks-build

i hope was helpful

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...