-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Building Carla on Mac OSX #150
Comments
Hi @ajax98, Yes, it is possible. However we don't have an automated build system for MacOS, so it would require some effort to make it work. Please have a look at the progress at #103. Also it might be helpful to check out the documentation for How to build on Linux and the discussion for building on Windows at #21 as the process is basically the same. Please share your progress here if you find any difficulties. It can be very helpful for other people trying to build on Mac, and eventually we might be able to make an automated system as for Linux. There is a compilation error that is going to appear, you need to replace the block at "Source/Carla/SceneCaptureCamera.cpp" Line 27 by static constexpr auto DEPTH_MAT_PATH =
#if PLATFORM_LINUX
TEXT("Material'/Carla/PostProcessingMaterials/DepthEffectMaterial_GLSL.DepthEffectMaterial_GLSL'");
#else
TEXT("Material'/Carla/PostProcessingMaterials/DepthEffectMaterial.DepthEffectMaterial'");
#endif This is something we have to fix, but we'll have to test if the default depth material is working well on Mac. Help on this would be appreciated as we don't have here Mac machines to test it. |
Check out #176 (comment) |
I skimmed the couple threads I've seen here about running Carla on a Mac and I have modified all the files as mentioned, but I keep running into the same issue. The Output from xcode when trying to build the
When I open the project through UE4Editor, it complains about the lack of the dylibs and tries to build them, but fails every time as well. |
Update: got it to complete the build by modifying the
|
I got this working using Xcode 8.2.1, which is based on clang 3.9. I had to modify the scripts to use BUILD = bash "$(UNREALROOTPATH)/Engine/Build/BatchFiles/Linux/Build.sh"
PROJECTBUILD = mono "$(UNREALROOTPATH)/Engine/Binaries/DotNET/UnrealBuildTool.exe"
...
UE4Editor:
$(BUILD) UE4Editor Linux Development $(ARGS) When I manually changed In any case, if I modify the generated Makefile by replacing all instances of MONO = "$(UNREALROOTPATH)/Engine/Binaries/ThirdParty/Mono/Mac/bin/mono"
PROJECTBUILD = $(MONO) "$(UNREALROOTPATH)/Engine/Binaries/DotNET/UnrealBuildTool.exe" |
It appears that the |
@analog-cbarber Thanks for the report! In Linux we use a very specific version of the compiler because we need to link against libc++ (instead of the usual libstdc++ for Linux). In Mac, I imagine we can go with the default compiler installed like we do on Windows. And for the sh scripts, they have been written for Linux and only tested on Linux, we may need to adapt them. |
That's good, so the Xcode build approach may still be ok? So the main risk would be if CARLA started to depend on C++ features in clang 5.0 that are not yet supported in the Xcode variant? |
That's likely to happen, in the latest changes in networking code we use C++17 features, most of them already available in previous versions of clang with -std=c++1z but some may not. |
OK. So either I need to figure out how to build properly using actual llvm/clang 5.0 or hope that Xcode supports the required features. It seems that Xcode 10 may be based on 5.0 (see Joky's comment on this thread: https://news.ycombinator.com/item?id=16545037) |
According to https://clang.llvm.org/cxx_status.html, it appears that clang 4.0 should support most of the C++17 features. The only ones I see that are missing are constexpr lambda expressions (P0170R1) |
I don't think we use any of those features, up until recently all our code base was compiling with clang-3.9 and -std=c++14, it's going to be starting at CARLA 0.9.0 that we move to clang-5.0 and C++17. The C++17 standard has some nice features that may help performance, and hopefully soon will be fully supported by most compilers. So for now shouldn't be any problems compiling. However, we won't be maintaining compatibility as we simply don't have enough people to maintain it. |
Hey @analog-cbarber, so after your comments I've been digging in the UE4 toolchains, and they seem to be forcing C++14 in all platforms (as for UE4.19). I think it would be wise for us to restrict our libraries to C++14 too since some of the code may need to compile inside UE4 environment too. So I'm going to keep CARLA 0.9.0 with C++14 standard (still clang-5.0 by default as it's the recommended for UE4.19 in Linux). I'm a bit sad about it cause I wanted to start using C++17 😄 but at least it's good to keep compatibility since at this point almost every compiler supports C++14. |
You could still probably get away with using C++17 features that are compatible with whatever runtime UE 4.19 is using. I am not sure which ones that would be... FWIW, the changes I made to get the Mac build to work using Xcode 8.2.1 are here: https://github.com/analog-garage/carla/commits/mac-build I won't issue a pull request, because this is hackier than I would like and will require significant reworking for the 0.9 release in any case. |
@analog-cbarber, I was able to get Mac command line setup/builds working using homebrew-installed llvm/clang 3.9 with some modifications to the Carla scripts and cmake setup file instead of installing another version of Xcode. I think the main trick was to prevent the libc++ library conflict with Apple's built-in version by using the Getting all the directory changes correct for the Unreal Engine command line project build and launch was also a little tricky, but seems to work. My Unreal Engine is installed from the Epic Games Launcher instead of from source. You can check out my modifications for this from the current Carla master at: My environment (for reference):
|
Also, for installing the Mac build dependencies, I used:
When building the plugins in Unreal Engine, I also had to downgrade errors for unused lambda capture following https://answers.unrealengine.com/questions/779733/xcode-build-errors-lambda-capturenot-used.html:
|
I get the "UE4Editor-Carla.dylib missing" along with one more. Rebuilding fails and it says try from source manually. Any help with this? |
The missing dylib messages is normal, just needs the UE rebuild to work. Are you using the latest Carla 0.9.0? It was updated for Unreal Engine 4.19 instead of 4.18 so there may be new UE rebuild issues. I haven’t had a chance to try it with UE 4.19 yet. |
I got a Mac build working based on the current master branch (i.e. 0.9.0) using Some changes were required. I have pushed what I have so far on the mac-build-0.9 branch of our fork. See https://github.com/analog-garage/carla/blob/mac-build-0.9/Docs/how_to_build_on_mac.md |
@analog-cbarber Nice work! I was able to use your fork's mac-build-0.9 branch to build Carla 0.9 with Xcode 9.4.1 as well, after modifying the Xcode version check in the Util/BuildTools/Setup.command file. Copying the GenerateProjectFiles.sh to the UE root folder didn't work for me though, so instead I was able to modify the Util/BuildTools/BuildCarlaUE4.command file to call the built in Mac GenerateProjectFiles.sh that comes with the UE engine install package in place: Util/BuildTools/BuildCarlaUE4.command
The Xcode project workspace Unreal/CarlaUE4/CarlaUE4.xcworkspace that this generates worked fine to Build & Run the project and launch the UE Editor. It would be great if your how_to_build_on_mac.md doc also included some info about using this file to build/run the project too. For the command line UE project build though, instead of using make with the Linux->Mac swapped UE Makefile, I had to modify the Util/BuildTools/BuildCarlaUE4.command file to use UE's Mac Build.sh script directly and add -NoUBTMakefiles to prevent an error about invalid makefile contents from the UE Build Tool: Util/BuildTools/BuildCarlaUE4.command
For Mac, Xcode is probably the way to go anyways as long as the AppleClang version is still compatible. Thanks again for posting your work! |
Did you copy GenerateProjectFiles.sh from the root of the Unreal Engine source tree? I think that should work. I would have checked in a copy of the file I used if not for the conflicting copyright.
On Aug 20, 2018 3:29 PM, Effendi Dufford <notifications@github.com> wrote:
@analog-cbarber<https://github.com/analog-cbarber> Nice work!
I was able to use your fork's mac-build-0.9 branch to build Carla 0.9 with Xcode 9.4.1 as well, after modifying the Xcode version check in the Util/BuildTools/Setup.command file.
Copying the GenerateProjectFiles.sh to the UE root folder didn't work for me though, so instead I was able to modify the Util/BuildTools/BuildCarlaUE4.command file to call the built in Mac GenerateProjectFiles.sh that comes with the UE engine install package in place:
Util/BuildTools/BuildCarlaUE4.command
log "Generate Unreal project files."
#if [[ ! -f ${UE4_ROOT}/GenerateProjectFiles.sh ]]; then
# fatal_error "No GenerateProjectFiles.sh in ${UE4_ROOT}. You can copy this from UnrealEngine source tree."
#fi
#${UE4_ROOT}/GenerateProjectFiles.sh -project="${PWD}/CarlaUE4.uproject" -game -engine -makefiles
# HACK! This generates wrong targets on the Mac! Just replace Linux with Mac everywhere:
#sed -i .original -e "s/Linux/Mac/g" Makefile
# GenerateProjectFiles.sh requires to change directory to location of UE engine Mac batch files
pushd "${UE4_ROOT}/Engine/Build/BatchFiles/Mac/" >/dev/null
./GenerateProjectFiles.sh -project="${CARLAUE4_ROOT_FOLDER}/CarlaUE4.uproject" -game -engine -makefiles
popd >/dev/null
The Xcode project workspace Unreal/CarlaUE4/CarlaUE4.xcworkspace that this generates worked fine to Build & Run the project and launch the UE Editor. It would be great if your how_to_build_on_mac.md doc also included some info about using this file to build/run the project too.
For the command line UE project build though, instead of using make with the Linux->Mac swapped UE Makefile, I had to modify the Util/BuildTools/BuildCarlaUE4.command file to use UE's Mac Build.sh script directly and add -NoUBTMakefiles to prevent an error about invalid makefile contents from the UE Build Tool:
Util/BuildTools/BuildCarlaUE4.command
log "Build CarlaUE4 project."
#make CarlaUE4Editor
# Build.sh requires to change directory to location of UE engine root
pushd "${UE4_ROOT}" >/dev/null
./Engine/Build/BatchFiles/Mac/Build.sh UE4Editor Mac Development -NoUBTMakefiles
popd >/dev/null
For Mac, Xcode is probably the way to go anyways as long as the AppleClang version is still compatible. Thanks again for posting your work!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#150 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AHEKc4MWwqyif8QWydT_yWu4eM4nD6cjks5uSw3-gaJpZM4Rj_40>.
|
Yes, it should be possible to build everything using Xcode and plan to add am option for that if not make it the default on the Mac.
On Aug 20, 2018 3:29 PM, Effendi Dufford <notifications@github.com> wrote:
@analog-cbarber<https://github.com/analog-cbarber> Nice work!
I was able to use your fork's mac-build-0.9 branch to build Carla 0.9 with Xcode 9.4.1 as well, after modifying the Xcode version check in the Util/BuildTools/Setup.command file.
Copying the GenerateProjectFiles.sh to the UE root folder didn't work for me though, so instead I was able to modify the Util/BuildTools/BuildCarlaUE4.command file to call the built in Mac GenerateProjectFiles.sh that comes with the UE engine install package in place:
Util/BuildTools/BuildCarlaUE4.command
log "Generate Unreal project files."
#if [[ ! -f ${UE4_ROOT}/GenerateProjectFiles.sh ]]; then
# fatal_error "No GenerateProjectFiles.sh in ${UE4_ROOT}. You can copy this from UnrealEngine source tree."
#fi
#${UE4_ROOT}/GenerateProjectFiles.sh -project="${PWD}/CarlaUE4.uproject" -game -engine -makefiles
# HACK! This generates wrong targets on the Mac! Just replace Linux with Mac everywhere:
#sed -i .original -e "s/Linux/Mac/g" Makefile
# GenerateProjectFiles.sh requires to change directory to location of UE engine Mac batch files
pushd "${UE4_ROOT}/Engine/Build/BatchFiles/Mac/" >/dev/null
./GenerateProjectFiles.sh -project="${CARLAUE4_ROOT_FOLDER}/CarlaUE4.uproject" -game -engine -makefiles
popd >/dev/null
The Xcode project workspace Unreal/CarlaUE4/CarlaUE4.xcworkspace that this generates worked fine to Build & Run the project and launch the UE Editor. It would be great if your how_to_build_on_mac.md doc also included some info about using this file to build/run the project too.
For the command line UE project build though, instead of using make with the Linux->Mac swapped UE Makefile, I had to modify the Util/BuildTools/BuildCarlaUE4.command file to use UE's Mac Build.sh script directly and add -NoUBTMakefiles to prevent an error about invalid makefile contents from the UE Build Tool:
Util/BuildTools/BuildCarlaUE4.command
log "Build CarlaUE4 project."
#make CarlaUE4Editor
# Build.sh requires to change directory to location of UE engine root
pushd "${UE4_ROOT}" >/dev/null
./Engine/Build/BatchFiles/Mac/Build.sh UE4Editor Mac Development -NoUBTMakefiles
popd >/dev/null
For Mac, Xcode is probably the way to go anyways as long as the AppleClang version is still compatible. Thanks again for posting your work!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#150 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AHEKc4MWwqyif8QWydT_yWu4eM4nD6cjks5uSw3-gaJpZM4Rj_40>.
|
Ah, I was looking for the GenerateProjectFiles.sh file in the /UE_4.19/Engine/Source/ folder since I installed it from the Epic Games Launcher instead of from the full source package, so I could only find the file in the /UE_4.19/Engine/Build/BatchFiles/Mac/ folder and copying that one over didn't work. It did work when I downloaded the GenerateProjectFiles.sh file from Epic's source repo as you linked, but it looks like this script is basically just running:
So it seems that if the BuildCarlaUE4.command file just manually ran these scripts directly, similar to my modification, then there would be no need for copying this file over from the main engine source. |
make package fails with: bash: /Users/Shared/EpicGames/UE_4.21/Engine/Build/BatchFiles/Linux/RunMono.sh: No such file or directory while there is RunMono.sh is in Mac directory. Why is this not selected? |
You shouldn't even bother with make package until you can launch the game in the editor and run it in standalone mode. Since I was unable to do that (because my Mac froze), I probably never tried 'make package' and would not have noticed if it was not correct. |
Having an issue building PythonAPI.3 - Have followed the instructions in how to build for mac. In file included from /Users/savatara/Downloads/carla-mac-build-0.9/LibCarla/source/carla/client/detail/Episode.cpp:7: |
As a small aside, |
If someone got CARLA to work on Mac using Xcode could they maybe put in on GitHub for people to use? I feel like it would help a lot of people! Unless this is already available somewhere? |
We could use some help with this... |
Why am I getting this error when I run ./CarlaUE4.sh in terminal. I have a Mac system.
|
Hi all, I'm wondering is it possible to play the CARLA .log file on a Macbook Pro without GPU? Thanks! |
Hi analog-cbarber, First, thanks for your work.
How do I change the config when build UE4Editor-Carla? And run time shows map error
|
Sorry, but I have not been working on CARLA or Unreal engine since when I wrote that, so I don't have any useful insight. You might have to spend some time understanding the cmake files. It is also possible that if you are still trying to build an old version of CARLA on an old version of Unreal that there are things that may not work on the later Mac versions. I was able to just install the old Unreal engine directly and use that to save time, but it is possible you may have to build it from scratch. |
Hi, are there any kind of Instructions to build CARLA on MAC? I have reading the thread but it's confusing. Do you have instructions or steeps to get CARLA on Mac? Thank you for your previous work in this thread |
Hi @SevillaFe do you have any progress or update on using CARLA on mac ? If so kindly share. Thank you. |
Can someone share their running build for CARLA for Mac please? I have an M2 chip, but should be fine with any which is working on apple silicon. |
Hi @raiprabh , I was making it work with mac m1 but was not working properly for me. So at the end, I am now using a lenovo laptop with nvidia gpu for the task. It is not impossible but its really too much energy to waste configuring on mac i think. |
Is their any solution for it ? Is their any proper documentation to install and run carla in mac os |
I think this issue itself is the only "official" documentation so far now. |
Given that it is not currently supported and would be non-trivial to get working (it took at least a full week for me 5 years ago), you have to first ask why do you need this to run on a Mac? Is it just because you don't currently own a suitable Windows or Linux GPU machine or there really is some specific reason you need Mac specifically. If the former, I would suggest that you should just bite the bullet and buy a suitable machine and save yourself the time and aggravation. |
Hi, could you make it work? |
I don't know that anyone actually has a running Mac build currently. |
I have been struggling a lot with Mac and could not find a solution either... |
Online I see that there only exist manual for installing and building Carla on Linux. Is it possible for installing and running it on Mac?
The text was updated successfully, but these errors were encountered: