gwaldron / osgearth

3D Maps for OpenSceneGraph / C++14
https://www.pelicanmapping.com/home-1/opensource
Other
1.48k stars 774 forks source link

Please help run example on Ubuntu #2349

Closed rebmaso closed 11 months ago

rebmaso commented 11 months ago

Hello,

I posted a previous issue https://github.com/gwaldron/osgearth/issues/2337 regarding building on Ubuntu using vcpkg. I understant now that vcpkg linux is supported but just theoretically.

So I followed the pipeline in osgearth/.github/workflows/linux.yml , but it looks like sudo apt-get install -y libopenscenegraph-dev gets an openscenegraph without GL3_AVAILABLE flag.

So I manually built & installed openscenegraph with GL3_AVILABLE beforehand, as pointed out in https://github.com/gwaldron/osgearth/issues/2122#issuecomment-1219473289, and then built osgearth as in osgearth/.github/workflows/linux.yml.

Having built osgearth:

I get a nasty rex engine error if I run one of the examples (e.g. bin/osgearth_city)! It looks like my error is the same as in https://github.com/gwaldron/osgearth/issues/2273 (but the solution found by OP did not work for me).

Error reading file .osgearth_engine_rex: file not handled
[osgEarth]* WARNING: Failed to load terrain engine driver for "rex"
[osgEarth]* FAILED to create a terrain engine for this map

I get this REX error for recent releases (3.4, 3.3, 3.2) and similar errors for older releases (2.9)

To my best knowledge, I've tried every possible solution mentioned in previous issues, without success. So maybe it's easier to ask this question instead:

Do you have a build pipeline for Ubuntu (20 or 22) for which the examples have been tested and run without errors?

plevy commented 11 months ago

Can you try: osgearth_viewer osgearth/tests/boston.earth Basically the same as osgearth_city

Second, on Linux, you may need to set the path to the libraries: export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64

rebmaso commented 11 months ago

@plevy Thanks for the reply. Still getting errors:

This is with osgearth release 3.4

export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64

cd ~/my_libs/osgearth/build/bin

./osgearth_viewer /home/user/my_libs/osgearth/tests/boston.earth
void StateSet::setGlobalDefaults() ShaderPipeline disabled.
Error reading file /home/user/my_libs/osgearth/tests/boston.earth: file not handled
[osgEarth]* [MapNodeHelper] No valid earth file loaded - aborting
[osgEarth]  
Usage: ./osgearth_viewer file.earth
  --sky                         : add a sky model
  --kml <file.kml>              : load a KML or KMZ file
  --kmlui                       : display a UI for toggling nodes loaded with --kml
  --coords                      : display map coords under mouse
  --ortho                       : use an orthographic camera
  --logdepth                    : activates the logarithmic depth buffer
  --logdepth2                   : activates logarithmic depth buffer with per-fragment interpolation
  --shadows                     : activates model layer shadows
  --out-earth [file]            : write the loaded map to an earth file
  --uniform [name] [min] [max]  : create a uniform controller with min/max values
  --define [name]               : install a shader #define
  --path [file]                 : load and playback an animation path
  --extension [name]            : loads a named extension
  --ocean                       : add a simple ocean model (requires bathymetry)
plevy commented 11 months ago

I think your build is probably working but here are my notes:

1 Build essentials
sudo apt update && sudo apt install build-essential

2 GDAL:
sudo apt-get install libgdal-dev

3 GLEW
sudo apt-get install libglew-dev

4 Build Openscenegraph
git clone https://github.com/openscenegraph/OpenSceneGraph.git
cd osg
mkdir build && cd build
cmake .. -DOPENGL_PROFILE=GL3 -DOSG_GL_CONTEXT_VERSION=4.6
make -j8
sudo make install

5 Build Draco
git clone https://github.com/google/draco.git
cd draco
mkdir build && cd build
cmake .. 
make -j8
sudo make install

6 Build osgEarth
git clone https://github.com/gwaldron/osgearth.git
cd osgEarth
mkdir build && cd build
cmake .. 
make -j8
sudo make install

What I think is missing is the path to the plugins. Can you look in: /usr/local/lib/osgPlugins-3.7.0/ and /usr/local/lib64/osgPlugins-3.7.0/

make sure there are libraries there as that was tied to the LD_LIBRARY_PATH.

And double check the output of the build to see where install is installing the libs:

-- Installing: /usr/local/lib64/osgPlugins-3.7.0/osgdb_osgearth_bumpmap.so
-- Set runtime path of "/usr/local/lib64/osgPlugins-3.7.0/osgdb_osgearth_bumpmap.so" to ""
-- Installing: /usr/local/lib64/osgPlugins-3.7.0/osgdb_osgearth_cache_filesystem.so
-- Set runtime path of "/usr/local/lib64/osgPlugins-3.7.0/osgdb_osgearth_cache_filesystem.so" to ""
-- Up-to-date: /usr/local/include/osgEarthDrivers/cache_filesystem/FileSystemCache
-- Installing: /usr/local/lib64/osgPlugins-3.7.0/osgdb_osgearth_colorramp.so
-- Set runtime path of "/usr/local/lib64/osgPlugins-3.7.0/osgdb_osgearth_colorramp.so" to ""
-- Up-to-date: /usr/local/include/osgEarthDrivers/colorramp/ColorRampOptions
-- Installing: /usr/local/lib64/osgPlugins-3.7.0/osgdb_osgearth_detail.so
-- Set runtime path of "/usr/local/lib64/osgPlugins-3.7.0/osgdb_osgearth_detail.so" to ""
-- Installing: /usr/local/lib64/osgPlugins-3.7.0/osgdb_draco.so
-- Set runtime path of "/usr/local/lib64/osgPlugins-3.7.0/osgdb_draco.so" to ""
-- Installing: /usr/local/lib64/osgPlugins-3.7.0/osgdb_earth.so
-- Set runtime path of "/usr/local/lib64/osgPlugins-3.7.0/osgdb_earth.so" to ""
-- Installing: /usr/local/lib64/osgPlugins-3.7.0/osgdb_osgearth_engine_rex.so
-- Set runtime path of "/usr/local/lib64/osgPlugins-3.7.0/osgdb_osgearth_engine_rex.so" to ""
rebmaso commented 11 months ago

That was my bad, I built but accidentally forgot to install osgearth this time.

Everything working now.

I'm sorry for having wasted your time and hope that at least your answer will serve as a proper build pipeline for those who want to use the software on Ubuntu.

plevy commented 11 months ago

No worries, glad you got it working.