Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raspberry pi 3 and higher #9570

Closed
zweistein-frm2 opened this issue Jan 7, 2020 · 6 comments · Fixed by #11880
Closed

raspberry pi 3 and higher #9570

zweistein-frm2 opened this issue Jan 7, 2020 · 6 comments · Fixed by #11880
Assignees
Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed

Comments

@zweistein-frm2
Copy link

zweistein-frm2 commented Jan 7, 2020

It would be nice to have full support for the raspberry pi arm platform. Currently with some hacks it is possible to use vcpkg, but it should be easy to include this in the the standard installation:

For the raspian - buster it is possible to install vcpkg with the following steps:
1.) install cmake 3.14.7 from sources, for example

cd /opt
sudo apt-get install libssl-dev
sudo  wget https://github.com/Kitware/CMake/releases/download/v3.14.7/cmake-3.14.7.tar.gz
sudo  tar -zxvf cmake-3.14.7.tar.gz 
cd cmake-3.14.7 
sudo ./bootstrap 
sudo make
 /usr/bin/cmake --version
 ----next step only if [/usr/bin/cmake] not a symlink 
 sudo mv /usr/bin/cmake /usr/bin/cmake-3.??.? [specify your version] 
---end next step
sudo make install
[sometimes necessary]   sudo ln -s /opt/cmake-3.14.7/cmake/bin/cmake /usr/bin/cmake

2.) install vcpkg, for example

cd /
sudo mkdir vcpkg
sudo chown pi vcpkg
sudo chmod 777 vcpkg
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
mkdir out
cd out
(first edit vcpkg/toolsrc/CMakeLists.txt and remove the -Werror option, otherwise you get build errors)

cmake   -S /vcpkg/toolsrc -B /vcpkg/out
make
cd ..
cp out/vcpkg ./vcpkg

3.) install ninja :

cd /opt
sudo mkdir ninja
sudo chown pi ninja
sudo chmod 777 ninja
git clone git://github.com/ninja-build/ninja.git && cd ninja
git checkout release
cat README
python bootstrap.py
 sudo ln -s /opt/ninja/ninja /usr/bin/ninja

4.) add triplet for arm-linux:

sudo cp /vcpkg/triplets/x64-linux.cmake  /vcpkg/triplets/arm-linux.cmake
sudo nano /vcpkg/triplets/arm-linux.cmake 
change line #1 to set(VCPKG_TARGET_ARCHITECTURE arm)  (from set(VCPKG_TARGET_ARCHITECTURE x64)

5.) now simple packages can be installed,
for example:

cd /vcpkg
sudo ./vcpkg install magic-enum:arm-linux
sudo ./vcpkg install libuv:arm-linux

6.) almost troublefree:

sudo ./vcpkg install openssl:arm-linux
sudo ./vcpkg install openssl-unix:arm-linux
sudo ln /usr/include/arm-linux-gnueabihf/openssl/opensslconf.h /usr/include/openssl/opensslconf.h

7.) boost:
We are on arm, but as a hack
you need some files from an existing x64-Linux vcpkg installation:

sudo ./vcpkg install boost-build:x64-linux

then mv all installed files (/vcpkg/installed/vcpkg/info/boost-build_1.70.0-1_x64-linux.list) :

sudo mv /vcpkg/installed/x64-linux  /vcpkg/installed/arm-linux 
sudo mv /vcpkg/packages/boost-build_x64-linux /vcpkg/packages/boost-build_arm-linux

sudo mkdir /vcpkg/installed/arm-linux/tools
sudo mv /vcpkg/installed/arm-linux/x64-linux/tools/boost-build /vcpkg/installed/arm-linux/tools
#sudo mv /vcpkg/installed/arm-linux/x64-linux/share/boost-build /vcpkg/installed/arm-linux/tools/boost-build

then run:

sudo ./vcpkg install boost-system:arm-linux

build will fail, then:

sudo nano /vcpkg/installed/arm-linux/share/boost-build/boost-modular-build.cmake:
17: if(NOT EXISTS "${BOOST_BUILD_PATH}")
18:	 + set(BOOST_BUILD_PATH "${CURRENT_INSTALLED_DIR}/tools/boost-build")
19:      - message(FATAL_ERROR "The x86 boost-build tools must be installed to build for non-x86/x64 platforms. Please run `vcpkg install boost-build:x86-windows`.")
20: endif()


sudo nano /vcpkg/installed/arm-linux/share/boost-build/CMakeLists.txt :
157:   	- architecture=x86
	+ architecture=arm

cd /vcpkg
sudo ./vcpkg install boost-build:arm-linux
 if this goes through without problems then
sudo /vcpkg/vcpkg install boost:arm-linux

8.) libwebp:

sudo apt-get install libjpeg-dev libpng-dev libtiff-dev libgif-dev

cd /vcpkg
sudo ./vcpkg install libwebp:arm-linux

this will result in a compile error on NEON related code.

sudo nano /vcpkg/buildtrees/libwebp/src/v1.0.2-58f2af1d99/cmake/cpu.cmake
57:  + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon ")

then again sudo ./vcpkg install libwebp:arm-linux

9.)opencv: after 8.) do

sudo apt-get install python-dev
sudo apt-get install python3-dev

then you can do sudo ./vcpkg install opencv[contrib,nonfree]:arm-linux

Best regards

@zweistein-frm2
Copy link
Author

One more hack is needed on the raspberry pi vcpkg installation:
Would be nice if the vcpkg team could improve detection of the target architecture and include also the raspberry pi arm linux .
Use this hack on the raspberry pi:

sudo nano /vcpkg/scripts/buildsystems/vcpkg.cmake
72: + set(VCPKG_TARGET_TRIPLET_ARCH arm)

Then the vcpkg package manager works.

Best regards
Andreas

@gobigrinder
Copy link

Yup, would really love if it worked flawlessly on ARM like the other platforms

@odibox
Copy link

odibox commented Jun 18, 2020

Please have a look here.

[vcpkg] Add community triple arm64-linux and arm-linux. #11880
#11880

https://github.com/xieyubo/vcpkg

With this build it works out of the box.

@PhoebeHui PhoebeHui self-assigned this Jun 28, 2020
@PhoebeHui PhoebeHui added the category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed label Jun 28, 2020
@JackBoosY JackBoosY linked a pull request Jul 30, 2020 that will close this issue
@advra
Copy link

advra commented Oct 21, 2020

After cloning and compiling from source I get the following error:

pi@raspberrypi:~/vcpkg $ ./vcpkg 
Environment variable VCPKG_FORCE_SYSTEM_BINARIES must be set on arm and s390x platforms.

Any suggestions? I have tried to set the variable to with both 0 and 1 but that did not help. (src: https://stackoverflow.com/questions/55204593/how-to-specify-cmake-version-used-by-vcpkg)

@lindkvis
Copy link
Contributor

@advra how exactly did you set the environment variable?

On bash (default shell for Raspbian) this would be:

pi@raspberrypi:~/vcpkg $ export VCPKG_FORCE_SYSTEM_BINARIES=1

I also ran into the issue that vcpkg required ./vcpkg to run as root (i.e. sudo) and the variable did not carry over from my current user for some reason.

@advra
Copy link

advra commented Oct 22, 2020

@lindkvis when you export it doesnt persist from terminal to terminal (at least I think so). to do this you need to add the line export VCPKG_FORCE_SYSTEM_BINARIES=1 to your .basrc file so that it is executed each time you open a new terminal.

Editing ~/.bashrc is system wide and not on a per user basis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants