Page 1 of 1

My ogre 2.1 setup experience (linux)

Posted: Fri Feb 02, 2018 12:36 pm
by ven
I want to share here my experience of building, assembling and setting up an OGRE 2.1 and related libraries for my old project, including editing code and running the application. On Linux system.
As a goal - this is possible help to other users, as well as a presentation for developers how this process takes place for ordinary user. In addition, if I would have problems, I hope to get help from more experienced users or developers in this topic.
I suppose that this process will occur by adding new posts while progress.

My last working copy uses OGRE 1.9 and other libraries released at least until 2016.
I will build it on fresh(clean) Linux Debian 9 "Stretch". The system has installed nvidia-drivers and xfce desktop environment.
Well, let's get started.

Setup experience. Part 1

The first thing I did was go to the ogre download page. By reference "What version to choose?" I read about the advice to port first to 2.0, but neglected it and decided to set immediately 2.1. Read again Ogre 2.1 FAQ.

Downloaded the latest version 2.1 (Commit 8c5a30d) from repository. After reading the article "Building Ogre Guide" from download page, I tried to make the steps in article:

apt-get install cmake-gui
apt-get install libgles2-mesa-dev libxt-dev libxaw7-dev nvidia-cg-toolkit libsdl2-dev doxygen

I used the cmake graphical interface, and chose to generate simple "Unix Makefiles". But I could not advance beyond the CMake configuration, because there was missing FREETYPE_FT2BUILD_INCLUDE_DIR. Later I realized that I need to install libfreetype6-dev also (and not just libfreetype6). It seems elementary, by article, but it took me 2 hours. I was hit, that I did not understand what was meant by the entry "By default ogre will build the essential dependencies automatically when you run cmake the first time" and did not find subfolder "Dependencies". Also "run cmake the first time" I did not succeed because there was no freetype.

By the way, the version of libfreetype6-2.8.1-1 I have is from the test repository, because there is new quality hinting for the desktop fonts. Thus, "non-standard" for Stretch, I only have these libraries: libfreetype6-dev-2.8.1-1, libpng-dev-1.6.34-1, libpng-tools-1.6.34-1

apt-get install libfreetype6-dev
(For me: apt -t testing install libfreetype6-dev)

Now the log looked with warnings, but the makefile was generated.
At this point, I decided to leave everything as default, and I started building the library:

cd ~/rain/dev/libs/ogre-v2.1-02.02.18/build/
make clean
make -j 8

Buiding log, with many gcc warnings.

Remembered that I do not have OIS.
While dealing with the freetype, I found another page, where it is recommended to install the above packages:

apt-get install build-essential automake libtool libfreetype6-dev libfreeimage-dev libzzip-dev libxrandr-dev libxaw7-dev freeglut3-dev libgl1-mesa-dev libglu1-mesa-dev nvidia-cg-toolkit libois-dev libboost-thread-dev doxygen graphviz libcppunit-dev libxt-dev

I decided to install everything, and rebuild OGRE. CMake log, already without any warnings. And build log.

After this, I tried to enable the OGRE_BUILD_PLUGIN_CG, but the build failed: configuration and build errors.
Left everything by default, rebuild, and moved on.

The next step is downloading MyGUI. Was downloaded the latest version(98ba6dc) mygui from "ogre2.1" branch.

Using instructions from the this page, i set OGRE_SOURCE_DIR and OGRE_BUILD, but got configuration errors. Trying to set different other options, I found out that need specify OGRE_LIBRARIES (as patch to build/libs). Configuration now looks ok, but while building can not find OgreBuildSettings.h.

The search how to correctly add in includes OgreBuildSettings.h success has not brought. Found only one thing with a fun answer. So just created a symbolic link. Crutch one.

cd ~/rain/dev/libs/ogre-v2.1-02.02.18
ln -s ../../build/include/OgreBuildSettings.h OgreMain/include/OgreBuildSettings.h

Well, the file was found, now the next error: 'class Ogre::Viewport' has no member named 'setClearEveryFrame' etc.

To be continued.

Re: My ogre 2.1 setup experience (linux)

