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

Cross-compile and deploy for Raspberry Pi #612

Closed
julianoes opened this issue Nov 26, 2018 · 12 comments
Closed

Cross-compile and deploy for Raspberry Pi #612

julianoes opened this issue Nov 26, 2018 · 12 comments
Assignees
Labels
beginner A good issue for someone that only gets started enhancement

Comments

@julianoes
Copy link
Collaborator

It would actually be very nice if we could also generate a .deb for Raspbian, so it can be installed easily on Raspberry Pi.

Building on Raspberry Pi is really quite slow, especially when you would add the gRPC backend.

@julianoes julianoes added enhancement beginner A good issue for someone that only gets started labels Nov 26, 2018
@JonasVautherin
Copy link
Collaborator

I'm not sure this is a beginner issue 😅.

This means that you need to cross-compile all the libs for rpi, and last time I tried it was already not working for curl (I contributed to fix the bug, and I believe it was working in the end).

Still with curl, one issue we have is that we don't really compile it from sources but have this "curl-android-ios" for Android and iOS, which is already some kind of workaround.

@hamishwillee
Copy link
Collaborator

Love the idea.

More generally we still need an idiot proof deployment of all our runtimes for our supported platforms - ie no more pointing people to the build page at all.

@julianoes
Copy link
Collaborator Author

It's good for an SDK beginner knowing cross-compilation 😄

More generally we still need an idiot proof deployment of all our runtimes for our supported platforms - ie no more pointing people to the build page at all.

I agree.

@julianoes
Copy link
Collaborator Author

This will be easier after #724.

@ameya7295
Copy link

I'm taking this task.

@JonasVautherin
Copy link
Collaborator

Wait, I can help with the latest develop! Which architecture do you need to build? armv7?

@ameya7295
Copy link

ameya7295 commented Jun 7, 2019

yes, I would be building for armv7, Rpi.

@JonasVautherin
Copy link
Collaborator

Would you mind trying with dockcross? I think I successfully built the C++ SDK (I did not try the backend):

cd /path/to/DronecodeSDK
docker run --rm dockcross/linux-armv7 > ./dockcross
chmod +x dockcross
./dockcross cmake -DCMAKE_INSTALL_PREFIX=install_armv7 -Bbuild/armv7 -S.
./dockcross cmake --build build/armv7 --target install

And then I checked that a library was indeed an ARM binary:

file install_armv7/lib/libdronecode_sdk.so
install_armv7/lib/libdronecode_sdk.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, with debug_info, not stripped

@JonasVautherin
Copy link
Collaborator

JonasVautherin commented Jun 7, 2019

Seems like building the backend has issues, though ($ ./dockcross cmake -DCMAKE_INSTALL_PREFIX=install_armv7 -DBUILD_BACKEND=ON -Bbuild/armv7 -S.). @ameya7295 if you feel like debugging that, that would be awesome. It seems like FindZLIB.cmake doesn't find zlib when building gRPC. However, it also says:

CMake variable ZLIB_ROOT is set to:

/work/build/armv7/third_party/install

and zlib is indeed installed there. But still it errors with:

CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR)

For debugging, I would either run the dockcross image interactively (docker run --rm -it dockcross/linux-armv7 /bin/bash) or try to build on a RPi natively (i.e. without dockcross), to see if it is reproducible there.

@ameya7295
Copy link

okay, I would give this a try. thanks for sharing the required info.

@JonasVautherin
Copy link
Collaborator

Now wondering if it could be related to this cmake bug... 🤔

@julianoes
Copy link
Collaborator Author

julianoes commented Oct 23, 2019

Thanks to @JonasVautherin's fix against Dockcross this should work now:

docker run --rm dockcross/linux-armv7 > ./dockcross-linux-armv7
chmod +x ./dockcross-linux-armv7
./dockcross-linux-armv7 cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_BACKEND=ON -DBUILD_SHARED_LIBS=OFF -Bbuild/linux-armv7 -S.
./dockcross-linux-armv7 cmake --build build/linux-armv7 -j 8

Please re-open the issue if this is still a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginner A good issue for someone that only gets started enhancement
Projects
None yet
Development

No branches or pull requests

4 participants