Skip to content

Add cross-compilation section in build_linux.md#3561

Closed
evroon wants to merge 1 commit intomicrosoft:masterfrom
evroon:patch-3
Closed

Add cross-compilation section in build_linux.md#3561
evroon wants to merge 1 commit intomicrosoft:masterfrom
evroon:patch-3

Conversation

@evroon
Copy link
Contributor

@evroon evroon commented Apr 2, 2021

About

Cross compilation is possible but requires some instructions. Specifically, the AirLib libraries have to be build from a Linux environment.

How Has This Been Tested?

I did this step-by-step (from Windows 10, for Ubuntu 20.04) and for me it works.

@ahmed-elsaharti
Copy link
Contributor

I tried to make this work for a good 5 hours but it just wouldn't (or I'm messing something up).
The first issue I could see was that on building AirSim on Windows, all the Linux (WSL2) compilation results (all the .a components of AirLib) would get deleted. I'm assuming its something that the build.cmd script does?

Moreover, even when trying to bypass this error by grabbing a WSL2 compiled AirSim plugins folder and placing it into the UE4 project folder, although things end up packaging just fine through UE4, when running the resulting .sh binary the environment works fine but the drone is stagnant mid-air with no physics or prop movement. The car simulation does work though, so I'm assuming its something within AirLib that breaks while doing this since car-mode isn't dependent on AirLib or AirSim's physics (AFAIK).

@evroon
Copy link
Contributor Author

evroon commented Apr 6, 2021

The first problem I did not encounter as far as I know, but you could also build for linux and copy the 3 or 4 lib files to a temporary location and then build AirLib for windows and paste the files in the original location.

The second issue is indeed something I oversaw, I only noticed it today by accident and I don't know exactly why it happens, but has probably indeed to do with AirLib. Sorry about that.

Copy link
Contributor

@zimmy87 zimmy87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need extra clarification in this doc. I personally ran into some confusion and wasn't able to get this scenario working locally

```

## Cross-compile AirSim from Windows for Linux
You can cross compile for Linux from a Windows machine. First install clang as instructed [here](https://docs.unrealengine.com/latest/INT/Platforms/Linux/GettingStarted/index.html). Then, build AirSim from Bash for Windows, as instructed above, such that the Linux .lib files are created. Subsequently, build AirSim again but this time for Windows (as instructed [here](build_windows.md)) such that you can open the project in UE4. After building UE4 for Windows, open the project in Unreal Engine. Under Project Settings, go to `Supported Platforms` and enable `Linux` by clicking the checkbox. Now, go to `Plugins` and search for `VR`. Disable `Oculus VR` and `SteamVR` as they will result in build errors. Now, you can start packaging the project by going to File → Package Projct → Linux → Linux.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple notes here:

  1. Instead of Bash for Windows, I think it would be better to specify Windows Subsystem for Linux (WSL).
  2. Where is the AirSim repo that is being built located? When I build from WSL out of a repo located in my windows directory structure, I get build errors. If I instead build out of the WSL directory structure, I get build errors when I build from Windows. Is the expectation to copy binaries from a repo located in WSL to one located in windows?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WSL is indeed the correct/current term.
I think I used /mnt/c (or another drive) to build AirSim from in WSL. But this method does not work in its current form (atleast AirLib is not working), as in the comments above. So, maybe I should close this PR.

@jonyMarino jonyMarino marked this pull request as draft August 9, 2021 22:28
@jonyMarino
Copy link
Collaborator

Closed due to inactivity. Please, feel free to ask for it to be reopened if you wish to continue.

@jonyMarino jonyMarino closed this Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants