The International Simutrans Forum

 

Author Topic: Latest nightlies require GLIBC_2.29  (Read 1163 times)

0 Members and 1 Guest are viewing this topic.

Offline Vladki

  • Devotee
  • *
  • Posts: 3718
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Latest nightlies require GLIBC_2.29
« on: December 11, 2020, 08:29:11 PM »
Due to bridgewater being upgraded to ubuntu 20.04, the stuff compiled there cannot be run on any older distro:

./simutrans-extended: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by ./simutrans-extended)
./simutrans-extended: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found (required by ./simutrans-extended)


This is due to math functions:

$ objdump -T simutrans-extended|grep GLIBC_2.2[^.]
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.29  log
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.29  pow
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.27  expf
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.29  log2
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.27  powf
0000000000000000      DF *UND*  0000000000000000  GLIBC_2.27  logf

I'm a bit confused, as I thought that all floating point math should be done using the custom float32e8_t type, and thus all fucntions should be implemented by that. So I have looked on the sources.

1. I did not find any use of logf(), expf() or exp()... Only regexp() :-)
2. I found several uses of pow(), log() and log2() that uses arguments of type (double),

Looking at many uses of pow(), they are pow (2, x)  which could be replaced by  1 << x
Also it looks like pow() and log() are often used for choosing colors... And some log() functions are not logarihtms, byt error logging ;)

Anyway, is it desirable to check all occurences of pow(), log() and log2() and try to get rid of them, or at least replace them with pow() and log() operating on float32e8_t ?
I willing to try...

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20776
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Latest nightlies require GLIBC_2.29
« Reply #1 on: December 11, 2020, 08:49:00 PM »
The float32e8_t is used only where code needs to be kept in synchronisation between network client and server. In other cases (e.g. the GUI or map generation), it is better to use native floating point code as it is much faster. It is also better not to diverge too much from Standard in these respects.

I am not sure that I understand why a specific version of glibc should be required; is anyone who knows more about the linking issues know able to throw more light on this?

Offline Vladki

  • Devotee
  • *
  • Posts: 3718
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: Latest nightlies require GLIBC_2.29
« Reply #2 on: December 11, 2020, 09:20:24 PM »
If I compile locally with GLIBC_2.24, and check with objdump I get: GLIBC_2.2.5 for log*, exp* and pow* functions. Only a few fucntions require 2.3.x and overall maximum is GLIBC_2.14  memcpy.
My guess is that the fucntions por log, exp and pow have been changed in 2.27 and 2.29, and thus if you compile simutrans with GLIBC 2.27 or newer, you cannot run it with older Glibc.
I also thought if it may be drawn in by the new compression libray (zstd ?), but I do not expect compression to use floating point calculations.

BTW what version of ubuntu did you use before the upgrade to 20.04 ?  Ubuntu 18.04 uses glibc 2.27 so this should have affected me even before, but it didn't.
So far I found out that the easiest way is to build on system with older glibc

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20776
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Latest nightlies require GLIBC_2.29
« Reply #3 on: December 11, 2020, 09:34:29 PM »
Until the upgrade, I used 16.04, which is why you would not have been affected. For the Stephenson-Seimens server, you might simply find it easier to build your own nightlies rather than downloading the executables from the Bridgewater-Brunel server.

Offline Vladki

  • Devotee
  • *
  • Posts: 3718
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: Latest nightlies require GLIBC_2.29
« Reply #4 on: December 11, 2020, 09:47:52 PM »
I can compile myself, but others may not be able to do so.... Current nightlies are too fresh even for Debian stable (glibc 2.28). And regarding stephenson-siemens, it seems that nobody is playing any more. The game is in the future, so no new vehicles are coming (unless added to the pakset), and the world is probably connected as much as possible. So there is not much space for new development. Maybe if I add some more industries ... I think it was fun but it is time to start a new game.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20776
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Latest nightlies require GLIBC_2.29
« Reply #5 on: December 11, 2020, 10:38:54 PM »
I suspect that it probably is time to start a new game. I am afraid that I do not understand enough about the build and linking process to understand how to make a version that will work with older versions of Linux - the idea of removing all the pow(), log(), etc., is not sustainable for the reasons given above.

