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

Does it have mac support #2

Closed
idoan opened this issue Feb 16, 2017 · 19 comments
Closed

Does it have mac support #2

idoan opened this issue Feb 16, 2017 · 19 comments

Comments

@idoan
Copy link

idoan commented Feb 16, 2017

I couldn't see Mac listen on read.me, so I wanted to be sure. does it have mac support ?

@lovettchris
Copy link
Member

Not yet. Unfortunately Apple doesn't let us run a free version of their OS in a virtual machine, and as you can imagine there are not too many spare Mac computers around Microsoft for us to test on. But given that the Mac kernel is a close cousin to Linux, it shouldn't be that hard to get the Linux build working on Mac, right? There are some cmake files in the cmake folder that should get you going. Not sure what the translation is from gcc command line args to llvm though. We would just add another if (MAC) block in the CommonSetup.cmake file next to if (UNIX) and if (Win32). MavLinkCom depends on boost, I assume that works on Mac, and Eigen. Then there's one more spot where you'd need to implement "createdirectory", although the Unix code "mkdir" should work there, and there's a place where we'd like to find the user's Document folder to store our settings.json file, not sure what the convention on Mac is for that, but on unix we just use ~/Documents/AirSim. other than that the rest of the code is full cross platform except some of our tools (like LogViewer). But there are other tools that can view mavlink logs on Mac already.

@and7ey
Copy link

and7ey commented Feb 16, 2017

Would appreciate if somebody shares compiled version

@DJISDKUser
Copy link

Here is the first hurdle...

$ brew install eigen@3.2
$ cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/eigen@3.2/3.2.10/
-- Running CommonSetup...
-- found AIRSIM_ROOT=/Users/kfinisterre/Desktop/AirSim
-- Found Eigen3: /usr/local/Cellar/eigen@3.2/3.2.10/include/eigen3 (Required is at least version "3")
-- Running CommonSetup...
-- found AIRSIM_ROOT=/Users/kfinisterre/Desktop/AirSim
-- Boost version: 1.63.0
-- Found the following Boost libraries:
-- system
-- filesystem
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Running CommonSetup...
-- found AIRSIM_ROOT=/Users/kfinisterre/Desktop/AirSim
-- Boost_INCLUDE_DIR=/usr/local/include
-- Boost version: 1.63.0
-- Found the following Boost libraries:
-- system
-- Running CommonSetup...
-- found AIRSIM_ROOT=/Users/kfinisterre/Desktop/AirSim
-- Boost version: 1.63.0
-- Found the following Boost libraries:
-- system
-- filesystem
-- Running CommonSetup...
-- found AIRSIM_ROOT=/Users/kfinisterre/Desktop/AirSim
-- Boost version: 1.63.0
-- Found the following Boost libraries:
-- system
-- filesystem
-- Running CommonSetup...
-- found AIRSIM_ROOT=/Users/kfinisterre/Desktop/AirSim
-- Boost version: 1.63.0
-- Found the following Boost libraries:
-- system
-- filesystem
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/kfinisterre/Desktop/AirSim/cmake
Kevins-MBP:cmake kfinisterre$ make
Scanning dependencies of target AirLib
[ 2%] Building CXX object AirLib/CMakeFiles/AirLib.dir/Users/kfinisterre/Desktop/AirSim/AirLib/src/control/DroneControlBase.cpp.o
clang: error: -Wl,--no-as-needed: 'linker' input unused [-Werror,-Wunused-command-line-argument]
clang: error: -ldl: 'linker' input unused [-Werror,-Wunused-command-line-argument]
clang: error: -ldl: 'linker' input unused [-Werror,-Wunused-command-line-argument]
make[2]: *** [AirLib/CMakeFiles/AirLib.dir/Users/kfinisterre/Desktop/AirSim/AirLib/src/control/DroneControlBase.cpp.o] Error 1
make[1]: *** [AirLib/CMakeFiles/AirLib.dir/all] Error 2
make: *** [all] Error 2

@lovettchris
Copy link
Member

That's cool, do you need to edit the CommonSetup.cmake file to modify the CMAKE_CXX_FLAGS so llvm is happy ?

@DJISDKUser
Copy link

DJISDKUser commented Feb 16, 2017

Yeah this gets me a little further:

diff --git a/cmake/cmake-modules/CommonSetup.cmake b/cmake/cmake-modules/CommonSetup.cmake
index 75df3a3..c85e080 100644
--- a/cmake/cmake-modules/CommonSetup.cmake
+++ b/cmake/cmake-modules/CommonSetup.cmake
@@ -11,10 +11,10 @@ macro(CommonSetup)
     IF(UNIX)
         ## 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") 
+        set(BOOST_OVERRIDES " -Wno-error=ctor-dtor-privacy -Wno-error=shadow -Wno-error=redundant-decls -Wno-error=missing-field-initializers") 
         ## Mavlink requires turning off -pedantic  and -Wno-error=switch-default 
         set(MAVLINK_OVERRIDES "-Wno-error=switch-default ") 
-        set(CMAKE_CXX_FLAGS "-std=c++14 -ggdb -Wall -Wextra  -Wstrict-aliasing -Werror -fmax-errors=2 -Wunreachable-code -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Wnoexcept -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wstrict-null-sentinel -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused -Wno-variadic-macros -Wno-parentheses -fdiagnostics-show-option ${MAVLINK_OVERRIDES} ${BOOST_OVERRIDES}  -Wl,--no-as-needed -ldl -ldl ${CMAKE_CXX_FLAGS}")
+        set(CMAKE_CXX_FLAGS "-std=c++14 -ggdb -Wall -Wextra  -Wstrict-aliasing  -Wunreachable-code -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Woverloaded-virtual -Wredundant-decls -Wshadow -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused -Wno-variadic-macros -Wno-parentheses -fdiagnostics-show-option ${MAVLINK_OVERRIDES} ${BOOST_OVERRIDES} ${CMAKE_CXX_FLAGS}")
         set(BUILD_PLATFORM "x64")
 
     ELSE()

