Can't get SFML to work on Raspberry.
Can this be done? I need to play several soundfiles with short time between each one. And have successfully made a program on my mac. And this is going to be used on the RPi.
Have anyone done this successfully?
I have tried to set it up with g++ and with code::blocks but can't get it to work, I think it is something to do with linking the files.
But now i am starting to wonder if it is at all possible?
If it is not, any suggestion of an easy (i am not that experienced) library for playing soundfiles one the raspberry pi using c++?
Hope someone can point me in the right direction quickly....
I recently managed to get SFML 2.0 to work on my raspi but it was not easy.
SFML 1.6 is available for raspberry pi with:
sudo apt-get install libsfml-dev
but I found this not to be compatible with my program written with SFML 2.X. I also tried and failed to use the Linux 32bit binary package SFML provides.
I believe the reason for this is because the raspi uses the ARM processor which was not what that build was built for.
I finally succeeded by downloading the Linux source from the SFML download page. I got SFML 2.0 because the instructions I found for building SFML from source were for that version and it was new enough to be functional although you may want to try a newer version. I downloaded all the dependencies and attempted to install using the script I got here. This may work for you but I ran into problems with the freetype library. The solution I found was to copy all the freetype header files to the parent "include" directory. There may be a better way but that worked for me. I hope this helped.
Edit: I just had to do this again on a fresh Raspian install. This time I used SFML 2.3. I did not have the same problem with freetype but I did have to install the following dependencies:
sudo apt-get install libx11-xcb-dev
sudo apt-get install libxcb-image0-dev
sudo apt-get install libxcb-randr0-dev
sudo apt-get install libudev-dev
here are the scripts I used:
to install dependencies:
sudo apt-get install libpthread-stubs0-dev
sudo apt-get install libgl1-mesa-dev
sudo apt-get install libx11-dev
sudo apt-get install libxrandr-dev
sudo apt-get install libfreetype6-dev
sudo apt-get install libglew1.5-dev
sudo apt-get install libjpeg8-dev
sudo apt-get install libsndfile1-dev
sudo apt-get install libopenal-dev
sudo apt-get install cmake
sudo apt-get install g++
to build it:
echo Starting SFML 2.0 install
echo see install.log for install output..
echo No.. Really.. Read it, this is my first
echo batch script for linux, so expect bugs
echo especially because I can\'t be stuffed
echo using regex to look for error output
echo building make for dynamic release
cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=TRUE > install.log
echo Complete
echo making
make >> install.log
echo Complete
echo Installing
sudo make install >> install.log
echo Complete
echo building make for dynamic debug
cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=TRUE >> install.log
echo Complete
echo making
make >> install.log
echo Complete
echo Installing
sudo make install >> install.log
echo Complete
echo building make for static release
cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=FALSE >> install.log
echo Complete
echo making
make >> install.log
echo Complete
echo Installing
sudo make install >> install.log
echo Complete
echo building make for static debug
cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=FALSE >> install.log
echo Complete
echo making
make >> install.log
echo Complete
echo Installing
sudo make install >> install.log
echo Complete
to run these, simply
copy them into a text file
save it with the file extension .sh
in properties, make it executable
(or, in terminal : sudo chmod +x yourfile.sh)
open it and click 'execute in terminal'
(or, in terminal : ./yourfile.sh)
Related
I'm trying to add a pnp solver to opencv
I'm working on ubuntu OS.
first I followed a tutorial on how to install opencv from source by cloning the repositories, then I tested the example and it worked so it compiled and installed succesfully.
I began adding my files and I made sure that no names are duplicated and all the files have been added so there were no issues with dependancies.
then I ran the cmake again, and ran the make command, but it is giving me the following error:-
opencv/modules/calib3d/src/RansacOptimalNPnP/../NPnP/DualVar.h:71:8: error: ‘optional’ in namespace ‘std’ does not name a template type
71 | std::optional<std::tuple<Eigen::Matrix3d, Eigen::Vector3d, double>>
I looked it up online and there is a possibility that I need to use C++ version 17 but the standard version in opencv is set to 11.
what can I change in the opencv cmake list to change that?
As I understand it Thamognya's answer, while useful to most users, misses what you are trying to do :
author and build a new module, to be compiled into the OpenCV library, (and your new module depends on C++17).
Re Setting C++ version and other options in Cmake:
To set the C++ version, and other Cmake options, I recommend using "cmake-gui". This is part of cmake, but separately installed in Ubuntu (and most Linix distros).
sudo apt-get install cmake-gui
You will find the c++ compiler options in the CMAKE_CXX* variables.
Re extending OpenCV:
If you have not already done so, I recommend cloning the OpenCV-contrib and OpenCV-extra repositories.
git clone https://github.com/opencv/opencv_contrib.git
git clone https://github.com/opencv/opencv_extra.git
These provide
examples of how to write and build new modules for OpenCV,
the data to run all the unit tests, to ensure your build is working correctly.
Re C++ version compatability:
C++ is intended to be backwards compatible, but there are details...
ABI compatability between compiler versions is a related issue.
This thread gives information on mixing versions of C++ in a library: Is it safe to link C++17, C++14, and C++11 objects
I would recommend starting by setting C++ version in "cmake-gui", and seeing if there are problems in configuration, build file generation, and compilation. Start with a minimal build and add only what you need. (i.e. Don't take on more complexity/bugs than you have to.)
OpenCV has the option to build many of its dependencies from source, (rather than using the versions you may have insalled on your operating system). This may help avoid compatability issues.
You can install OpenCV from ubuntu's opencv package via the following:
for python:
sudo apt-get install python3-opencv
for libopencv-dev:
sudo apt-get install libopencv-dev
If you want to compile it and not use ubuntu's OpenCV package, do the following:
# dependencies
sudo apt-get install cmake
sudo apt-get install gcc g++
# for python2 support
sudo apt-get install python-dev python-numpy
# for python3 support
sudo apt-get install python3-dev python3-numpy
# GTK support
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
# GTK 2 support
sudo apt-get install libgtk2.0-dev
# GTK 3 support
sudo apt-get install libgtk-3-dev
# Optional Dependencies
sudo apt-get install libpng-dev
sudo apt-get install libjpeg-dev
sudo apt-get install libopenexr-dev
sudo apt-get install libtiff-dev
sudo apt-get install libwebp-dev
now that you are done with dependencies continue to the actual installation
sudo apt-get install git
git clone https://github.com/opencv/opencv.git
mkdir build
cd build/
cmake ../
if properly configured this is the output
-- Python 2:
-- Interpreter: /usr/bin/python2.7 (ver 2.7.6)
-- Libraries: /usr/lib/x86_64-linux-gnu/libpython2.7.so (ver 2.7.6)
-- numpy: /usr/lib/python2.7/dist-packages/numpy/core/include (ver 1.8.2)
-- packages path: lib/python2.7/dist-packages
--
-- Python 3:
-- Interpreter: /usr/bin/python3.4 (ver 3.4.3)
-- Libraries: /usr/lib/x86_64-linux-gnu/libpython3.4m.so (ver 3.4.3)
-- numpy: /usr/lib/python3/dist-packages/numpy/core/include (ver 1.8.2)
-- packages path: lib/python3.4/dist-packages
make
sudo make install
This was shamelessly copied from opencv docs py setup in ubunutu
I am trying to install and run this software https://github.com/mit-biomimetics/Cheetah-Software
it's for a project but it can t compile for missing dependancies (eigen3).
I would like to create an auto install script to run it.
I have already do the most but i think i have problems in linking path in cmake and qt5.10 and eigen...
The autoinstall.sh code:
Install dependancies
sudo apt install mesa-common-dev freeglut3-dev coinor-libipopt-dev libblas-dev liblapack-dev gfortran liblapack-dev coinor-libipopt-dev cmake gcc build-essential libglib2.0-dev default-jdk python-all-dev liblua5.1-dev golang doxygen python-epydoc
Clone MIT Minicheetah software
git clone https://github.com/mit-biomimetics/Cheetah-Software.git
cd Cheetah-Software
Eigen library
wget https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.zip
unzip eigen-3.3.7.zip
lcm library
wget https://github.com/lcm-proj/lcm/releases/download/v1.4.0/lcm-1.4.0.zip
unzip lcm-1.4.0.zip
cd lcm-1.4.0
mkdir build
cd build
cmake ..
make
sudo make install
cd ..
cd ..
Qt
wget http://mirrors.ukfast.co.uk/sites/qt.io/archive/qt/5.10/5.10.0/qt-opensource-linux-x64-5.10.0.run
chmod +x qt-opensource-linux-x64-5.10.0.run
./qt-opensource-linux-x64-5.10.0.run
build
cd scripts # for now, you must actually go into this folder
./make_types.sh # you may see an error like `rm: cannot remove...` but this is okay
cd ..
mkdir build
cd build
cmake .. # there are still some warnings here
make -j
configure or setup.py or anything relqted in INSTALL or README.MD ( mandatory )
make
make install
but really you did not choose the most straitforward job, even as a developper I've been surprised many times when using cloned sources.
You should give a try to precompiled ROS for your robots or any distribution that let you install from binary yet you can still cross-compile when dev is done.
So i was able to compile and run it after several research and asking forums, it was a problem of compatibility with lcm library and openjdk, so download oracle jdk, do some linking manually and it was all good, absolutely no error in compilation.
Cheetah-Sofware-Ubuntu 18.04-AutoInstall.sh :
https://github.com/STRATOS-ROBOTICS/LeopardMK1/blob/master/install.sh
How can one build v8 from source on most recent Centos 7?
I tried, but ninja build always fails right away with "centos /lib64/libc.so.6: version `GLIBC_2.18' not found" message.
Plus, dependency installer script tells that Centos platform is not supported.
So, is there a way?
Thanks!
That error is due a not compatible C compiler, try compiling a newer GCC. On CentOS 7:
sudo yum install bzip2
cd /usr/local/src
wget https://www.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-8.3.0/gcc-8.3.0.tar.gz
tar zxf gcc-8.3.0.tar.gz
cd gcc-8.3.0/
./contrib/download_prerequisites
./configure --disable-multilib --enable-languages=c,c++
make
sudo make install
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/usr/local/lib64:/usr/lib64
echo "/usr/local/lib64" > /etc/ld.so.conf.d/gcc-8.3.0.x86_64.conf
ldconfig
(From their wiki)
You can try using docker to build V8.
See https://github.com/gengjiawen/v8-build.
I tried to install sfml 2.0 and indeed i'm still trying. I have a problem. When I compile it says: libGLEW.so.1.5, needed by sfml/lib/libsfml-graphics.so, not found
when I try to install it with command by typing sudo apt-get install libGLEW-dev
I get glew 1.9 which don't work and make me keep have the same error message. How do I get libGLEW.so.1.5 for sfml 2.0?
between I'm on a ubuntu based operating system~
this answer is probably only for amd64.
get the .deb package here(the second under "Downloadable files") https://launchpad.net/ubuntu/quantal/amd64/libglew1.5/1.5.7.is.1.5.2-1ubuntu4
(if it's 32 bit try downloading it here http://glew.sourceforge.net/ )
than double click it or type the folowing commands on your terminal:
cd folderwherethepackageis
sudo dpkg -i nameofthepackage
sorry if there is any english errors.
You just need to create a symlink:
sudo ln -s /dev/lib/libGLEW.so.1.9 /dev/lib/libGLEW.so.1.5
How do you install Boost on MacOS?
Right now I can't find bjam for the Mac.
You can get the latest version of Boost by using Homebrew.
brew install boost.
Download MacPorts, and run the following command:
sudo port install boost
Just get the source, and compile Boost yourself; it has become very easy. Here is an example for the current version of Boost on the current macOS as of this writing:
Download the the .tar.gz from https://www.boost.org/users/download/#live
Unpack and go into the directory:tar -xzf boost_1_50_0.tar.gz
cd boost_1_50_0
Configure (and build bjam):
./bootstrap.sh --prefix=/some/dir/you/would/like/to/prefix
Build:
./b2
Install:./b2 install
Depending on the prefix you choose in Step 3, you might need to sudo Step 5, if the script tries copy files to a protected location.
Unless your compiler is different than the one supplied with the Mac XCode Dev tools, just follow the instructions in section 5.1 of Getting Started Guide for Unix Variants. The configuration and building of the latest source couldn't be easier, and it took all about about 1 minute to configure and 10 minutes to compile.
Install both of them using homebrew separately.
brew install boost
brew install bjam
Fink appears to have a full set of Boost packages...
With fink installed and running just do
fink install boost1.35.nopython
at the terminal and accept the dependencies it insists on. Or use
fink list boost
to get a list of different packages that are availible.
Install Xcode from the mac app store.
Then use the command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
the above will install homebrew and allow you to use brew in terminal
then just use command :
brew install boost
which would then install the boost libraries to <your macusername>/usr/local/Cellar/boost
In order to avoid troubles compiling third party libraries that need boost installed in your system, run this:
sudo port install boost +universal
Try +universal
One thing to note: in order for that to make a difference you need to have built python with +universal, if you haven't or you're not sure you can just rebuild python +universal. This applies to both brew as well as macports.
$ brew reinstall python
$ brew install boost
OR
$ sudo port -f uninstall python
$ sudo port install python +universal
$ sudo port install boost +universal
you can download bjam for OSX (or any other OS) here
If you are too lazy like me:
conda install -c conda-forge boost