question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CLR not working on 32 bit Linux

See original GitHub issue

Environment

  • Pythonnet version: 2.5.1 and also 3.0.0-dev
  • Python version: 3.5.3, 2.7.13 and also 3.8.5 (from Debian repositories and also if compiled locally with --enable-shared)
  • MONO Versions: 6.10, 5.16 and also 5.20
  • Operating System: Linux (Debian 9 ‘stretch’ Live, i686)

Details

Pythonnet seems not to be working on a Linux 32-Bit environment (i686) at all. I tested it on a “Debian live” (USB) system in two different computers, using Python from the Debian repositories and also building python from source code, here are the results:

  • Using Python from the Debian repositories: The python execution crashes just doing import clr See attachment: mono_crash.4383a3eb2.0.zip, trace.txt

  • Building Python from source code (with --enable-shared):

It doesn’t crash, but clr throws an error when trying to load an assembly (“AttributeError: module ‘clr’ has no attribute ‘AddReference’”). This was reported in some places around internet, but I don’t have any clr module already installed which could cause a name collision. See output:

user@debian:~$ /opt/python/python3.5.3/bin/python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import clr
>>> dir(clr)
['__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'facade']
>>> str(clr)
"<module 'clr' from '/opt/python/python3.5.3/lib/python3.5/site-packages/clr.cpython-35m-i386-linux-gnu.so'>"
>>> 
user@debian:~$ /opt/python/python3.5.3/bin/pip3 list
clang (11.0)
pip (9.0.1)
pycparser (2.20)
pythonnet (2.5.1)
setuptools (28.8.0)
wheel (0.35.1)

Notes

  • On a x64-System it works, using the same version of Debian, Pythonnet and Python.
  • If this is really a limitation of 32-Bit-Systems that cannot be fixed, it should be documented on the “readme”.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:21 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
jborbelycommented, Nov 4, 2020

@filmor A summary of bisecting is available here

The criteria that I used to decide if a commit was good or bad was by running the following bash script (which I named issue1210.sh) after each bisect iteration. If pytest passed then that commit was considered good.

#!/bin/bash
export LD_PRELOAD=/lib/i386-linux-gnu/libSegFault.so
export SEGFAULT_SIGNALS=all
export PYTHONUNBUFFERED=True
export BUILD_OPTS=""
export NUNIT_PATH="./packages/NUnit.ConsoleRunner.3.7.0/tools/nunit3-console.exe"
export RUN_TESTS="mono $NUNIT_PATH"
export EMBED_TESTS_PATH=""
export PERF_TESTS_PATH=""
source ~/py37env/bin/activate
python --version
pip --version
PY_LIBDIR=$(python -c 'import sysconfig; print(sysconfig.get_config_var("LIBDIR"))')
export LD_LIBRARY_PATH=$PY_LIBDIR:$LD_LIBRARY_PATH
pip install --upgrade setuptools
pip install --upgrade -r requirements.txt
pip uninstall pythonnet -y
coverage run setup.py install $BUILD_OPTS
python -m pytest

Please let me know if you’d like further information.

0reactions
lostmsucommented, Jan 14, 2022

@filmor have you tried with .NET Core? If the behavior is different, I would simply open a bug in Mono.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - CLR not working on 32 bit Linux -
Notes. On a x64-System it works, using the same version of Debian, Pythonnet and Python. If this is really a limitation of 32-Bit-Systems...
Read more >
MSSQL on Linux: Common Language Runtime (CLR) not ...
This installation of the Common Language Runtime (CLR) is corrupted. The CLR is installed with the Microsoft .NET Framework.
Read more >
Does a CLR Class Library have to be run in Win32?
Right-click the C# project > Properties > Build tab to select the jitter you want to use. Untick the "Prefer 32-bit" checkbox for...
Read more >
First Time Using Wine : r/wine_gaming
Hi Im running Ubuntu 20.04 LTS. And i installed wine and blindly copied and ... Unhandled exception: 0xe0434352 in 32-bit code (0x7b00dfa2).
Read more >
Restrictions on .NET CLR routines
Running a 32-bit CLR routine on a 64-bit instance. CLR routines cannot be run on 64- bit instances, because the .NET Framework cannot...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found