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

CMake cannot find GeographicLib Cross-compilation #164

Open
Sanjaer opened this issue Jun 8, 2022 · 2 comments
Open

CMake cannot find GeographicLib Cross-compilation #164

Sanjaer opened this issue Jun 8, 2022 · 2 comments

Comments

@Sanjaer
Copy link

Sanjaer commented Jun 8, 2022

I cross-compiled vanetza and its dependencies a couple of months ago and everything went fine. Now I'm trying the same process (I automated it with some scripts) but it gives this error:

-- GeographicLib: using lookup code by Vanetza
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find GeographicLib (missing: GeographicLib_LIBRARY) (found
  suitable version "2.1", minimum required is "1.37")
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindGeographicLib.cmake:27 (find_package_handle_standard_args)
  CMakeLists.txt:63 (find_package)

However geographic lib is installed in vanetza-deps

$ ls vanetza-deps/lib/libGeographicLib.so
vanetza-deps/lib/libGeographicLib.so

This is my script to compile and install GeographicLib, based on the documentation available in the web

#!/bin/bash

WORKING_DIR=$(pwd)

if [ ! -d "vanetza" ]; then
	echo "Vanetza not found, clonning"
	git clone https://github.com/riebl/vanetza.git
fi

if [ -d "vanetza" ]; then
	git clone https://github.com/geographiclib/geographiclib geographiclib-code

	if [ -d "geographiclib-code" ]; then
		cd geographiclib-code
		mkdir build.arm
		cd build.arm
		cmake .. -DCMAKE_TOOLCHAIN_FILE=$WORKING_DIR/vanetza/cmake/Toolchain-Cohda-MK5.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$WORKING_DIR/vanetza-deps
		make install
	else
		echo "Error clonning GeographicLib"
		exit 2
	fi
else
	echo "Error clonning vanetza"
	exit 1
fi

And for Vanetza:

#!/bin/bash

WORKING_DIR=$(pwd)

if [ -d vanetza-build ]; then
	rm -rf vanetza-build
fi

mkdir vanetza-build
cd vanetza-build

cmake $WORKING_DIR/vanetza \
    -DCMAKE_TOOLCHAIN_FILE=$WORKING_DIR/vanetza/cmake/Toolchain-Cohda-MK5.cmake \
    -DCMAKE_FIND_ROOT_PATH=$WORKING_DIR/vanetza-deps \
    -DCMAKE_INSTALL_RPATH=\$ORIGIN/../lib \
    -DCMAKE_INSTALL_PREFIX=$WORKING_DIR/vanetza-dist \
    -DBUILD_SOCKTAP=ON

make
@riebl
Copy link
Owner

riebl commented Jun 9, 2022

Hi @Sanjaer,

I suppose that a recent release of GeographicLib changes some aspects which are not yet handled correctly by our cmake/FindGeographicLib.cmake. As an intermediate fix, you may simply check out a specific version of GeographicLib, e.g. 1.52 should work fine.

@serserHR
Copy link

Hi @riebl I've found the following related issues.
When I change the cmake/FindGeographicLib.cmake line 14 to find_library(GeographicLib_LIBRARY_RELEASE NAMES GeographicLib DOC "GeographicLib library (release)") instead of find_library(GeographicLib_LIBRARY_RELEASE NAMES Geographic DOC "GeographicLib library (release)"), the compilation works fine with the dependecies in $WORKING_DIR/vanetza-deps. Nevertheless, if I tried to use the option BUILD_SHARED_LIBS=ON, I've found that it is trying to include .so of geolib and crypto in /usr/include of cohda VM instead of vanetza-deps and it produces de same error commented by @Sanjaer with my change in the cmake, but it still works OK with the previous one. Can you check it this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants