How to build CARLA on Windows
Be sure that these programs are added to your path, so you can use them from your command prompt.
In order to build CARLA you must enable the x64 Visual C++ Toolset.
I recommend to use this environment for everything you do in this tutorial.
You have different options:
- Recomended: Use
Visual Studio x64 Native Tools Command Prompt. Just press the
Winbutton and search for
x64, because the name of this Command Prompt can change depending on the lenguage you have installed Visual Studio.
- Enable a 64-Bit Visual C++ Toolset on the Command Line (the instructions will depend on the version of VS that you have).
Clone the repository
Go to the path you want to install CARLA and use git to download the project using the following command:
git clone https://github.com/carla-simulator/carla.git
and get in the created folder:
Once you have downloaded the repo you can start with the automatic installation.
This process may take a while, it will download and install the necessary Boost and Protobuf libraries. Expect 20-40 minutes, depending on your hardware and internet connection.
||Downloads and installs all the external dependencies, automatically calling the scripts in
||Builds carlaserver and launch the Unreal project.|
After navigate to your carla folder, run:
Setup.bat -j 8 --boost-toolset msvc-14.1
-j nwill try to parallelize the git download and NMake compilation. If not specified, no optimization will be made.
To see available commands, like which
--boost-toolsetyou have to use depending on your Visual Studio version, use:
When it's done, and if everything went well,
Setup.batwill provide a link where you can download the assets manually. If you get some errors you can try the Manual Installation, open a new issue on GitHub or just ask on the Windows Discord channel.
Unzip these assets into
Unreal/CarlaUE4/Content. Create it if the folder is not there.
Now let's compile carlaserver and start the Unreal project. Run:
Later on it will ask you to rebuild:
Agree and the project will be opened in the Unreal Engine in a few minutes.
Since version 0.8.3, it is recomended to follow the automatic installation.
Download the assets
Download the assets from the version you need. Take a look at
Util/ContentVersions.txt and follow the provided instructions to build the download link from the version's hash.
Create the folder
Unreal/CarlaUE4/ and unzip the content you just downloaded here.
Download and build for win64:
- Boost 1.64
- Protobuf 3.3.2
Building Boost for CARLA
Follow the official documentatio to compile boost.
Put the generated binaries in
Util └── Build └── boost-install ├── boost-1_64 | └── boost | ├── accumulators | ├── algorithm | ├── align | └── [...] // and all the other libraries └── lib ├── libboost_date_time-vc141-mt-1_64.lib └── libboost_system-vc141-mt-1_64.lib
Building Protobuf for CARLA
From our batch file
Just use this batch script, it will download and compile a ready-to-use version. Put it in
Util/Build and just run it.
If something goes wrong, just follow the protobuf cmake tutorials, but add these cmake arguments:
-DCMAKE_BUILD_TYPE=Release -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_CXX_FLAGS_RELEASE=/MD -Dprotobuf_MSVC_STATIC_RUNTIME=OFF
Put the generated binaries in
Compiling CARLA server
With your Visual Studio propmt, navigate into the
carla folder where you cloned the repo with
If you have done everything alright, carla server must be installed successfully in
Launch Unreal Engine
Unreal/CarlaUE4/CarlaUE4.uproject and it will ask you to rebuild:
If there are problems generating the dlls, right click on
CarlaUE4.uproject and select
Generate Visual Studio project files, so you can try compiling from the Visual Studio Editor and check the errors.
You must delete the following folders to completely rebuild your project:
Unreal/CarlaUE4/Binaries Unreal/CarlaUE4/Intermediate Unreal/CarlaUE4/Plugins/Carla/Binaries Unreal/CarlaUE4/Plugins/Carla/Intermediate
Then you can clean the project and compile it again:
path\to\carla> make clean & make
You can do it more automatically with your prompt in
path\to\carla> rmdir /q /s Unreal/CarlaUE4/Binaries Unreal/CarlaUE4/Intermediate Unreal/CarlaUE4/Saved Unreal/CarlaUE4/Plugins/Carla/Binaries Unreal/CarlaUE4/Plugins/Carla/Intermediate path\to\carla> make clean path\to\carla> make path\to\carla> Unreal/CarlaUE4/CarlaUE4.uproject