News:

SimuTranslator
Make Simutrans speak your language.

[BUG] Line colours depend on SDL2 (was: Command line server build failed)

Started by Matthew, February 22, 2022, 07:10:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Matthew

Bridgewater-Brunel did not restart after this morning's reset. The datestamp of the Command Line Server Build indicates that compilation of the latest headless nightly failed. The SDL2 build works fine.

GitHub Actions also reported that headless compilation failed because of a linking problem:

[100%] Linking CXX executable simutrans/simutrans-extended
/usr/bin/ld: CMakeFiles/simutrans-extended.dir/gui/line_color_gui.cc.o: in function `line_color_gui_t::line_color_gui_t(quickstone_tpl<simline_t>)':
line_color_gui.cc:(.text+0x6d6): undefined reference to `line_color_idx_to_rgb(unsigned char)'
/usr/bin/ld: CMakeFiles/simutrans-extended.dir/gui/line_color_gui.cc.o: in function `line_color_gui_t::init()':
line_color_gui.cc:(.text+0xf48): undefined reference to `line_color_idx_to_rgb(unsigned char)'
/usr/bin/ld: line_color_gui.cc:(.text+0xffb): undefined reference to `line_color_idx_to_rgb(unsigned char)'
/usr/bin/ld: CMakeFiles/simutrans-extended.dir/gui/line_color_gui.cc.o: in function `line_color_gui_t::line_color_gui_t(quickstone_tpl<simline_t>)':
line_color_gui.cc:(.text+0x1a76): undefined reference to `line_color_idx_to_rgb(unsigned char)'
/usr/bin/ld: CMakeFiles/simutrans-extended.dir/gui/line_color_gui.cc.o: in function `line_color_gui_t::action_triggered(gui_action_creator_t*, value_t)':
line_color_gui.cc:(.text+0x2632): undefined reference to `line_color_idx_to_rgb(unsigned char)'
/usr/bin/ld: CMakeFiles/simutrans-extended.dir/gui/line_color_gui.cc.o:line_color_gui.cc:(.text+0x26d0): more undefined references to `line_color_idx_to_rgb(unsigned char)' follow
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [CMakeFiles/simutrans-extended.dir/build.make:5909: simutrans/simutrans-extended] Error 1
make[2]: *** [CMakeFiles/Makefile2:118: CMakeFiles/simutrans-extended.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:125: CMakeFiles/simutrans-extended.dir/rule] Error 2
make: *** [Makefile:189: simutrans-extended] Error 2


The two things are not necessarily related because I believe B-B uses the traditional Makefile while GitHub Actions uses CMake, but it seems plausible. The Command Line Server wouldn't necessarily know about colours.

The first commit where GitHub Actions reports a headless build failure is this change to the Japanese help texts, which makes no sense to me. I guess it's a quirk of the order in which the rosen-color-2202 patches were merged?

EDIT: Yes, it looks as though line_color_idx_to_rgb() calls get_system_color(), which calls code from SDL2:

"Screenshot of code showing line_color_idx_to_rgb() calls get_system_color() which calls SDL2 functions

And line_color_idx_to_rgb() is called in simline.cc, which is part of command line server builds:

"Screenshot from VS Code showing simline.cc

I guess that might explain why GitHub's GDI builds for Windows are failing too?
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。

Ranran

SimutransSourceList.cmake doesn't have a simgraph so it doesn't have a link. But I can't think of a workaround for this as it doesn't seem to intentionally list it for graphics.  :-[

Roboron

The backend-specific sources are not included in SimutransSourceList.cmake but in the top CMakeLists.txt. Specifically, for headless server, in this line https://github.com/jamespetts/simutrans-extended/blob/master/CMakeLists.txt#L171

jamespetts

Apologies for this difficulty. I do not think that I am familiar enough with the line colour system easily to be able to fix this.

Ranran, why does the command line only version need to know about the colours - is this in order to save them? If so, we probably need to find a way to separate the references to the colours from the actual processing/displaying of the colours, so that the command line server builds can retain the referencing of the colours without actually having to have all the code for displaying the colours. Do you think that you would be able to modify the system so as to provide for this?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

TurfIt

Headless server uses simgraph0.cc, not simgraph16.cc.
Stub function for line_color_idx_to_rgb() was not added to simgraph0.cc...

Ranran

Quote from: TurfIt on February 22, 2022, 06:18:08 PMStub function for line_color_idx_to_rgb() was not added to simgraph0.cc...
Ah, yes. It was just the usual careless mistake I had made several times...
That will be fixed in the pull request #512. I apologize for the inconvenience.

jamespetts

Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.