rinigus / osmscout-server

Maps server providing tiles, geocoder, and router
https://rinigus.github.io/osmscout-server
GNU General Public License v3.0
164 stars 28 forks source link

Mapnik exception: locale::facet::_S_create_c_locale name not valid #191

Closed ghost closed 7 years ago

ghost commented 7 years ago

Using Dutch (community) translation of Sailfish, no maps are loaded in Poor Maps when using Mapnik. I don't know if it's a problem with the translation (and if so, where), or with OSM Scout Server.

rinigus commented 7 years ago

I will look into it. Would you mind to run locale in terminal and paste its output?

rinigus commented 7 years ago

From the search online for "locale::facet::_S_create_c_locale name not valid" I can see that this could be an issue with the missing locale in the system. I wonder whether the used translation has enabled the corresponding locale.

ghost commented 7 years ago
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=nl_NL.utf8
LANGUAGE=
LC_CTYPE="nl_NL.utf8"
LC_NUMERIC="nl_NL.utf8"
LC_TIME="nl_NL.utf8"
LC_COLLATE="nl_NL.utf8"
LC_MONETARY="nl_NL.utf8"
LC_MESSAGES="nl_NL.utf8"
LC_PAPER="nl_NL.utf8"
LC_NAME="nl_NL.utf8"
LC_ADDRESS="nl_NL.utf8"
LC_TELEPHONE="nl_NL.utf8"
LC_MEASUREMENT="nl_NL.utf8"
LC_IDENTIFICATION="nl_NL.utf8"
LC_ALL=
rinigus commented 7 years ago

This looks like you have a broken locale and your device does not support nl_NL.utf8. You would have to generate the locale that you use. In regular Linux, its frequently locale-gen that should help you. In SFOS, I don't seem to have it on device.

Please file the bug with the NL translation or ask for help from them. While Mapnik is throwing an exception, I presume its a correct way of handling your issue. You may have many other programs broken as well with such locale setup.

ghost commented 7 years ago

Somehow everything else is and has been working correctly (as far as I can tell), so I'm surprised it's causing a problem here. I'll ping @martonmiklos who is creating the translation packages.

rinigus commented 7 years ago

That's a good idea to ping @martonmiklos . Most probably Qt/QML manages to work around locale issue, but Mapnik is not having such workaround. I presume that fixing locale absence is a correct way to approach it.

martonmiklos commented 7 years ago

Hi guys,

When you install the community lang pack the following is run by the %post section of the RPM: localedef --replace -i %{LOCNAME} -f UTF-8 %{LOCNAME}.utf8 --prefix=/ where LOCNAME is nl_NL in the Dutch case.

I have tried to install it on my JP1, but the installation fails when trying to install the libsailfishapp-launcher dependency.

If you have any ideas what else shall be set in the RPM installation process please let me know. To be honest there are several strange issues with the community translations, see: https://together.jolla.com/question/162717/alarm-clock-indicator-is-missing

rinigus commented 7 years ago

Maybe this will help: https://unix.stackexchange.com/a/140303 ? I wonder if you need to use -c?

martonmiklos commented 7 years ago

Hmm that might make sense.

@d9h20f could you please run the following command with root access:

_localedef -i nl_NL -f UTF-8 nlNL.utf8 --force

And then see how the Poor maps behaves? Thanks in advance!

ghost commented 7 years ago

@martonmiklos I checked, after entering that command the output of locale is still the same, and Mapnik doesn't work.

rinigus commented 7 years ago

@d9h20f: thanks! We should probably send the message around and ask how to fix locale problem. Do you want to write it in some general forum, like TJC or sailfish developers list?

martonmiklos commented 7 years ago

We could also ping @sledges because he helped me in the past with the community translations.

rinigus commented 7 years ago

To me, it looks like a general issue and would be good to resolve it in the forum that's accessible to everyone. I expect that the solution will be found (and probably rather simple) and it would be good to record it somewhere. That would allow us to fix these problems with the other translations as well.

martonmiklos commented 7 years ago

I agree, and of course I will update the lang packs managed by me if we find a solution. Btw: it should affect all the community language packs since the same rpm script is run for each. It might makes sense to try out with different languages just to be 100% sure that it is related to the lang packs.

rinigus commented 7 years ago

Going somewhat stale over time. Did you find the solution? Should we close the issue and try to resolve it somewhere where its supposed to be resolved - proper exposure of locale to the system?