Posted: Fri Feb 02, 2018 4:16 pm
by QuestOfDreams
You downloaded Ogre 2.1 but were following instructions written for 1.x to compile it. This way it's almost inevitable to run into problems ... :!:
Try this guide instead. However, since the 2.1 branch is unstable (i.e. larger, potentially breaking changes may occur), any documentation may become outdated quickly ...

Re: My ogre 2.1 setup experience (linux)

Posted: Sat Feb 03, 2018 12:50 pm
by ven
QuestOfDreams wrote:
Fri Feb 02, 2018 4:16 pm
You downloaded Ogre 2.1 but were following instructions written for 1.x to compile it. This way it's almost inevitable to run into problems ... :!:
Try this guide instead. However, since the 2.1 branch is unstable (i.e. larger, potentially breaking changes may occur), any documentation may become outdated quickly ...
From Ogre 2.1 FAQ.
-Is Ogre 2.1 stable?
-Yes, it is stable.

I do not follow the instructions written for 1.x, I follow the instructions written on the site of OGRE for building OGRE. That's why I'm writing this post - "how this process takes place for ordinary user". I cite references, and show the logic of a person who is not an expert on the ogre, and does not know all the subtleties. Nowhere in this links is not written that these instructions are for 1.x only. Nowhere in them is not written that are other instructions, for 2.x, and where they are, in particular, the link you provided. Thank you for this link.
The biggest problem is the lack of good documentation. Everything collecting by pieces.

Setup experience. Part 2

In this thread, I found that for ogre 2.x it is necessary to specify in the myGUI cmake configuration

Code: Select all

After configuration, the building still did not succeed: "Hlms/Unlit/OgreHlmsUnlitDatablock.h: No such file or directory"

Rebuilt OGRE again from the beginning by the link for 2.1. The process seems similar, except for the request not to download the repository, but to get through "clone". After rebuild nothing has changed, created the topic with a question. Based on the answer - something is wrong with directories in my built Ogre 2.1 SDK. I will duplicate here my post from the topic, as a continuation of my narrative.

Ok, try again. New clean process, step by step by "Setting Up Ogre" 2.1 Linux. There will be commands in the console and logs of their execution by reference in commands:

date -u

----- getting sources -----
mkdir ogre
hg clone -r v2-1
cd ogre
hg clone Dependencies

----- building dependencies -----
cd Dependencies
mkdir build
cd build
cmake ../
make install

----- building OGRE -----
cd ../../../ogre
mkdir build
cd build
mkdir Debug
mkdir Release
cd Debug
make install
cd ../Release
make install

First incomprehensible things is that SDL not building, although it is in the directory, and consequently then while ogre cmake: "Could not find dependency for samples: SDL2, Skipping samples & tests build".
Second, this is an unsuccessful attempt to install an ogre in "/usr/local/include/OGRE". Script "make install" has no rights for this. This can be seen in the logs "make install". (On a note: I guess, and I want, that OGRE not coming out of its directory).
The result is a lack of samples and almost empty SDK directory. <Hlms/Unlit/OgreHlmsUnlitDatablock.h> still not found.
Also looking at the log in 11424 lines, there is a desire to help improve the code freeimage, or at least to remove all warnings from the build process.

Re: My ogre 2.1 setup experience (linux)

Posted: Thu Feb 08, 2018 11:55 pm
by QuestOfDreams
ven wrote:
Sat Feb 03, 2018 12:50 pm
First incomprehensible things is that SDL not building, although it is in the directory, and consequently then while ogre cmake: "Could not find dependency for samples: SDL2, Skipping samples & tests build".
This is something I noticed as well when building Ogre 2.1 on Ubuntu some days ago. SDL2 is only built on Windows (instead it still builds OIS on Linux), however you could probably get away by installing libsdl2-2.0-0 and libsdl2-dev on Debian-based systems. Also, as stated here, rapidjson headers are still searched for on the wrong level and thus some of the samples won't run properly.

Re: My ogre 2.1 setup experience (linux)