If anyone is able to assist with this, it would be appreciated.

Offline Roboron

  • Devotee
  • *
  • Posts: 284
    • Las Gal├ícticas Aventuras de Komoyo Diga
  • Languages: ES, EN
Re: Latest nightlies require GLIBC_2.29
« Reply #6 on: December 12, 2020, 10:27:52 AM »
When deploying the latest Simutrans 122 to Steam, I also had to face a similar problem. I am using a Debian (stable) VM to compile Simutrans, because my main system is rolling release and that would generate an incompatible build for linux distributions with older libraries - exactly your case with glibc. Unfortunately, Debian stable also doesn't have an up-to-date enough version of zstd. In that moment my only ideas were using a newer distro, or just ditching zstd. In the end, I went with the second option, as I thought that compatibility was more desirable.

However, others (not so simple) solutions have come to my mind since then.

1) Don't update the system but instead try to compile a custom zstd (not sure if that would be posible with Debian's current libraries).
2) Use my current distribution and try to solve compatibility issues by linking statically glibc (and others). This may increase significally binary size, but I have not tested.
3) In your case, I suppose you can't simply swap operating systems on your server. But you could run the build on a docker container, provided you choose a linux distribution with an old enough glibc and a new enough zstd :P
4) Alternatively to 3, GitHub actions may be a solution to this.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10642
  • Languages: De,EN,JP
Re: Latest nightlies require GLIBC_2.29
« Reply #7 on: December 12, 2020, 12:27:00 PM »
In github actions you can choose the distribution: ubuntu-16.04 is available.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20776
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Latest nightlies require GLIBC_2.29
« Reply #8 on: December 12, 2020, 02:28:42 PM »
In github actions you can choose the distribution: ubuntu-16.04 is available.

Interesting. If anyone is able to assist in setting up Github Actions, this would be helpful.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10642
  • Languages: De,EN,JP
Re: Latest nightlies require GLIBC_2.29
« Reply #9 on: December 13, 2020, 12:06:55 PM »
ceeac had done this, I think:
https://forum.simutrans.com/index.php/topic,20233.0.html

Otherwise you can use the build environment from standard, essentially just everything in the folder .github

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20776
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Latest nightlies require GLIBC_2.29
« Reply #10 on: December 13, 2020, 12:16:02 PM »
ceeac had done this, I think:
https://forum.simutrans.com/index.php/topic,20233.0.html

Otherwise you can use the build environment from standard, essentially just everything in the folder .github

I believe that this is currently not working for Extended for reasons that are not entirely clear to me - I get an error message e-mail from Github stating that the build has failed every time that I push a commit.

Offline freddyhayward

  • Devotee
  • *
  • Posts: 660
  • Languages: EN
Re: Latest nightlies require GLIBC_2.29
« Reply #11 on: December 13, 2020, 12:24:15 PM »
I believe that this is currently not working for Extended for reasons that are not entirely clear to me - I get an error message e-mail from Github stating that the build has failed every time that I push a commit.
That's because of invalid line endings. Your IDE needs to be configured so that it doesn't produce them.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10642
  • Languages: De,EN,JP
Re: Latest nightlies require GLIBC_2.29
« Reply #12 on: December 13, 2020, 01:01:10 PM »
One could also run ./cleanup_code.sh as quick fix.

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20776
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Latest nightlies require GLIBC_2.29
« Reply #13 on: December 13, 2020, 01:24:07 PM »
That's because of invalid line endings. Your IDE needs to be configured so that it doesn't produce them.

May I ask what specific attribute of the line endings makes them invalid for this purpose so that I can look at reconfiguring Visual Studio not to produce them?

Offline freddyhayward

  • Devotee
  • *
  • Posts: 660
  • Languages: EN
Re: Latest nightlies require GLIBC_2.29
« Reply #14 on: December 13, 2020, 01:37:00 PM »
May I ask what specific attribute of the line endings makes them invalid for this purpose so that I can look at reconfiguring Visual Studio not to produce them?
I'm not sure of the precise terminology, but here are two pull requests that had previously solved the problem: https://github.com/jamespetts/simutrans-extended/pull/305/files https://github.com/jamespetts/simutrans-extended/pull/307/files

