Unable to build Python PluginExample

Hi,

I’ve been trying to build the Python PluginExample on Ubuntu 18.04.

Now I’m at a point where I don’t know what to do next since I get the “segmentation fault” error and nothing more. (see the log below)

Could you help me out?

System info:

Ubuntu 18.04.5 LTS
.NET Core SDK 2.1.818
.NET Core runtimes 2.1.30
OpenTAP 9.15.2+39e6c2a2
Python 3.6.9
OpenTAP Python plugin 2.2.0+31a47a25

Thank you in advance for you help,


Log:

2021-09-03 09:59:27.434885 ; Session ; Debug ; Session log loaded as ‘/home/testusr/.tap/SessionLogs/tap 2021-09-03 09-59-26.txt’. [8.98 ms]
2021-09-03 09:59:27.452777 ; Session ; Debug ; Running ‘/home/testusr/.tap/tap.dll python build /home/testusr/.tap/Packages/Python/PluginExample -v -b’ in ‘/home/testusr/.tap/Packages/Python/PluginExample’.
2021-09-03 09:59:27.469693 ; Session ; Debug ; Linux 5.4.0-42-generic #46~18.04.1-Ubuntu SMP Fri Jul 10 07:21:24 UTC 2020X64
2021-09-03 09:59:27.469915 ; Session ; Debug ; .NET Core 4.6.30411.01
2021-09-03 09:59:27.480392 ; Resolver ; Debug ; Found 6/30 assembly files. [8.03 ms]
2021-09-03 09:59:27.509612 ; Session ; Debug ; OpenTAP Engine 9.15.2+39e6c2a2 X64
2021-09-03 09:59:27.517392 ; Searcher ; Debug ; Ordered 6 assemblies according to references. [29.7 ms]
2021-09-03 09:59:27.577941 ; PluginManager ; Debug ; Found 4 plugin assemblies containing 166 plugin types. [91.9 ms]
2021-09-03 09:59:27.578498 ; PluginManager ; Debug ; Found version 9.15.2+39e6c2a2 of OpenTap.dll
2021-09-03 09:59:27.578512 ; PluginManager ; Debug ; Found version 9.15.2+39e6c2a2 of OpenTap.Plugins.BasicSteps.dll
2021-09-03 09:59:27.578517 ; PluginManager ; Debug ; Found version 9.15.2+39e6c2a2 of OpenTap.Package.dll
2021-09-03 09:59:27.578522 ; PluginManager ; Debug ; Found version 1.0.0.0 of Keysight.OpenTap.Plugins.Python.dll
2021-09-03 09:59:27.578542 ; PluginManager ; Debug ; Searched 6 Assemblies. [92.8 ms]
2021-09-03 09:59:27.643750 ; PluginManager ; Debug ; Loaded OpenTap. [908 us]
2021-09-03 09:59:27.681814 ; Settings ; Debug ; No settings file exists for EngineSettings. A new instance with default values has been created. [11.1 ms]
2021-09-03 09:59:27.715464 ; Session ; Debug ; Session log loaded as ‘/home/testusr/.tap/SessionLogs/SessionLog 2021-09-03 09-59-26.txt’. [7.65 ms]
2021-09-03 09:59:27.720408 ; PluginManager ; Debug ; Loaded OpenTap.Package. [1.92 ms]
2021-09-03 09:59:27.722470 ; PluginManager ; Debug ; Loaded Keysight.OpenTap.Plugins.Python. [375 us]
2021-09-03 09:59:27.751548 ; PluginManager ; Debug ; Loaded OpenTap.Plugins.BasicSteps. [393 us]
2021-09-03 09:59:27.790425 ; PluginManager ; Debug ; Loaded System.Private.CoreLib. [1.40 us]
2021-09-03 09:59:27.796583 ; CLI ; Debug ; Executing CLI action: python \ build
2021-09-03 09:59:27.834148 ; Resolver ; Debug ; Found match for Microsoft.CodeAnalysis, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 in /home/testusr/.tap/Dependencies/Microsoft.CodeAnalysis.2.10.0.0/Microsoft.CodeAnalysis.dll
2021-09-03 09:59:27.839048 ; Resolver ; Debug ; Found match for Microsoft.CodeAnalysis.CSharp, Version=2.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 in /home/testusr/.tap/Dependencies/Microsoft.CodeAnalysis.CSharp.2.10.0.0/Microsoft.CodeAnalysis.CSharp.dll