Posted: Sat Feb 10, 2018 7:36 pm
by ven
At the current total, as a user who is familiar with OGRE since 2008, I can characterize the threshold of occurrence in 2.1 as high. At least on Linux, as on Windows I do not know, it still remains afterwards. For the second week I've been trying to just build OGRE and gui. I had to learn most manuals and all the links for building, which only could get by google, to understand the picture. This is all despite the fact that I have not even changed the default options, such as threads and stuff. Is there certainly a lot of blame on the library mygui, but the fault of OGRE is that it does not provide a clearly defined output configuration (how to build SDK, I did not find at all), yet again, on Linux. And CMake MyGUI does not have a simple configuration on the OGRE's assembly directory, there is something broken. The user has to understand how the assembly system is arranged, which options are responsible for, sadly in different manuals and topics on the forum. As any programmer will understand, this is not what is required from high-quality software (encapsulation). I tried to contact the GUI maintainers, but without success. I know how much effort was put in to implement what was done in 2.1, primarily by Matías. I know how little resources and how difficult it is. I admire his selfless work. But for me the launching of OGRE (with dependent libraries) for the last few years became very difficult. Sometimes I want to say, it's hell. May be something wrong with me. The situation is complicated by the fact that it is not known: I do not understand something or there are bugs, because there is no clear instruction "from A to Z". I waited for the last two-three years, when the official release, tag, will be made. But time does not wait, I have already considered using another engine, but I would very much like to stay with OGRE, including for the above reason. As I already wrote, the main problem in the absence of good overall unified documentation, and the long-needed 2.1 tag. I read that the release is delayed due to problems with mobile platforms, but for example I do not use them at all. May be to make the PC-only release, it is normal incremental development. The addition of mobile platforms in the future should not change the API, in theory.

Setup experience. Part 3

Found in the building guide "for 1.x" that can be changed the install location by changing the variable CMAKE_INSTALL_PREFIX in CMake. Set it in "ogre/install".
Install libsdl2-dev. Repeated the command from the "guide 1.x" just in case:
apt-get install libgles2-mesa-dev libxt-dev libxaw7-dev nvidia-cg-toolkit libsdl2-dev doxygen
Configured OGRE again (cmake log, cmake changes), and build with successful install in "install" dir.

In MyGUI CMake set:

Code: Select all

After that it was at least something like. MyGUI cmake changes, cmake log and build log with error. Error due to changed API, in initialiseAllResourceGroups() added the bool parameter (without a default value). But the main library with the platform were built. I'll try to launch so.

By Porting Manual from FAQ and with help of this guide began to edit my source:
Сhanged creation of scene.

Code: Select all

Ogre::SceneManager* pSceneMgr = root.createSceneManager(Ogre::ST_GENERIC, 1, Ogre::INSTANCING_CULLING_SINGLETHREAD);
Attached light sources to the nodes.
Removed names from createEntity.
Encountered an undocumented API change. In API Reference 2.1 is available SceneManager::clearScene(void), but in fact in headers clearScene( bool deleteIndestructibleToo, bool reattachCameras=true ).
Change on clearScene(false).

After the search, I realized that the information on the network had not been updated for a long time, and the current information was only in the documentation supplied with the sources. I did not notice any mention of this either. To my surprise with mixed emotions, I found Ogre 2.1 Porting Manual, Last revision: 2017-01-16. In 2.1 FAQ in the web is a link only to Ogre 2.1 Porting Manual Last revision: 2015-12-03. Both somehow are in files with the name Ogre 2.0 Porting Manual DRAFT.odt.
Write at least: the documentation from the site, in particular the API Reference and Porting Manual for 2.1, is not fully relevant, read the documentation supplied with the sources.

Found How I ported my project to Ogre 2.1 with helpful information.
Tinkered a bit with Ogre::CompositorManager2 and workspaces, because I had my own workspaces system, and the switching occurred by connecting the camera to the viewport. I have not yet figured out how to switch correctly now, but so far I've done it through CompositorWorkspace::setEnabled(bool).
Adding ::v1 in large quantities.
Disabled many things, I'll figure it out later. But I'm very happy with all the innovations. I thought about many of them since the beginning of using OGRE since 2008. At this point, editing the code took two hours.

