conda-forge / gettext-feedstock

A conda-smithy repository for gettext.
BSD 3-Clause "New" or "Revised" License
0 stars 20 forks source link

xgettext segfaults on Windows #16

Open btel opened 3 years ago

btel commented 3 years ago

Issue: xgettext segfaults on Windows

example file:

$ cat test_gettext.py
print(_("hello world"))

execution from command line:

$ xgettext --language=Python test_gettext.py --output=-
Segmentation fault

No output is produced but only segmentation fault.

Expected output:

$ xgettext.exe --language=Python test_gettext.py --output=-
warning: Could not open file /usr/share/gettext/styles/po-default.css
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-03-31 19:09+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: test_gettext.py:1
msgid "hello world"
msgstr ""


Environment (conda list):

``` $ conda list # packages in environment at C:\Users\Bartosz\miniforge3\envs\gettext: # # Name Version Build Channel ca-certificates 2021.1.19 haa95532_1 certifi 2020.12.5 py39haa95532_0 gettext 0.19.8.1 h1a89ca6_1005 conda-forge libffi 3.3 h0e60522_2 conda-forge libiconv 1.16 he774522_0 conda-forge openssl 1.1.1k h2bbff1b_0 pip 21.0.1 py39haa95532_0 python 3.9.2 h6244533_0 setuptools 52.0.0 py39haa95532_0 sqlite 3.35.3 h2bbff1b_0 tzdata 2020f h52ac0ba_0 vc 14.2 h21ff451_1 vs2015_runtime 14.27.29016 h5e58377_2 wheel 0.36.2 pyhd3eb1b0_0 wincertstore 0.2 py39h2bbff1b_0 ```


Details about conda and system ( conda info ):

``` $ conda info active environment : gettext active env location : C:\Users\Bartosz\miniforge3\envs\gettext shell level : 2 user config file : C:\Users\Bartosz\.condarc populated config files : C:\Users\Bartosz\miniforge3\.condarc C:\Users\Bartosz\.condarc conda version : 4.9.2 conda-build version : not installed python version : 3.8.8.final.0 virtual packages : __cuda=11.0=0 __win=0=0 __archspec=1=x86_64 base environment : C:\Users\Bartosz\miniforge3 (writable) channel URLs : https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch https://conda.anaconda.org/conda-forge/win-64 https://conda.anaconda.org/conda-forge/noarch package cache : C:\Users\Bartosz\miniforge3\pkgs C:\Users\Bartosz\.conda\pkgs C:\Users\Bartosz\AppData\Local\conda\conda\pkgs envs directories : C:\Users\Bartosz\miniforge3\envs C:\Users\Bartosz\.conda\envs C:\Users\Bartosz\AppData\Local\conda\conda\envs platform : win-64 user-agent : conda/4.9.2 requests/2.25.1 CPython/3.8.8 Windows/10 Windows/10.0.18362 administrator : False netrc file : None offline mode : False ```
rsepulvedacl commented 2 years ago

I had this issue while trying to execute python manage.py makemessages -l es, in a Django installation. So, after a lot of research, I installed Gettext 0.21 (64 bit, static) from https://mlocati.github.io/articles/gettext-iconv-windows.html.

Then, I took the binary from C:\Program Files\gettext-iconv\bin\xgettext.exe and replaced the one I had on C:\tools\miniconda3\envs\my_venv\Library\bin\xgettext.exe and the first command worked. You may find this last location with the command where xgettext.exe.

It seems that conda-forge grabs a shared version (not static) of Gettext 0.19.8.1 that doesn't work very well.