Offline jamespetts

  • Simutrans-Extended project coordinator
  • Administrator
  • *
  • Posts: 20776
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Latest nightlies require GLIBC_2.29
« Reply #15 on: December 13, 2020, 04:51:30 PM »
jamespetts

Those remove trailing whitespaces, which is not the same as the line ending type - are you sure that these are the same issue?

Offline Matthew

  • Devotee
  • *
  • Posts: 560
    • Japan Railway Journal
  • Languages: EN, some ZH, DE & SQ
Re: Latest nightlies require GLIBC_2.29
« Reply #16 on: December 13, 2020, 05:29:05 PM »
I believe that this is currently not working for Extended for reasons that are not entirely clear to me - I get an error message e-mail from Github stating that the build has failed every time that I push a commit.

AAAH! This is an unfortunate misunderstanding. I looked into this a few weeks ago and now wish I had posted what I found.  ::( ::( ::( ::( ::( ::'(

The only part of Github Actions that is failing internally is the code check. The actual compilation succeeds when the code check is passed.

This code check is performed by the cleanup_code.sh script, which searches for certain problems including trailing whitespaces and fixes them. On Github, the script exits with an error, which I believe is because it cannot fix the errors. I guess that this is because the Action does not have permission to modify the code, only to run it. So each individual part is doing its job, but Github has been asked to perform irreconciliable goals (protect the code and change the code).

I thought about suggesting removing the cleanup_code.sh, but it does serve a useful purpose. At least one of the contributors (I honestly forget who) has previously submitted PRs with hundreds of random trailing whitespaces (presumably inserted by his editor), so you get a diff which appears to change hundreds of files when the only real change is to one of them. And it's very easy to accidentally add trailing whitespace when you really are editing code.

Another way to solve the problem is for everybody to run `cleanup_code.sh` before submitting (using MinGW Bash for those on Windows), but it seems exactly the sort of automatic process that Github Actions would be perfect for.

ceeac had done this, I think:
https://forum.simutrans.com/index.php/topic,20233.0.html

Otherwise you can use the build environment from standard, essentially just everything in the folder .github

Extended's Github builds will probably fail at the moment because they are set to use `ubuntu-latest`, (= 18.04) and we have suddenly moved to only supporting compilation on 20.04 or later. But our builds already have a notification saying that Github will automatically update `ubuntu-latest` to 20.04; the migration began on 30 November so our respositories will be switched in the next few months without us taking any action. I guess this may also mean that for a while compilation may succeed for some users and not others, since Github have not said whether the migration schedule is on a per-user or per-repository basis.

Also, the setup may need to be changed with all the new dependencies. But they have all come across from Standard and the Standard build works, so in principle ceeac has already done most of the work for us.

Offline freddyhayward

  • Devotee
  • *
  • Posts: 660
  • Languages: EN
Re: Latest nightlies require GLIBC_2.29
« Reply #17 on: December 13, 2020, 08:28:35 PM »
Those remove trailing whitespaces, which is not the same as the line ending type - are you sure that these are the same issue?
No I'm not sure, and it's possible that I have confused the terms. In any case, it should be sufficient to run ./cleanup_code before each commit as prissi suggests.

Offline Vladki

  • Devotee
  • *
  • Posts: 3718
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: Latest nightlies require GLIBC_2.29
« Reply #18 on: December 13, 2020, 10:39:05 PM »
But we already have nighlties for "ubuntu-latest = 20.04"  The point was to provide binaries for 18.04 or 16.04 if possible.

Offline Freahk

  • Devotee
  • *
  • Posts: 1504
  • Languages: DE, EN
Re: Latest nightlies require GLIBC_2.29
« Reply #19 on: December 13, 2020, 10:51:35 PM »
I also have to build simutrans from source on openSUSE Leap 15.2 (which is latest)

Offline Matthew

  • Devotee
  • *
  • Posts: 560
    • Japan Railway Journal
  • Languages: EN, some ZH, DE & SQ
Re: Latest nightlies require GLIBC_2.29
« Reply #20 on: December 14, 2020, 08:08:05 PM »
But we already have nighlties for "ubuntu-latest = 20.04"  The point was to provide binaries for 18.04 or 16.04 if possible.

You are right; I got off-topic at some point.