Next up is this:

/Users/xxx/Desktop/AirSim/AirLib/src/control/MavLinkDroneControl.cpp:287:32: error: default initialization of an object of const type 'const msr::airlib::VehicleParams' without a user-provided
      default constructor
    static const VehicleParams vehicle_params_;
                               ^
                                              {}

Which can be worked around by removing the const declaration

diff --git a/AirLib/src/control/MavLinkDroneControl.cpp b/AirLib/src/control/MavLinkDroneControl.cpp
index f243329..ac0935d 100644
--- a/AirLib/src/control/MavLinkDroneControl.cpp
+++ b/AirLib/src/control/MavLinkDroneControl.cpp
@@ -284,7 +284,7 @@ const VehicleParams& MavLinkDroneControl::getVehicleParams()
 //TODO: decouple DroneControlBase, VehicalParams and SafetyEval
 const VehicleParams& MavLinkDroneControl::getInternalVehicleParams()
 {
-    static const VehicleParams vehicle_params_;
+    static VehicleParams vehicle_params_;^M
     return vehicle_params_; //defaults are good for DJI Matrice 100
 }

@sytelus
Copy link
Contributor

sytelus commented Feb 16, 2017

Right now we are seeing some odd behaviour in GCC but theoretically our C++ code is designed to be cross platform so it should be compilable on Mac. Unreal also works on Mac so theoretically you should be able to make things work. A limiting factor, however, would be GPU capacity on Mac. Even moderate scale environments require 4GB GPU RAM. I highly doubt underpowered MBPs would cut it.

@idoan
Copy link
Author

idoan commented Feb 16, 2017

so, we need to have strong GPU (like nvidia 1070 or so?) to use this software ? integrated graphics has no luck then ? gosh :(

can you specify the minimum requirements on the readMe ? thanks

@lovettchris
Copy link
Member

Thanks to Will Sackfield, the OSX build now works. See commit details.

@DJISDKUser
Copy link

I still get an error... �

1 warning generated.
[ 97%] Linking CXX executable MavLinkTest
[ 97%] Built target MavLinkTest
1 warning generated.
[100%] Linking CXX executable DroneShell
ld: warning: ignoring file /Users/kfinisterre/Desktop/AirSim/AirLib/deps/rpclib/lib/x64/linux/librpc.a, file was built for archive which is not the architecture being linked (x86_64): /Users/kfinisterre/Desktop/AirSim/AirLib/deps/rpclib/lib/x64/linux/librpc.a
Undefined symbols for architecture x86_64:
"rpc::client::get_next_call_idx()", referenced from:
std::__1::future<clmdep_msgpack::v1::object_handle> rpc::client::async_call(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, bool) in libAirLib.a(RpcLibClient.cpp.o)
std::__1::future<clmdep_msgpack::v1::object_handle> rpc::client::async_call<>(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) in libAirLib.a(RpcLibClient.cpp.o)

@clovett
Copy link
Contributor

clovett commented Feb 18, 2017

Ah, so we need a mac build for the GitHub "rpclib" library then...

@lovettchris
Copy link
Member

there is a pull request that moves rpclib to git submodule, which is the right fix for OSX.

@DJISDKUser
Copy link

@clovett This should help you get going... I have the manual steps to try to PR (before it gets merged) #16 (comment)

@sytelus
Copy link
Contributor

sytelus commented Feb 25, 2017

I've merged PR16. Let's continue this discussion at #36. I'll close this issue as duplicate for now.

@ghexp
Copy link
Contributor

ghexp commented Mar 8, 2017

@lovettchris, WRT Apple doesn't let us run a free version of their OS in a virtual machine, it looks like Travis CI offers OS X build environments with XCode (up to and including 10.12 and XCode 8.2):
https://docs.travis-ci.com/user/osx-ci-environment/#Compilers-and-Build-toolchain
Since this is a public github project, that service is free. I've started an example yml file that is a work in progress (build not successful). I can make a pull request when it's building or make one now and let more people help fix it. Getting/keeping this working would go along way to help address #2, #15, #36, #18, #19, #43, #72

@DJISDKUser
Copy link

In the OpenPilot project we used to have trusted project members run the OSX build agents for Atlassian toolset on our machines. Can we do that for you in this case? Offer up a legit machine agent for your builds ?

@inkjet
Copy link
Contributor

inkjet commented Mar 11, 2017

@ghexp That is very cool - didn't know that option was available in Travis CI. Would love to see AirSim working right out of the box on a Mac - I know several people who would be interested immediately.

@raymondchua
Copy link

Can anyone share the steps to get AirSim running in MacOS?

@DJISDKUser
Copy link

DJISDKUser commented Oct 3, 2017 via email

@thiago-cavalcante
Copy link

thiago-cavalcante commented Jun 16, 2021

Does AirSim run on M1 mac? Or in macOS version greater than Catalina (10.5)? I know we can run Unreal on M1 mac.

Delaunay pushed a commit to kiwi-lang/AirSimUE5 that referenced this issue Jun 21, 2024
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

10 participants