Segmentation fault while executing led.py
Hello,
I am using Artik710 development kit to communicate with metamotionC module.
I followed the steps as mentioned in the Readme for the Python SDK.
While done with the given steps after executing the example script led.py, I get the following segmentation fault error:
[root@artik examples]# python3 led.py
[ 480.280000] pgd = ffffffc0286c7000
[ 480.280000] [00000030] *pgd=0000000068fdc003, *pud=0000000068fdc003, *pmd=0000000000000000
Segmentation fault
details are provided in the text file attached!
I have gone through the earlier segmentation fault queries, but none solved the issue. Can some one please help me out with this since I have been stuck on this for a long time now.
This discussion has been closed.
Comments
Use the latest metawear package (v0.5.0 as of this post).
It's highly likely the underlying C++ sdk needs to be tweaked for your specific board, however, we do not have an Artick 710 board nor do we support it. The first thing you should do is clone the C++ SDK and try running the unit tests on your machine.
Hello Eric,
Thank you for the quick response.
I followed the steps given by you and after running the unit tests of the Cpp-sdk it gave the following error:
make test
mkdir -p build/x86/release/src/metawear/platform/cpp
mkdir -p build/x86/release/src/metawear/core/cpp
mkdir -p build/x86/release/src/metawear/peripheral/cpp
mkdir -p build/x86/release/src/metawear/processor/cpp
mkdir -p build/x86/release/src/metawear/sensor/cpp
mkdir -p build/x86/release/src/metawear/impl/cpp
mkdir -p build/x86/release/src/metawear/dfu/cpp
g++ -MMD -MP -MF "build/x86/release/src/metawear/platform/cpp/threadpool.d" -c -o build/x86/release/src/metawear/platform/cpp/threadpool.o -std=c++11 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Werror -Isrc -DMETAWEAR_DLL -DMETAWEAR_DLL_EXPORTS -O3 -m32 src/metawear/platform/cpp/threadpool.cpp
g++: error: unrecognized command line option ‘-m32’
Makefile:65: recipe for target 'build/x86/release/src/metawear/platform/cpp/threadpool.o' failed
make: *** [build/x86/release/src/metawear/platform/cpp/threadpool.o] Error 1
To get rid of this error, I commented out the below code in the Makefile:
// #ifeq ($(MACHINE),x86)
// # CXXFLAGS+=-m32
// # LD_FLAGS+=-m32
// #else ifeq ($(MACHINE),x64)
// # CXXFLAGS+=-m64
// # LD_FLAGS+=-m64
// #else ifeq ($(MACHINE),arm)
// # CXXFLAGS+=-marm
// # LD_FLAGS+=-marm
// #else
// # $(error Unrecognized "MACHINE" value, use 'x86', 'x64', or 'arm')
// #endif
After commenting the above code in the MakeFile, the build proceeded but failed while running the unit test:
python3 -m unittest discover -s test
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.5/unittest/main.py", line 18, in
main(module=None)
File "/usr/lib/python3.5/unittest/main.py", line 93, in init
self.parseArgs(argv)
File "/usr/lib/python3.5/unittest/main.py", line 117, in parseArgs
self._do_discovery(argv[2:])
File "/usr/lib/python3.5/unittest/main.py", line 228, in _do_discovery
self.test = loader.discover(self.start, self.pattern, self.top)
File "/usr/lib/python3.5/unittest/loader.py", line 341, in discover
tests = list(self._find_tests(start_dir, pattern))
File "/usr/lib/python3.5/unittest/loader.py", line 398, in _find_tests
full_path, pattern, namespace)
File "/usr/lib/python3.5/unittest/loader.py", line 452, in _find_test_path
return self.loadTestsFromModule(module, pattern=pattern), False
File "/usr/lib/python3.5/unittest/loader.py", line 123, in loadTestsFromModule
tests.append(self.loadTestsFromTestCase(obj))
File "/usr/lib/python3.5/unittest/loader.py", line 92, in loadTestsFromTestCase
loaded_suite = self.suiteClass(map(testCaseClass, testCaseNames))
File "/usr/lib/python3.5/unittest/suite.py", line 24, in init
self.addTests(tests)
File "/usr/lib/python3.5/unittest/suite.py", line 57, in addTests
for test in tests:
File "/root/artik/freshStart/MetaWear-SDK-Cpp/test/common.py", line 29, in init
self.initialized_fn= FnVoid_VoidP_VoidP_Int(self.initialized)
NameError: name 'FnVoid_VoidP_VoidP_Int' is not defined
Makefile:109: recipe for target 'test' failed
make: *** [test] Error 1
It is unable to find "FnVoid_VoidP_VoidP_Int".
**The whole "make test" output is attached in the post.
**
Following are the specifications of the Artik 710 module:
Please help me with this since it has been stuck for several weeks now. Let me know if you need any other output or details related to the query.
Thank you in advance!
That type is defined in the Python bindings file:
https://github.com/mbientlab/MetaWear-SDK-Cpp/blob/0.16.3/bindings/python/mbientlab/metawear/cbindings.py#L460
The Makefile sets the
PythonPath
env variable to point the appropriate so it should pick up the types and functions defined in that bindings file.https://github.com/mbientlab/MetaWear-SDK-Cpp/blob/0.16.3/Makefile#L105
Based on the error, it seems like python is not looking in the bindings directory.