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

[Help needed] Compile for Linux #3321

Open
wants to merge 4 commits into
base: gazebo11
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/linux-config/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: linux-config
description: configure linux

runs:
using: "composite"
steps:
- name: Cache dependencies
uses: actions/cache@v3
with:
path: deps/vcpkg/cache/linux
key: linux-x64-${{ hashFiles('.github/workflows/linux-config/action.yml', 'deps/vcpkg/manifest/vcpkg.json', 'deps/vcpkg/triplets/x64-linux-release.cmake') }}

- name: Install dependencies
shell: bash
run: |
# vcpkg
# qt5-base
# ffmpeg
# ogre
# libusb
sudo apt install -y \
ninja-build \
\
'^libxcb.*-dev' \
libx11-xcb-dev \
libglu1-mesa-dev \
libxrender-dev \
libxi-dev \
libxkbcommon-dev \
libxkbcommon-x11-dev \
\
nasm \
\
libxaw7-dev \
libxrandr-dev \
\
libudev-dev \
autoconf

- name: Clone vcpkg
shell: bash
run: |
git clone https://github.com/microsoft/vcpkg/

- name: Configure Gazebo
shell: bash
run: |
export VCPKG_BINARY_SOURCES="clear;files,$PWD/deps/vcpkg/cache/linux,readwrite;"
cmake . -G Ninja -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_MANIFEST_DIR=deps/vcpkg/manifest \
-DVCPKG_OVERLAY_TRIPLETS=deps/vcpkg/triplets \
-DVCPKG_OVERLAY_PORTS=deps/vcpkg/ports \
-DVCPKG_INSTALLED_DIR=$PWD/vcpkg/installed \
-DVCPKG_TARGET_TRIPLET=x64-linux-release \
-DVCPKG_HOST_TRIPLET=x64-linux-release \
-DVCPKG_INSTALL_OPTIONS=--clean-after-build \
-DUSE_EXTERNAL_TINYXML=ON \
-DUSE_EXTERNAL_TINYXML2=ON \
-DUSE_EXTERNAL_TINY_PROCESS_LIBRARY=ON \
-DGZ_PROTOBUF_USE_CMAKE_CONFIG=ON \
-DCMAKE_INSTALL_PREFIX=$PWD/vcpkg/installed/x64-linux-release \
-DUSE_UPSTREAM_CFLAGS=OFF \
-DCMAKE_CXX_FLAGS=-Wl,--allow-multiple-definition
59 changes: 0 additions & 59 deletions .github/workflows/linux.yml

This file was deleted.

83 changes: 83 additions & 0 deletions .github/workflows/linux_copy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: 🐧 Linux
on:
push:
branches: [ gazebo11 ]
pull_request:
branches: [ gazebo11 ]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
config:
name: x64-config
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3

- name: Config Gazebo
uses: ./.github/workflows/linux-config/

- name: Prepare logs on failure
if: failure()
shell: bash
run: |
7z a -t7z -r -mx=9 logs.7z \
vcpkg/buildtrees/*.log

- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: linux_logs_x64_${{github.event.pull_request.head.sha}}
path: logs.7z

build:
name: x64-build
needs: config
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3

- name: Config Gazebo
uses: ./.github/workflows/linux-config/

- name: Build Gazebo
shell: bash
run: |
export proc=$(nproc)
echo proc=$proc
cmake --build build --config Release -j $proc

- name: Install Gazebo
shell: bash
run: |
cmake --install build --config Release

- name: Tests suite compilation
shell: bash
run: |
echo compile and run tests here

- name: Prepare logs on failure
if: failure()
shell: bash
run: |
7z a -t7z -r -mx=9 logs.7z \
vcpkg/buildtrees/*.log \
build/.ninja_log \
build/build.ninja \
build/install_manifest.txt \
build/vcpkg-manifest-install.log

- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: linux_logs_x64_${{github.event.pull_request.head.sha}}
path: logs.7z
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ test/plugins/rest-web/node_modules
build
build_*
build-*
vcpkg
Ogre.log
deps/vcpkg/cache
.DS_Store
Expand Down
8 changes: 8 additions & 0 deletions cmake/FindFreeimage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ include (${gazebo_cmake_dir}/GazeboUtils.cmake)
# Find packages
if (PKG_CONFIG_FOUND)
pkg_check_modules(freeimage freeimage>=${MIN_FREEIMAGE_VERSION})
if (NOT freeimage_FOUND)
unset(freeimage_FOUND CACHE)
find_package(freeimage CONFIG)
if (freeimage_FOUND)
set(freeimage_LIBRARIES freeimage::FreeImage)
message (STATUS "FreeImage found")
endif()
endif()
if (NOT freeimage_FOUND)
message (STATUS " freeimage.pc not found, trying freeimage_include_dir and freeimage_library_dir flags.")
endif (NOT freeimage_FOUND)
Expand Down
14 changes: 14 additions & 0 deletions cmake/SearchForStuff.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ if (PKG_CONFIG_FOUND)
if (USE_EXTERNAL_TINYXML)
message (STATUS "Using system tinyxml.")
pkg_check_modules(tinyxml tinyxml)
if (NOT tinyxml_FOUND)
unset(tinyxml_FOUND CACHE)
find_package(tinyxml CONFIG)
if (tinyxml_FOUND)
message (STATUS "tinyxml found via find_package")
endif()
endif()
if (NOT tinyxml_FOUND)
find_path (tinyxml_INCLUDE_DIRS tinyxml.h ${tinyxml_INCLUDE_DIRS} ENV CPATH)
find_library(tinyxml_LIBRARIES NAMES tinyxml)
Expand Down Expand Up @@ -592,6 +599,7 @@ if (PKG_CONFIG_FOUND)
pkg_check_modules(BULLET bullet2.82>=2.82)
endif()
if (NOT BULLET_FOUND)
unset(BULLET_FOUND CACHE)
find_package(BULLET CONFIG 2.82)
endif()
if (BULLET_FOUND)
Expand Down Expand Up @@ -690,12 +698,18 @@ endif ()
########################################
# Find gdal
include (FindGDAL)
if (NOT GDAL_FOUND)
message (STATUS "Looking for gdal in find_package")
unset(GDAL_FOUND CACHE)
find_package(GDAL CONFIG)
endif()
if (NOT GDAL_FOUND)
message (STATUS "Looking for libgdal - not found")
BUILD_WARNING ("GDAL not found, Digital elevation terrains support will be disabled.")
set (HAVE_GDAL OFF CACHE BOOL "HAVE GDAL" FORCE)
else ()
message (STATUS "Looking for libgdal - found")
message (STATUS "GDAL_LIBRARY: ${GDAL_LIBRARY}")
set (HAVE_GDAL ON CACHE BOOL "HAVE GDAL" FORCE)
endif ()

Expand Down
Empty file added deps/vcpkg/ports/.gitkeep
Empty file.
10 changes: 10 additions & 0 deletions deps/vcpkg/triplets/x64-linux-release.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)

set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(VCPKG_BUILD_TYPE release)

if(PORT STREQUAL "ffmpeg")
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
2 changes: 2 additions & 0 deletions gazebo/rendering/RenderEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

// Not Apple or Windows
#if not defined(__APPLE__) && not defined(_WIN32)
#define GL_GLEXT_LEGACY
#define GLX_GLXEXT_LEGACY
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# include <GL/glx.h>
Expand Down
Loading