Board index FlightGear Support Compiling

Getting SEGV when building FG from next

Building FlightGear from source, and in the need for help?

Getting SEGV when building FG from next

Postby TheEagle » Thu Nov 04, 2021 2:48 pm

I was just trying to build FlightGear from source to eventually make a small contribution :wink: I made sure I am using the next branch:
Code: Select all
~$ export LD_LIBRARY_PATH=/home/user/.local/lib:/home/user/.local/lib/x86_64-linux-gnu:/usr/lib:/usr/lib/x86_64-linux-gnu:/lib:/lib/x86_64-linux-gnu
~$ mkdir fgsource
~$ cd fgsource
~/fgsource$ git clone https://git.code.sf.net/p/flightgear/simgear simgear
[…]
~/fgsource$ git clone https://git.code.sf.net/p/flightgear/flightgear flightgear
[…]
~/fgsource$ cd simgear
~/fgsource/simgear$ git checkout next
[…]
~/fgsource/simgear$ git fetch
~/fgsource/simgear$ cmake . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/home/user/.local -DCMAKE_C_FLAGS="-llber -lcrypt -z" -DCMAKE_CXX_FLAGS="-llber -lcrypt -lz"
[…]
~/fgsource/simgear$ make
[…]
~/fgsource/simgear$ make install
[…]
~/fgsource/simgear$ cd ..
~/fgsource$ cd flightgear
~/fgsource/flightgear$ git checkout next
[…]
~/fgsource/flightgear$ git fetch
~/fgsource/flightgear$ cmake . -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/home/user/.local -DCMAKE_C_FLAGS="-llber -lcrypt -z"
[…]
~/fgsource/flightgear$ make
[…]
~/fgsource/flightgear$ make install
[…]

I did not include all the output as I already closed the terminal and don't have it anymore :x, but the build went without errors (but I had to copy flightgear/3rdparty/joystick/Flightgear_js.h into flightgear/src/Input, and I had to add the three libraries liblber, libcrypt and libz to the linker flags). In the configure step, CMake said something about possibly conflicting libraries. Anyways, after that I tried to run FlightGear, and got a SIGSEGV:
Code: Select all
~$ fgfs
Segmentation fault (core dumped)

