Skip to content

Commit

Permalink
Fix Linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
lovettchris committed Feb 18, 2017
1 parent 82f0790 commit b50510a
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 28 deletions.
1 change: 0 additions & 1 deletion AirLib/include/common/common_utils/Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
_Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \
_Pragma("GCC diagnostic ignored \"-Wdelete-non-virtual-dtor\"") \
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \
_Pragma("GCC diagnostic ignored \"-pedantic\"") \
_Pragma("GCC diagnostic ignored \"-Wshadow\"") \
_Pragma("GCC diagnostic ignored \"-Wold-style-cast\"") \
_Pragma("GCC diagnostic ignored \"-Wswitch-default\"") \
Expand Down
12 changes: 6 additions & 6 deletions DroneShell/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,12 +880,12 @@ See RecordPose for information about log file format") {
};


std::string beforeScriptStartCallback(const DroneCommandParameters& params, std::string scriptFilePath) {
return false;
}
bool afterScriptEndCallback(const DroneCommandParameters& params, std::string scriptFilePath) {
return false;
}
//std::string beforeScriptStartCallback(const DroneCommandParameters& params, std::string scriptFilePath) {
// return false;
//}
//bool afterScriptEndCallback(const DroneCommandParameters& params, std::string scriptFilePath) {
// return false;
//}
// std::string beforeScriptCommandStartCallback(const DroneCommandParameters& params) {
// params.context->client.newTask();
// }
Expand Down
2 changes: 1 addition & 1 deletion HelloDrone/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ int main() {
cin.get();
client.armDisarm(false);

} catch (rpc::rpc_error e) {
} catch (rpc::rpc_error& e) {
std::string msg = e.get_error().as<std::string>();
cout << "Exception raised by the API, something went wrong." << endl << msg << endl;
}
Expand Down
1 change: 0 additions & 1 deletion MavLinkCom/common_utils/Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
_Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \
_Pragma("GCC diagnostic ignored \"-Wdelete-non-virtual-dtor\"") \
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \
_Pragma("GCC diagnostic ignored \"-pedantic\"") \
_Pragma("GCC diagnostic ignored \"-Wshadow\"") \
_Pragma("GCC diagnostic ignored \"-Wold-style-cast\"") \
_Pragma("GCC diagnostic ignored \"-Wswitch-default\"") \
Expand Down
4 changes: 3 additions & 1 deletion MavLinkCom/src/impl/MavLinkVehicleImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ void MavLinkVehicleImpl::handleMessage(std::shared_ptr<MavLinkConnection> connec
// The general system state
MavLinkExtendedSysState extstatus;
extstatus.decode(msg);
bool landed = extstatus.landed_state == (int)MAV_LANDED_STATE::MAV_LANDED_STATE_ON_GROUND;
bool landed = extstatus.landed_state == static_cast<int>(MAV_LANDED_STATE::MAV_LANDED_STATE_ON_GROUND);
std::lock_guard<std::mutex> guard(state_mutex_);
if (vehicle_state_.controls.landed != landed) {
state_version_++;
Expand Down Expand Up @@ -390,6 +390,8 @@ void MavLinkVehicleImpl::handleMessage(std::shared_ptr<MavLinkConnection> connec
vehicle_state_.local_est.updated_on = value.time_boot_ms;
break;
}
default:
break;
}
}

Expand Down
Binary file added cmake/DroneServer/DroneServer
Binary file not shown.
Binary file added cmake/DroneShell/DroneShell
Binary file not shown.
Binary file added cmake/HelloDrone/HelloDrone
Binary file not shown.
5 changes: 3 additions & 2 deletions cmake/cmake-modules/CommonSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ macro(CommonSetup)
## I had to remove the following for Eigen to build properly: -Wlogical-op -Wsign-promo
## boost does not built cleam, so I had to disable these checks:
set(BOOST_OVERRIDES " -Wno-error=undef -Wno-error=ctor-dtor-privacy -Wno-error=old-style-cast -Wno-error=shadow -Wno-error=redundant-decls -Wno-error=missing-field-initializers -Wno-error=unused-parameter")
## Mavlink requires turning off -pedantic and -Wno-error=switch-default
## Mavlink requires turning off -Wno-error=switch-default
set(MAVLINK_OVERRIDES "-Wno-error=switch-default ")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
set(CMAKE_CXX_STANDARD 14)
Expand All @@ -38,6 +38,7 @@ macro(CommonSetup)

IF(UNIX)
set(BUILD_TYPE "linux")
set(RPC_LIB "${AIRSIM_ROOT}/AirLib/deps/rpclib/lib/${BUILD_PLATFORM}/${BUILD_TYPE}/librpc.a")
ELSE()
string( TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
if("${BUILD_TYPE}" STREQUAL "debug")
Expand All @@ -47,9 +48,9 @@ macro(CommonSetup)
else()
message(FATAL_ERROR "Please specify '-D CMAKE_BUILD_TYPE=Debug' or Release on the cmake command line")
endif()
set(RPC_LIB "${AIRSIM_ROOT}/AirLib/deps/rpclib/lib/${BUILD_PLATFORM}/${BUILD_TYPE}/rpc")
endif()

set(RPC_LIB "${AIRSIM_ROOT}/AirLib/deps/rpclib/lib/${BUILD_PLATFORM}/${BUILD_TYPE}/rpc")

endmacro(CommonSetup)

25 changes: 9 additions & 16 deletions docs/linux_build.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Linux Build

The Linux build system is in progress... please stay tuned...

## cmake

First you will need at least [cmake version 3.4](https://cmake.org/install/).
Expand All @@ -12,13 +10,17 @@ sudo add-apt-repository ppa:george-edison55/cmake-3.x -y
sudo apt-get update
````

On Linux you first need a version of GCC that supports `-std=c++14`. Version 4.9, or newer should work.
If you don't have version 4.9 you can get it by running these commands:
On Linux you first need a version of GCC that supports `-std=c++14`. Version 6, or newer should work.
If you don't have version 6 you can get it by running these commands:
````
sudo apt-get install build-essential
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9 g++-4.9 cpp-4.9
sudo apt-get install build-essential software-properties-common -y
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update
sudo apt-get install gcc-snapshot -y
sudo apt-get update
sudo apt-get install gcc-6 g++-6 -y
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
````

Then run this:
Expand All @@ -27,17 +29,8 @@ cmake -D CMAKE_BUILD_TYPE=Debug CMakeLists.txt
make
````

Now if gcc version 4.9 is not your default version of gcc, you will also need to tell cmake to use this version by
adding the following additional cmake command line arguments:

````
-D CMAKE_C_COMPILER=gcc-4.9 -D CMAKE_CXX_COMPILER=g++-4.9
````

Now type `make`.

STATUS: all of the MavLinkCom library builds and runs on Linux, but the AirLib code is running into a weird
difference in how GCC implements some -std=c++14 features... stay tuned...

## Windows cmake

Expand Down

0 comments on commit b50510a

Please sign in to comment.