You are not logged in.

#1 2018-06-22 10:04:13

Oinkium
Member
Registered: 2016-01-20
Posts: 5

Specifying that a locale should exist in PKGBUILD

I'm developing a PKGBUILD (agda-git in the AUR), and I've discovered that it fails to build correctly if the

en_US.utf8

locale has not been generated.  If I generate the locale by uncommenting its entry in

/etc/locale.gen

and running

# locale-gen

, then the build works fine. 

Is it possible to add the locale as a dependency for the PKGBUILD?  The Wiki entry doesn't seem to mention it.

Offline

#2 2018-06-22 10:41:29

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,532
Website

Re: Specifying that a locale should exist in PKGBUILD

Whether or not you can, you definitely should not.  There should be compile options for the software so it doesn't depend on a specific locale.  How does it fail to build, what are the errors?

I've been grepping over the code, I see no reason at all it should require an en_US locale.  It does assume a UTF-8 locale, but there shouldn't be any reason that it'd have to be en_US.  But even this is to run, not to build.

Last edited by Trilby (2018-06-22 10:49:04)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2018-06-22 10:54:17

progandy
Member
Registered: 2012-05-17
Posts: 5,196

Re: Specifying that a locale should exist in PKGBUILD

Does it have to be en_US.utf8 or is the problem that $LANG is not set to any utf8 locale? You should always use an utf8 system locale.

@Trilby: If the source code contains utf8 characters and ghc is converting source file encodings during the compilation process, then there may be issues.
Edit: I don't think that should be the case. Maybe the build process somewhere compares some output to an utf8 string and then errors out?

Last edited by progandy (2018-06-22 11:05:46)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#4 2018-06-22 12:47:48

Oinkium
Member
Registered: 2016-01-20
Posts: 5

Re: Specifying that a locale should exist in PKGBUILD

@propagandy It has to be the US locale: the system where the build failed was using en_GB.utf8

@trilby It seems to be a known workaround to avoid build errors.  For example, the PKGBUILD for the agda package in the official repositories also sets the locale temporarily to en_US.utf8 when building. 

I'm not at a computer at the moment, but I'll post the specific error message later on.  I should also send a bug report upstream.

See also: http://wiki.portal.chalmers.se/agda/pmw … otes-2-4-2 point 3', which recommends changing the locale in order to avoid error messages very similar to the ones I was getting (these instructions are for Windows, but the principle seems to be the same).

Offline

#5 2018-06-22 15:10:39

progandy
Member
Registered: 2012-05-17
Posts: 5,196

Re: Specifying that a locale should exist in PKGBUILD

If you really need en_US, then you can do something like this in build():

if ! locale -a | grep -q "^en_US.utf8$" ; then 
    error "locale en_US.utf8 is required"
    return 1
fi
LC_CTYPE=en_US.utf8 runhaskell

| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

Board footer

Powered by FluxBB