This is the backtrace I got from gdb:
Code: Select all
#0  0x00007ffff5fec284 in std::_Rb_tree_decrement(std::_Rb_tree_node_base*) ()
   from /lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x00007ffff696c60f in std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_get_insert_unique_pos(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /lib/x86_64-linux-gnu/libosg.so.160
#2  0x00007ffff696c962 in std::_Rb_tree_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > std::_Rb_tree<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::less<std::__--Type <RET> for more, q to quit, c to continue without paging--c
cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >::_M_emplace_hint_unique<std::piecewise_construct_t const&, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>, std::tuple<> >(std::_Rb_tree_const_iterator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::piecewise_construct_t const&, std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&>&&, std::tuple<>&&) () from /lib/x86_64-linux-gnu/libosg.so.160
#3  0x00007ffff696b8d8 in osg::ApplicationUsage::addEnvironmentalVariable(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /lib/x86_64-linux-gnu/libosg.so.160
#4  0x00007ffff696b982 in osg::ApplicationUsage::addUsageExplanation(osg::ApplicationUsage::Type, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /lib/x86_64-linux-gnu/libosg.so.160
#5  0x00007ffff6cab41c in ?? () from /lib/x86_64-linux-gnu/libosgUtil.so.160
#6  0x00007ffff7fe0b8a in ?? () from /lib64/ld-linux-x86-64.so.2
#7  0x00007ffff7fe0c91 in ?? () from /lib64/ld-linux-x86-64.so.2
#8  0x00007ffff7fd013a in ?? () from /lib64/ld-linux-x86-64.so.2
#9  0x0000000000000001 in ?? ()
#10 0x00007fffffffdf13 in ?? ()
#11 0x0000000000000000 in ?? ()

Any clues what I could be doing wrong ?
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3433
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Getting SEGV when building FG from next

Postby wkitty42 » Thu Nov 04, 2021 3:00 pm

it is doubtful that it is anything *you* are doing wrong... most likely it is a code defect or a problem with bad data somewhere... but conflicting libs could cause this...

if it were me, i'd run the compile/build script again with stderr and stdout redirected to a log file and then post that log file to pastebin or similar with a link to it here and/or on the mailing list because that's where the folk with the most knowledge about building FG reside...

eg:
Code: Select all
# blah set vars here blah #
$MYFGBASEDIR/dnc.sh -a n -d y -p n -j $PROCESSORS -f $MYFGBUILDTYPE -b $MYBUILDTYPE $FGWHATTOBUILD |& tee ~/mylogs/buildFG-$(date +'%Y%m%d%H%M%z').log


and i'd run FG the same way.... with stderr and stdout redirected to a log...

eg:
Code: Select all
fgfs --launcher |& tee ~/mylogs/runFG-$(date +'%Y%m%d%H%M%z').log


that way the entire output of the console will be logged... i also run FG in gdb with this same type of redirection specifically to capture everything that gets spit out all over the console screen...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9162
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 22.04

Re: Getting SEGV when building FG from next

Postby MariuszXC » Thu Nov 04, 2021 3:19 pm

In addition, maybe, as a cross check, try to compile using download_and_compile.sh from fgmeta repo?
This should help to decide if it is the way you set up your compile environment, or a code problem.
INOP
MariuszXC
 
Posts: 1062
Joined: Tue May 18, 2021 5:38 pm
Location: Europe
Callsign: SP-MRM
Version: 2020.4
OS: Ubuntu 16.04

Re: Getting SEGV when building FG from next

Postby TheEagle » Thu Nov 04, 2021 3:47 pm

I was never successful with the download_and_compile.sh script, but it looks like the issue is due to conflicting libraries - the linker is using libraries from several places and several versions mixed … currently trying to clean that up, but now I'm getting:
Code: Select all
CMake Error at /usr/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
  Could NOT find LibLZMA (missing: LIBLZMA_HAS_AUTO_DECODER
  LIBLZMA_HAS_EASY_ENCODER LIBLZMA_HAS_LZMA_PRESET) (found version "5.2.4")
Call Stack (most recent call first):
  /usr/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
  CMakeModules/FindLibLZMA.cmake:87 (find_package_handle_standard_args)
  CMakeLists.txt:185 (find_package)

What to do ? I couldn't find a solution anywhere.
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3433
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Getting SEGV when building FG from next

Postby TheEagle » Thu Nov 04, 2021 3:55 pm

Forget it - I accidentally added -z to the compiler options which prevented some CMake checks to compile.
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3433
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Getting SEGV when building FG from next

Postby TheEagle » Thu Nov 04, 2021 4:24 pm

Actually, fgelev runs without problems. I just discovere that QtGui was disabled in CMake, so I installed the Qt development package … let's hope it finally works now.
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3433
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Getting SEGV when building FG from next

Postby TheEagle » Thu Nov 04, 2021 7:45 pm

After cleaning up my libraries and environment variables it works now. Can some mod please delete the whole thread ? It is of no use to anyone.
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3433
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Getting SEGV when building FG from next

Postby TheEagle » Thu Nov 04, 2021 8:02 pm

Actually it doesn't work :x :cry: It started and built it's NavCache, but then it told me that it can't find QtQuick Controls 2, and that that could be installed with the package qml-module-qtquick-controls2 which is installed. Whatever should I do against that ?
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3433
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Getting SEGV when building FG from next

Postby TheEagle » Thu Nov 04, 2021 8:11 pm

Well whatever …
Code: Select all
export QML2_IMPORT_PATH=/usr/lib/x86_64-linux-gnu/qt5/qml/

did the trick. I just would like to know why the fgfs executable extracted from the 2020.4.0 AppImage knows these paths, and the built one doesn't ?
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3433
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Getting SEGV when building FG from next

Postby wkitty42 » Thu Nov 04, 2021 10:35 pm

probably because the appimage is built with those paths listed whereas the self-built one doesn't retain them... but that's just a guess based on my seeing the build from dnc setting the paths to "" during linking (i think that's where i see it)... do the dnc stuff specifically sets up the environment so the binaries used the stuff that dnc built which explains why the dnc built stuff cannot simply be run from the command line but must use the generated run_fgfs.sh script...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9162
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 22.04


Return to Compiling

Who is online

Users browsing this forum: No registered users and 4 guests