3 Likes

Welcome to the OpenTAP Forum @vabe1 ! Great to have you engaged…especially wrt Python! Expect some of the community to engage shortly!

@vabe1 the major focus of our 2.3 release for the Python Plugin is around providing better support on Linux. You can follow that work here:

In the meantime, here are a few scripts that will get everything set up properly. The first one handles the Python configuration (it uses Python 3.7, but you can edit for any version):


#!/bin/bash -x
 
sudo apt-get update; sudo apt-get install -y libc6-dev libunwind8 unzip git curl lsb
 
# Installing python3.7
sudo apt install python3.7 python3.7-dev python3-pip -y
python3.7 -m pip install pip
# sudo ln -s /usr/bin/python3.7 /usr/bin/python
PYTHON_VER=$(python3.7 --version | grep -oP "(\d.*)" )
PYTHON_VER_MAJOR_MIN=$(python3.7 --version |  grep -oP "(\d\.\d)")
echo -e "${GREEN}Found Python ${PYTHON_VER_MAJOR_MIN} [${PYTHON_VER}]${NC}"

# Installing OpenTAP Python SDK Plugin
$OPENTAP_PATH/tap package install Python
if [ $? -ne 0 ]; then
  echo -e "${RED}Unable to install OpenTAP Python SDK!${NC}"
  exit 2
fi

# Setup Python SDK for OpenTAP
PYTHON_DYNLIB="/usr/lib/python${PYTHON_VER_MAJOR_MIN}/config-${PYTHON_VER_MAJOR_MIN}m-x86_64-linux-gnu/libpython${PYTHON_VER_MAJOR_MIN}.so"
PYTHON_PLUGIN="/usr/local/lib/pythonplugin"
PYTHON_PLUGIN_LIB="/usr/local/lib/pythonplugin/libpython${PYTHON_VER_MAJOR_MIN}.so"
[ -f ${PYTHON_PLUGIN_LIB} ] && sudo rm ${PYTHON_PLUGIN_LIB}
[ ! -d ${PYTHON_PLUGIN} ] && sudo mkdir -p ${PYTHON_PLUGIN}
sudo ln -s $PYTHON_DYNLIB ${PYTHON_PLUGIN_LIB}
$OPENTAP_PATH/tap python set-path ${PYTHON_PLUGIN} ${PYTHON_VER_MAJOR_MIN}

The second is to work around a bug that targets Windows instead of Linux.
This for now, replaces: tap python build PluginExample.

You can run it using: sudo ./build_package.sh PluginExample:

#!/bin/bash -x
PACKAGE=$1
sudo tap python build $PACKAGE
sudo tap python build $PACKAGE -b
sudo sed -iE 's;File Path=".*Packages/Python;File Path="Packages/Python;' Packages/Python/$PACKAGE/package.xml
sudo sed -iE 's;OS=\".*\" ;;' Packages/Python/$PACKAGE/package.xml
sudo sed -iE 's;<Package ;<Package OS="Linux" ;' Packages/Python/$PACKAGE/package.xml
sudo tap package create Packages/Python/$PACKAGE/package.xml

opentap_python_setup.sh (1.1 KB)
build_package.sh (417 Bytes)

1 Like

@vabe1 -

Seg Fault usually means one of the native / C packages are missing (lsb is commonly missed):

sudo apt-get update; sudo apt-get install -y libc6-dev libunwind8 unzip git curl lsb

Could also be the python*-dev package (thats where some of the interop happens):

sudo apt install python3.7-dev -y

If you think of other ways to improve the install scripts, let us know!

3 Likes

Thank you Alan and Brennen.

“lsb” was missing, but I still get the segmentation fault.

Today I fixed the dotnet-skd snap permissions following this post:
Cannot run dotnet command after installing 5.0 preview using snap · Issue #4446 · dotnet/core · GitHub

I also uninstalled and reinstalled the Python package.

Do I need to download any other packages (SDK, etc.) ?

Should I reinstall OpenTap altogether since the snap permissions might have corrupt anything?

@vabe1 are you on Ubuntu 20.04? At this point we only support 18.04, and that segmentation fault seems to be a dotnet issue that appears specifically on 20.04 that we are working to solve.

EDIT: Nevermind. I see above you say 18.04. My recommendation is that now that yo have the dotnet issue resolved, to delete/rename your .tap directory and rerun the install script.