> Hi. 
>
>I tried to build the firefox 48.0.2 under BLFS 7.10 (System V version) but the 
>building process reported a Python Error message:
>
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 36: 
> ordinal not in range(128)
>
> The environment variable "LANG " was set to en_US.utf8 and the "LC_CTYPE" was 
> "en_US.utf8".
>
> Does anyone have an idea to fix it?

After some tests, I found two methods to "remove" that Python error:

1. After the command "make -f client.mk" is fail, just execute it again. I.e.

make -f client.mk
make -f client.mk

2. Modify configure.py to set the current default string encoding from "ascii" 
to "utf-8" :

sed -i '/import sys/ a\
\
reload(sys) \
sys.setdefaultencoding("utf-8")' configure.py

make -f client.mk

The reference of the function "sys.setdefaultencoding()" : 
https://docs.python.org/2.7/library/sys.html#sys.setdefaultencoding
However, I found that the use of "sys.setdefaultencoding()" has always been 
discouraged. (Reference: 
http://stackoverflow.com/questions/3828723/why-should-we-not-use-sys-setdefaultencodingutf-8-in-a-py-script
 )

Anyhow, if we modify the default string encoding, the output of the building 
process becomes:

mkdir -p '/sources/firefox-48.0.2/firefox-build-dir/'
python2.7 /sources/firefox-48.0.2/config/pythonpath.py -I 
/sources/firefox-48.0.2/testing/mozbase/mozfile \
    /sources/firefox-48.0.2/python/mozbuild/mozbuild/controller/clobber.py 
/sources/firefox-48.0.2 /sources/firefox-48.0.2/firefox-build-dir
Clobber not needed.
> /sources/firefox-48.0.2/firefox-build-dir/.mozconfig.mk
make -f /sources/firefox-48.0.2/client.mk realbuild CREATE_MOZCONFIG_JSON=
make[1]: Entering directory '/sources/firefox-48.0.2'
Adding client.mk options from /sources/firefox-48.0.2/mozconfig:
    MOZ_OBJDIR=/sources/firefox-48.0.2/firefox-build-dir
    OBJDIR=/sources/firefox-48.0.2/firefox-build-dir
    FOUND_MOZCONFIG=/sources/firefox-48.0.2/mozconfig
make[2]: Entering directory '/sources/firefox-48.0.2'
cp /sources/firefox-48.0.2/mozconfig 
/sources/firefox-48.0.2/firefox-build-dir/.mozconfig
cd /sources/firefox-48.0.2/firefox-build-dir
/sources/firefox-48.0.2/configure
Creating Python environment
New python executable in 
/sources/firefox-48.0.2/firefox-build-dir/_virtualenv/bin/python2.7
Also creating executable in 
/sources/firefox-48.0.2/firefox-build-dir/_virtualenv/bin/python
Installing setuptools, pip, wheel...done.
running build_ext
building 'psutil._psutil_linux' extension
creating build/temp.linux-i686-2.7
creating build/temp.linux-i686-2.7/psutil
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes -fPIC -DPSUTIL_VERSION=311 -I/usr/include/python2.7 -c 
psutil/_psutil_linux.c -o build/temp.linux-i686-2.7/psutil/_psutil_linux.o
psutil/_psutil_linux.c: In function ‘init_psutil_linux’:
psutil/_psutil_linux.c:652:54: warning: overflow in implicit constant 
conversion [-Woverflow]
     PyModule_AddIntConstant(module, "RLIM_INFINITY", RLIM_INFINITY);
                                                      ^~~~~~~~~~~~~
creating build/lib.linux-i686-2.7
creating build/lib.linux-i686-2.7/psutil
gcc -pthread -shared build/temp.linux-i686-2.7/psutil/_psutil_linux.o 
-L/usr/lib -lpython2.7 -o build/lib.linux-i686-2.7/psutil/_psutil_linux.so
building 'psutil._psutil_posix' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c psutil/_psutil_posix.c -o 
build/temp.linux-i686-2.7/psutil/_psutil_posix.o
gcc -pthread -shared build/temp.linux-i686-2.7/psutil/_psutil_posix.o 
-L/usr/lib -lpython2.7 -o build/lib.linux-i686-2.7/psutil/_psutil_posix.so
copying build/lib.linux-i686-2.7/psutil/_psutil_linux.so -> psutil
copying build/lib.linux-i686-2.7/psutil/_psutil_posix.so -> psutil

Reexecuting in the virtualenv

As you see, GCC 6.x will use something likes "^~~~" to indicate the errors and 
the current building script cannot handle it.
-- 
http://lists.linuxfromscratch.org/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to