Skip to content

Commit

Permalink
Fix linking error of FLANN on Ubuntu Disco (#1221)
Browse files Browse the repository at this point in the history
FLANN requires `lz4` to be linked, but it's not explicitly linked by the upstream.

Depends on #1220 

***

**Before merging a pull request**

- [x] Set version target by selecting a milestone on the right side
- [x] Summarize this change in `CHANGELOG.md`
  • Loading branch information
jslee02 authored Jan 12, 2019
1 parent 5a06758 commit 7cef21e
Show file tree
Hide file tree
Showing 10 changed files with 91 additions and 16 deletions.
12 changes: 12 additions & 0 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ jobs:
steps:
- template: .ci/azure-pipelines/docker.yml

- job: ubuntu_disco_gcc_release
pool:
vmImage: 'Ubuntu 16.04'
variables:
OS_NAME: linux
COMPILER: gcc
BUILD_TYPE: Release
BUILD_DIR: $(Build.SourcesDirectory)
DOCKERFILE: Dockerfile.ubuntu-disco
steps:
- template: .ci/azure-pipelines/docker.yml

- job: macos_high_seirra_clang_debug
pool:
vmImage: 'macOS 10.13'
Expand Down
1 change: 1 addition & 0 deletions .ci/docker/Dockerfile.ubuntu-disco
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM ubuntu:disco
1 change: 1 addition & 0 deletions .ci/docker/env.list
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
REPO_SLUG
IS_PULL_REQUEST
OS_NAME
BUILD_DIR
Expand Down
9 changes: 0 additions & 9 deletions .ci/env.list

This file was deleted.

6 changes: 5 additions & 1 deletion .ci/install_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ $SUDO apt-get -y install \
build-essential \
cmake \
pkg-config \
curl
curl \
git
if [ $COMPILER = clang ]; then
$SUDO apt-get -qq -y install clang
fi
Expand Down Expand Up @@ -49,6 +50,9 @@ elif [ $(lsb_release -sc) = "bionic" ]; then
elif [ $(lsb_release -sc) = "cosmic" ]; then
$SUDO apt-get -y install libnlopt-cxx-dev
$SUDO apt-get -y install liboctomap-dev libode-dev
elif [ $(lsb_release -sc) = "disco" ]; then
$SUDO apt-get -y install libnlopt-cxx-dev
$SUDO apt-get -y install liboctomap-dev libode-dev
else
echo -e "$(lsb_release -sc) is not supported."
exit 1
Expand Down
4 changes: 2 additions & 2 deletions .ci/travis/build_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ mkdir -p ${WORK_DIR}
# commits. This means that the clone knows nothing about other Git branches or
# tags. We fix this by deleting and re-cloning the full repository.
DART_CLONE_DIR="${WORK_DIR}/dart"
git clone "https://github.com/${TRAVIS_REPO_SLUG}.git" ${DART_CLONE_DIR}
git clone "https://github.com/${REPO_SLUG}.git" ${DART_CLONE_DIR}

# Organize into "docs" directory
DART_DOCS_OUTPUT_DIR="${TRAVIS_BUILD_DIR}/gh-pages"
DART_DOCS_OUTPUT_DIR="${BUILD_DIR}/gh-pages"
mkdir -p ${DART_DOCS_OUTPUT_DIR}

# Initialize list of API versions
Expand Down
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ cache:

env:
global:
- REPO_SLUG=$TRAVIS_REPO_SLUG
- IS_PULL_REQUEST=$TRAVIS_PULL_REQUEST
- OS_NAME=$TRAVIS_OS_NAME
- BUILD_DIR=$TRAVIS_BUILD_DIR
Expand Down Expand Up @@ -58,12 +59,12 @@ matrix:
# - BUILD_TYPE=Release
# - COMPILER=CLANG
- os: linux
compiler: gcc
env:
- BUILD_NAME=DOCS
- SUDO=sudo
- DOCKERFILE="Dockerfile.ubuntu-bionic"
- BUILD_TYPE=Release
- COMPILER=GCC
services: docker

install:
- if [ -n "$DOCKERFILE" ]; then
Expand Down
9 changes: 9 additions & 0 deletions cmake/DARTFindlz4.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2011-2019, The DART development contributors
# All rights reserved.
#
# The list of contributors can be found at:
# https://github.com/dartsim/dart/blob/master/LICENSE
#
# This file is provided under the "BSD-style" License

find_package(lz4 QUIET)
51 changes: 51 additions & 0 deletions cmake/Findlz4.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright (c) 2011-2019, The DART development contributors
# All rights reserved.
#
# The list of contributors can be found at:
# https://github.com/dartsim/dart/blob/master/LICENSE
#
# This file is provided under the "BSD-style" License

# Find lz4
#
# This sets the following variables:
# lz4_FOUND
# lz4_INCLUDE_DIRS
# lz4_LIBRARIES
# lz4_VERSION
#
# and the following targets:
# lz4

find_package(PkgConfig QUIET)

# Check to see if pkgconfig is installed.
pkg_check_modules(PC_lz4 lz4 QUIET)

# Include directories
find_path(lz4_INCLUDE_DIRS
NAMES lz4.h
HINTS ${PC_lz4_INCLUDEDIR}
PATHS "${CMAKE_INSTALL_PREFIX}/include")

# Libraries
find_library(lz4_LIBRARIES lz4
HINTS ${PC_lz4_LIBDIR})

# Version
set(lz4_VERSION ${PC_lz4_VERSION})

# Set (NAME)_FOUND if all the variables and the version are satisfied.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(lz4
FAIL_MESSAGE DEFAULT_MSG
REQUIRED_VARS lz4_INCLUDE_DIRS lz4_LIBRARIES
VERSION_VAR lz4_VERSION)

if(lz4_FOUND AND NOT TARGET lz4)
add_library(lz4 INTERFACE IMPORTED)
set_target_properties(lz4 PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${lz4_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${lz4_LIBRARIES}"
)
endif()
9 changes: 7 additions & 2 deletions dart/planning/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
dart_find_package(flann)
dart_check_optional_package(FLANN "dart-planning" "flann" "1.8.4")

# Add lz4 dependency explicitly. lz4 is a dependency of flann, but it's not
# added to flann as the dependency.
dart_find_package(lz4)
dart_check_optional_package(lz4 "dart-planning" "lz4")

# Search all header and source files
file(GLOB hdrs "*.hpp")
file(GLOB srcs "*.cpp")
Expand All @@ -12,13 +17,13 @@ set(component_name planning)

# Add target
dart_add_library(${target_name} ${hdrs} ${srcs})
target_link_libraries(${target_name} PUBLIC dart flann)
target_link_libraries(${target_name} PUBLIC dart flann lz4)

# Component
add_component(${PROJECT_NAME} ${component_name})
add_component_targets(${PROJECT_NAME} ${component_name} ${target_name})
add_component_dependencies(${PROJECT_NAME} ${component_name} dart)
add_component_dependency_packages(${PROJECT_NAME} ${component_name} flann)
add_component_dependency_packages(${PROJECT_NAME} ${component_name} flann lz4)

## Generate header for this namespace
dart_get_filename_components(header_names "planning headers" ${hdrs})
Expand Down

0 comments on commit 7cef21e

Please sign in to comment.