Built a project and run. MyGUI demanded unlit. In accordance with this section Using the HLMS implementations: Initialization added the Hlms Unlit registering code right after initialization Ogre::Root. While the red empty screen has started, but already something.

Problems now:
1. Ogre.log with many errors in materials from Media.
2. Also received exception "Cannot locate resource DualQuaternion_Common.glsl in resource group Popular or any other group". In the Media file is present. Does something need to be changed manually?
3. Tried to turn on Pbs like Unlit, got undefined symbol: Ogre::HlmsPbs::HlmsPbs(Ogre::Archive*, std::vector<Ogre::Archive*, Ogre::STLAllocator<Ogre::Archive*, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0> > >*)
Сreated a topic with a question: Undefined symbol: Ogre::HlmsPbs::HlmsPbs.

To be continued and I will be grateful for any help or advice.

Re: My ogre 2.1 setup experience (linux)

Posted: Mon Feb 12, 2018 5:50 pm
by ven
Setup experience. Part 4

I didn't get answers, tying to decide on my own.
Include the library into linking list. This removed the symbol lookup error for Ogre::HlmsPbs::HlmsPbs.
Included additional file locations in Resources.cfg:
It cleared the error with a search DualQuaternion_Common.glsl.
Still, there was some sad Ogre.log. It is necessary to search for a system correction for all this.

Then there became more and more problems like that. In desperation, I thought that the examples somehow worked. I began to study the initializing code, and I found a lot of new things for myself. In general, I could not run with my current code. Mainly because of other libraries. I'm tired. I will rewrite the graphic part of my project from scratch, filling it with parts, one after another. And looking at the examples, which seem to be the main and perhaps the only documentation and tutorials for the launch. I also think I'll use SDL instead of OIS, although with OIS I had no problems. And try CEGUI, because at the moment MyGUI upset me the most. Initially, I planned that ogre will be deeply integrated into my code. Now I'll use it sparingly through the wrapper. Because many things float, and also because it is sensitive to a non-standard approach (not as in the examples). Nevertheless, I think that this is one of the most flexible engines. In addition, I want to say that on Windows I build libs and run app with simple example in 10 minutes. So far this is the end. :)

Re: My ogre 2.1 setup experience (linux)

Posted: Thu Jul 16, 2020 9:44 pm
by Dynamito
hey, its the future now, everything works fine now if you or someone else follow the Manual's instructions.

I used the script provided in Download section fo the website, it downloads everything for you and even builds Ogre if i remember..
Current version is ~2.3. cmake config is easily fixed if you read carefully the Manual's instructions. It is described why it fails and how to fix.

Also they prepared a Sample project with cmake already configured, copy paste anywhere, add Ogre as symbolic link in dep folder, so this is working directly with cmake/cmake-gui and make commands.

well compiling ogre itself takes about 10-30 mins, depending on the number of concurrent jobs, but a new empty project shouldn't take more than 10 secs to build.

I use VSCode and after setting a few includes in the settings file, intellisense works the same as you would do in Visual Studio on Windows.

I didnt encounter any major problem concerning the Ogre files, they come perfectly working with cmake which is a great achievement.
The master branch has a ton of warnings compared to 2.2.x, but it's worth the time invested.

I myself had no skills in cmake or make or even visual studio code. Managed to get everything compiling and running fine in a few hours.

I have spent years on Unity/Unreal Engine/CryEngine/Unigine/Godot/Xenko/Stingray/, now im tired with these stupidly slow and heavy game engines and going to use Ogre for all my future projects. The way their engines are made is designed to spoon feed people and make you think programming is reserved to PHDs.

Last time i tried migrating to Linux was before 2014 and at that time only a few games were running on Linux, this time Windows has stepped in darkness to the point where your computer doesnt belong to you anymore they use all the ram, all the disk bandwidth, all the processor, and leave you with a few percents of each, and when you see softs like unreal engine allocate 6G of empty memory and reserve it for the engine needs, working on windows has become impossible for me. And i dont mention the forced updates, and the poorly programmed OS that it is.

Long life to Linux.