arm-none-eabi-gdb cannot start because of some python error - c++

I'm trying to use arm-none-eabi-gdb as the debugger for my stm32 project, but when I try to execute it, it return the following error:
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007f75639ddc00 (most recent call first):
Aborted (core dumped)
I look online and find this solution, but when I enter export PYTHONHOME=/usr/local it come out annother error message that I cannot find any solution:
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007fcc24680c00 (most recent call first):
Aborted (core dumped)
I've check that my python and python3 work ok, Is there anything I should check for?
Thank you ~
The arm gcc_tool_chain version I'm using is 11.2-2022.02 for x86_64 Linux hosted which I download from the official website. And After downloading it, I just unzip it and add the toolchain directory into $PATH. I did not compile or install and I'm not sure if I should do any of those since I download the binary version(gcc-arm-11.2-2022.02-x86_64-arm-none-eabi.tar.xz) and the arm-none-eabi-g++ compiler works perpectly.

It is weird that on my machine with python3.10 and kubuntu 22.10 it is working with gdb from 10.3. But 11.3 is complaining

I think you truncated the message you received! I had same problem.
arm-none-eabi-gdb looks for specific python version that explained at end of the message! Mine was 3.8 whereas I already had 3.10. so I decided to install python 3.8 in parallel with my installed version. After some search I found a way:
sudo add-apt-repository ppa:deadsnakes/ppa
apt update
sudo apt install python3.8
You can find more information in this site.

Related

YouCompleteMe completed failed

➜ YouCompleteMe git:(master) ./install.py --clang-completer
Searching Python 3.7 libraries...
ERROR: Python headers are missing in /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/Headers.
I used brew to install python and have not downloaded Xcode
Ended here after having the same problem. The problem in my case was that the python version that was being used was not the correct one. So even after executing:
brew reinstall python3
I was getting the error.
What finally fixed the issue was to explicitly state which python interpreter to use:
/usr/local/bin/python3.9 install.py --all
In my case, I needed to close iTerm and re-open it. So if reinstalling python3 didn't work, try this or alternatively:
source ~/.zshrc
I encountered this problem because of multiple python installations on my machine, one is anaconda python, another is standard python.
I will introduce every step I've done to deal with it.
At first, I used anaconda Python to build YCM. The YCM Server cannot be started and I got the cause from this issue. But when I tried to install YCM using standard Python with the command:
$ /usr/bin/python3 install.py --go-completer --clang-completer --go-completer
The result of execution is an error message as follows:
ERROR: Python headers are missing in /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers.
The installation failed; please see above for the actual error. In order to get more information, please re-run the command, adding the --verbose flag. If you think this is a bug and you raise an issue, you MUST include the *full verbose* output.
For example, run:/Library/Developer/CommandLineTools/usr/bin/python3 /Users/jianxue/.vim/bundle/YouCompleteMe/third_party/ycmd/build.py --go-completer --clang-completer --go-completer --verbose
I was so confused for a long time. And at last, I tried to deactivate the anaconda python, and the standard Python was the default one now.
python3 install.py --go-completer --clang-completer --go-completer
Succeed! I guess anaconda overrides the python configurations. Although I used the standard python, the c header for python still couldn't be found by OS.

Can't compile fabric on windows - missing ltdl.h

I am trying to build a chaincode using go build.
Environment:
installed go 1.8.3 windows/amd
Windows 10
When I run go build I get the following error:
# github.com/hyperledger/fabric/vendor/github.com/miekg/pkcs11
..\..\github.com\hyperledger\fabric\vendor\github.com\miekg\pkcs11\pkcs11.go:29:18: fatal error: ltdl.h: No such file or directory
compilation terminated.
I checked and my GCC installation does not contain the ltdl.h file in the include folder.
I found a SO post with a solution for Linux, but not one for Windows.
Can someone help?
On windows you can build without PKCS
go build --tags nopkcs11
Try running the following command
sudo apt install libtool libltdl-dev
Make sure go get -u github.com/hyperledger/fabric/core/chaincode/shim throws no error then go build it.

Anaconda error after install on Windows

I want to install Anaconda on my x64 Windows machine, and I downloaded the Python 2.7 version 64-bit installer. The installation process looks good.
Then I installed pip with choco and installed several packages like zbar,
however, when I want to try to launch Anaconda, I entered conda in Powershell, this is what I got:
Traceback (most recent call last):
File "C:\Users\Ruiyang\Anaconda2\Scripts\conda-script.py", line 3, in <module>
import conda.cli
ImportError: No module named conda.cli
Does anyone knows how to fix this?
add anaconda's bin directory to path.
set path=whatever\anaconda\bin;path;
This issue is related to the path variable setting. Quoting from another SO post:
fire up your interpreter and add this line: export PATH=/Users/add
your username here/anaconda/bin:$PATH
Now type python into the interpreter and you will see Anaconda 1.8.0
or whatever version you have. You will have to do this each time you
start a new interpreter.
Also, note that this might occur when the user name in the path on windows contains a space character. Taken from here.
Though #devautor's method doesn't work for me, a comment in his reference shows me the correct answer:
Unset both PYTHONPATH and PYTHONHOME, then my problem is solved.

Hello World in OpenCV (compiling and linking from source on Ubuntu)

I'm trying to compile OpenCV from source and create a test C++ program which uses the newly compiled OpenCV library.
Compiling OpenCV appears to work, I followed this guide.
But now I want to create a test program which uses the library.
I followed this guide, but and everything appeared to work until I tried the command:
./DisplayImage lena.jpg
Which gave me the following error
OpenCV Error: Unspecified error (The function is not implemented.
Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you
are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then
re-run cmake or configure script) in cvNamedWindow, file
/media/chris/Archive2/Archive/Programming/OpenCV/sav/opencv/modules/highgui/src/window.cpp,
line 550 terminate called after throwing an instance of
'cv::Exception' what():
/media/chris/Archive2/Archive/Programming/OpenCV/sav/opencv/modules/highgui/src/window.cpp:550:
error: (-2) The function is not implemented. Rebuild the library with
Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian,
install libgtk2.0-dev and pkg-config, then re-run cmake or configure
script in function cvNamedWindow
Aborted (core dumped)
the mentioned packages appear to be installed
I've tried rebooting my computer after installing the packages and I still get the same message.
Solved it
Looks like I was missing some of the packages mentioned in http://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html
even though libgtk and pkg-config were installed

A Python Exception error in gdb 7.10

I have installed gdb 7.10 under Ubuntu 14.04 by compiling from the source as detailed in this answer (with the only exception that I copied the executable into /usr/bin). When I execute commands in gdb, I get the following error:
Python Exception <type 'exceptions.NameError'> Installation error: gdb.execute_unwinders function is missing:
What can I do to get rid of it?
What can I do to get rid of it?
GDB wants to install more than just the GDB binary. To make a complete installation, remove /usr/bin/gdb and do make install.