Unicorn hat with Arch Linux?


#1

Can someone help me figure out how to get the unicorn hat software compiled and running on a RPi2 with Arch Linux?

I believe that I have all needed prerequisites installed. When I try to build, I get this error:

root@alarmpi ..n/unicorn-hat-master/python/rpi-ws281x # make sudo rm -rf build sudo ./setup.py build running build running build_py Compiling ws281x library... creating build creating build/lib.linux-armv7l-3.4 copying neopixel.py -> build/lib.linux-armv7l-3.4 running build_ext building '_rpi_ws281x' extension creating build/temp.linux-armv7l-3.4 gcc -pthread -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -fPIC -Ilib/ -I/usr/include/python3.4m -c rpi_ws281x_wrap.c -o build/temp.linux-armv7l-3.4/rpi_ws281x_wrap.o rpi_ws281x_wrap.c: In function 'PyInit__rpi_ws281x': rpi_ws281x_wrap.c:4638:21: warning: variable 'md' set but not used [-Wunused-but-set-variable] PyObject *m, *d, *md; ^ gcc -pthread -shared -Wl,-O1,--sort-common,--as-needed,-z,relro build/temp.linux-armv7l-3.4/rpi_ws281x_wrap.o -Llib/ -L/usr/lib -lws2811 -lpython3.4m -o build/lib.linux-armv7l-3.4/_rpi_ws281x.cpython-34m.so /usr/bin/ld: lib//libws2811.a(ws2811.o): relocation R_ARM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC lib//libws2811.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status error: command 'gcc' failed with exit status 1 Makefile:5: recipe for target 'build' failed


Unicorn Hat / RPi2 / Arch Linux Problems
#2

It might be worth doing exactly what it’s suggesting- although it could be problematic to get the build process to actually do that.

While I know precious little about what practical differences there might be between Arch and Debian I know that ‘-fPIC’ is the option for “Position Independent Code”.

At a finger-in-the-air guess I’d try editing the library Makefile ( https://github.com/pimoroni/unicorn-hat/blob/master/python/rpi-ws281x/lib/Makefile ) and maybe changing line 4 from gcc -o ws2811.o -c -g -O2 -Wall -Werror ws2811.c to gcc -o ws2811.o -c -g -O2 -fPIC -Wall -Werror ws2811.c

Worth a punt!