sledges commented 7 years ago

Sorry been a bit busy:) Have you tried another non-official language? Like Hungarian?

rinigus commented 7 years ago

Not to my knowledge. @d9h20f / @martonmiklos - would you mind to test? I don't have any unofficial translations on my phone, better if someone knowing what they are doing is gonna test it

martonmiklos commented 7 years ago

Sure I can test it. Could you please provide me some instructions how to test (I never used OSM Scout server before).

I have OSM Scout Server installed, started the getting started wizard and it tells me that I should install the Scout Server Modules: Font and Route. Unfortunately I cannot install the fonts package: kepernyomentes_20170925_001

Is there any way to check the version restriction of the package dependencies?

rinigus commented 7 years ago

That's rather odd error, I would expect that this library is there. Try to get via Jolla Store or refresh the repos using pkcon refresh . The font module is needed to get Mapnik working, subject of the test. But routing is good to have as well, to be able to calculate routes offline.

As soon as modules are on, please select defaults in the Wizard, enable autostart for simplicity, and download the maps (World overlay + libpostal datasets selected automatically, and the region of interest). Then you can access maps via Poor Maps or modRana.

Note that we have Users Manual at https://rinigus.github.io/osmscout-server/en/ which should help you if you are in trouble.

ghost commented 7 years ago

Rollout of 2.1.1.26 was stopped, so maybe the whole release is removed from Jolla's servers.

I had the Hungarian community translation installed so I just checked, and:

ghost commented 7 years ago

Actually, disregard my previous comment. After reloading the Dutch translation, I get the same results as with the Hungarian translation. Maybe the 'locale::facet' etc notice was on the tablet, as I'm using my phone now. I'll check things properly this weekend.

rinigus commented 7 years ago

Mapnik not available could be due to absent Fonts module or absent maps. That's different error. Can you check whether there are other error messages in logs?

ghost commented 7 years ago

You're right, the world coastlines aren't downloaded yet. I'll have to check this weekend if I can still reproduce the problem after those maps are on the device. If not, the issue could even be specific to the tablet (which also has issues with translations of Android applications).

rinigus commented 7 years ago

Good, then its intended behavior. As for locale issue, if locale command leads to

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

its misconfigured locale that should be fixed. With the misconfigured locale you should expect issues for many cases.

ghost commented 7 years ago

Okay, this turned out to be interesting. I downloaded the required coastlines on the phone and did some testing on both devices. I changed the locale to Hungarian, still didn't work. I changed it back to Dutch, and checked the output of locale again because I wanted to check if the output was the same on the tablet as on the phone. Surprisingly, I didn't get those three error messages again, but only on the tablet. They still appear on the phone, although I can't remember doing anything different. I then checked the Poor Maps + OSM Scout Server combination again to see if there were any differences in error messages and... it worked on the tablet! Then I changed the phone's locale to Finnish, changed it back to Dutch, and now I don't get any of the locale error messages anymore either, and the maps work. I suppose there was an issue in one of the earliest versions of the community translation packs that got fixed but somehow couldn't fix itself.

Even better, @martonmiklos and @sledges, the issue with the missing alarm clock indicator is now also fixed! The solution thus seems to be: select one of the officially supported languages, then change back to your community translation. By the way, @martonmiklos, this reminds me: if you have some time, you can update the Dutch translation pack with the latest strings.

rinigus commented 7 years ago

@d9h20f: thank you for looking into it! Great to hear that you managed to resolve locale issues on your device

ghost commented 7 years ago

Well, after a crash the issue returned, and I can't get the alarm icon back, and of course Mapnik refuses to work again. At least we know it's a problem with the locale, now we just need to find what's going wrong all the time.

corndog2000 commented 4 years ago

Was there a good solution found for this problem?

rinigus commented 4 years ago

No, nobody has been working on it. The work is now focused on Mapbox GL tiles instead and I haven't had time to work on Mapnik. Taking into account that the use of this backend is rather small, nobody stepped up to help with it either. Maybe, if mapnik upstream gets updated by releasing new version, we can try to see whether they fixed this issue as well.

martonmiklos commented 4 years ago

And at the other hand the most of the community translations found their way into the official Jolla images. I do not know the exact localization distribution method of the community translated languages, but I think they are not installed separately by RPM packages anymore. I mean here that the RPM post install scripts no longer modifying the locale.