carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
11.19k stars 3.61k forks source link

Windows 10: make PythonAPI stops at BuildOSM2ODR. CMake Error: The source directory "D:/carla/Build/osm2odr-visualstudio/x64" does not exist. #7073

Closed juanrodriguezdekra closed 8 months ago

juanrodriguezdekra commented 8 months ago

Hi,

I am trying to build the Carla 0.9.15 latest source code on Windows 10.

When I do make PythonAPI in Visual studio 19 x64 command prompt, the process stops at BuildOSM2ODR with CMAKE error. I got this error:

CMake Error: The source directory "D:/carla/Build/osm2odr-visualstudio/x64" does not exist. Specify --help for usage, or press the help button on the CMake GUI. Error: could not load cache El sistema no puede encontrar el archivo especificado. El sistema no puede encontrar el archivo especificado. -[BuildOSM2ODR]: OSM2ODR has been successfully installed in "D:\carla\PythonAPI\carla\dependencies\" -[BuildPythonAPI]: [Batch params]: --py3 Building Python API for Python 3. compiling:

!! self.initialize_options() running install_lib running build_py creating build creating build\lib.win-amd64-cpython-312 creating build\lib.win-amd64-cpython-312\carla copying source\carla\command.py -> build\lib.win-amd64-cpython-312\carla copying source\carla__init__.py -> build\lib.win-amd64-cpython-312\carla running build_ext building 'carla.libcarla' extension creating build\temp.win-amd64-cpython-312 creating build\temp.win-amd64-cpython-312\Release creating build\temp.win-amd64-cpython-312\Release\source creating build\temp.win-amd64-cpython-312\Release\source\libcarla "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Idependencies/include "-IC:\Program Files\Python312\include" "-IC:\Program Files\Python312\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\cppwinrt" /EHsc /Tpsource/libcarla/libcarla.cpp /Fobuild\temp.win-amd64-cpython-312\Release\source/libcarla/libcarla.obj /experimental:external /external:W0 /external:I dependencies/include/system /DBOOST_ALL_NO_LIB /DBOOST_PYTHON_STATIC_LIB /DBOOST_ERROR_CODE_HEADER_ONLY /D_WIN32_WINNT=0x0600 /DHAVE_SNPRINTF /DLIBCARLA_WITH_PYTHON_SUPPORT -DLIBCARLA_IMAGE_WITH_PNG_SUPPORT=true /MD libcarla.cpp D:\carla\PythonAPI\carla\source\libcarla\OSM2ODR.cpp(7): fatal error C1083: No se puede abrir el archivo incluir: 'OSM2ODR.h': No such file or directory error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\cl.exe' failed with exit code 2

-[BuildPythonAPI]: Carla lib for python has been successfully installed in "D:\carla\PythonAPI\carla\dist"!

When I look into OSM2ODR.bat file it should be in line 112 like:

cmake -G %GENERATOR% %PLATFORM%^

But instead of that, it seems that my OSM2ODR.bat file has been build in a different way, I don,t know why. This is my OSM2ODR.bat file:

! /bin/bash

DOC_STRING="Build OSM2ODR."

USAGE_STRING=$(cat <<- END Usage: $0 [-h|--help]

commands

[--clean]    Clean intermediate files.
[--rebuild]  Clean and rebuild both configurations.

END )

REMOVE_INTERMEDIATE=false BUILD_OSM2ODR=false GIT_PULL=true CURRENT_OSM2ODR_COMMIT=1835e1e9538d0778971acc8b19b111834aae7261 OSM2ODR_BRANCH=aaron/defaultsidewalkwidth OSM2ODR_REPO=https://github.com/carla-simulator/sumo.git

OPTS=getopt -o h --long help,rebuild,build,clean,carsim,no-pull -n 'parse-options' -- "$@"

eval set -- "$OPTS"

while [[ $# -gt 0 ]]; do case "$1" in --rebuild ) REMOVE_INTERMEDIATE=true; BUILD_OSM2ODR=true; shift ;; --build ) BUILD_OSM2ODR=true; shift ;; --no-pull ) GIT_PULL=false shift ;; --clean ) REMOVE_INTERMEDIATE=true; shift ;; -h | --help ) echo "$DOC_STRING" echo "$USAGE_STRING" exit 1 ;;

source $(dirname "$0")/Environment.sh

function get_source_code_checksum { local EXCLUDE='pycache' find "${OSM2ODR_SOURCE_FOLDER}"/* ! -path "${EXCLUDE}" -print0 | sha1sum | awk '{print $1}' }

if ! { ${REMOVE_INTERMEDIATE} || ${BUILD_OSM2ODR}; }; then fatal_error "Nothing selected to be done." fi

==============================================================================

-- Clean intermediate files --------------------------------------------------

==============================================================================

if ${REMOVE_INTERMEDIATE} ; then

log "Cleaning intermediate files and folders."

rm -Rf ${OSM2ODR_BUILD_FOLDER}*

fi

==============================================================================

-- Build library -------------------------------------------------------------

==============================================================================

if ${BUILD_OSM2ODR} ; then log "Building OSM2ODR."

[ ! -d ${OSM2ODR_BUILD_FOLDER} ] && mkdir ${OSM2ODR_BUILD_FOLDER}

if ${GIT_PULL} ; then if [ ! -d ${OSM2ODR_SOURCE_FOLDER} ] ; then git clone -b ${OSM2ODR_BRANCH} ${OSM2ODR_REPO} ${OSM2ODR_SOURCE_FOLDER} fi cd ${OSM2ODR_SOURCE_FOLDER} git fetch git checkout ${CURRENT_OSM2ODR_COMMIT} fi

mkdir -p ${OSM2ODR_BUILD_FOLDER} cd ${OSM2ODR_BUILD_FOLDER}

export CC="$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/bin/clang" export CXX="$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/bin/clang++" export PATH="$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/bin:$PATH"

cmake ${OSM2ODR_SOURCE_FOLDER} \ -G "Eclipse CDT4 - Ninja" \ -DCMAKE_CXX_FLAGS="-stdlib=libstdc++" \ -DCMAKE_INSTALL_PREFIX=${LIBCARLA_INSTALL_CLIENT_FOLDER} \ -DPROJ_INCLUDE_DIR=${CARLA_BUILD_FOLDER}/proj-install/include \ -DPROJ_LIBRARY=${CARLA_BUILD_FOLDER}/proj-install/lib/libproj.a \ -DXercesC_INCLUDE_DIR=${CARLA_BUILD_FOLDER}/xerces-c-3.2.3-install/include \ -DXercesC_LIBRARY=${CARLA_BUILD_FOLDER}/xerces-c-3.2.3-install/lib/libxerces-c.a

ninja osm2odr ninja install

mkdir -p ${OSM2ODR_SERVER_BUILD_FOLDER} cd ${OSM2ODR_SERVER_BUILD_FOLDER}

LLVM_BASENAME=llvm-8.0 LLVM_INCLUDE="$UE4_ROOT/Engine/Source/ThirdParty/Linux/LibCxx/include/c++/v1" LLVM_LIBPATH="$UE4_ROOT/Engine/Source/ThirdParty/Linux/LibCxx/lib/Linux/x86_64-unknown-linux-gnu"

echo $LLVM_INCLUDE echo $LLVM_LIBPATH

cmake ${OSM2ODR_SOURCE_FOLDER} \ -G "Eclipse CDT4 - Ninja" \ -DCMAKE_CXX_FLAGS="-fPIC -std=c++14 -stdlib=libc++ -I${LLVM_INCLUDE} -L${LLVM_LIBPATH}" \ -DCMAKE_INSTALL_PREFIX=${LIBCARLA_INSTALL_SERVER_FOLDER} \ -DPROJ_INCLUDE_DIR=${CARLA_BUILD_FOLDER}/proj-install-server/include \ -DPROJ_LIBRARY=${CARLA_BUILD_FOLDER}/proj-install-server/lib/libproj.a \ -DXercesC_INCLUDE_DIR=${CARLA_BUILD_FOLDER}/xerces-c-3.2.3-install-server/include \ -DXercesC_LIBRARY=${CARLA_BUILD_FOLDER}/xerces-c-3.2.3-install-server/lib/libxerces-c.a

ninja osm2odr ninja install

mkdir -p ${OSM2ODR_SERVER_BUILD_FOLDER} cd ${OSM2ODR_SERVER_BUILD_FOLDER}

LLVM_BASENAME=llvm-8.0 LLVM_INCLUDE="$UE4_ROOT/Engine/Source/ThirdParty/Linux/LibCxx/include/c++/v1" LLVM_LIBPATH="$UE4_ROOT/Engine/Source/ThirdParty/Linux/LibCxx/lib/Linux/x86_64-unknown-linux-gnu"

cmake ${OSM2ODR_SOURCE_FOLDER} \ -G "Eclipse CDT4 - Ninja" \ -DCMAKE_CXX_FLAGS="-fPIC -std=c++14 -stdlib=libc++ -I${LLVM_INCLUDE} -L${LLVM_LIBPATH}" \ -DCMAKE_INSTALL_PREFIX=${LIBCARLA_INSTALL_SERVER_FOLDER} \ -DPROJ_INCLUDE_DIR=${CARLA_BUILD_FOLDER}/proj-install-server/include \ -DPROJ_LIBRARY=${CARLA_BUILD_FOLDER}/proj-install-server/lib/libproj.a \ -DXercesC_INCLUDE_DIR=${CARLA_BUILD_FOLDER}/xerces-c-3.2.3-install-server/include \ -DXercesC_LIBRARY=${CARLA_BUILD_FOLDER}/xerces-c-3.2.3-install-server/lib/libxerces-c.a

ninja osm2odr ninja install

fi

log " OSM2ODR Success!"

pseventekidis commented 8 months ago

Try to delete the whole carla directory and clone from git again. I had the same issue when I downloaded manually the source code. With git clone from command line it was gone

juanrodriguezdekra commented 8 months ago

I,ve done and it works. I then proceeded to change the command on line 112 to: cmake -G %GENERATOR% -A x64^

In the PythonAPI make everything was correct and without incident. make PythonAPI without errors

But in the make launch I got make: *** [CarlaUE4Editor] Error 6. Apparently without a fatal error, as you can see in the attached image. error make launch

This is the new point I'm stuck at, in case anyone knows how to get out of here.

pseventekidis commented 8 months ago

I will share my experience once more for the windows build. All problems for me were due to the fact that I downloaded the code manually and did not use the git command. Maybe you can also delete the carla directory completely and try again (provided Unreal is ok ). # I see you did already ok Did you get all the Visual Studio correct? Also the Unreal directory as an env variable. Did you do it? Final thing. I said do the git command for the carla source code. If it worked for you it could be well that the internet connection is involved in the problems too. Try to get the dependecies manually and use this command (see the docs online) tar -xvzf .tar.gz.tar -C C:\path\to\carla\Unreal\CarlaUE4\Content\Carla Maybe something is wrong if you downloaded with bad connection. Finally if you have the option for the ubuntu build go for it instead. I had zero problems there.

juanrodriguezdekra commented 8 months ago

I have completely deleted Carla and downloaded it from git. Using the latest assets but the make error persists, even downloading them manually. This time with the fatal error C1083 as in the image I attach:

D:\carla\Unreal\CarlaUE4\Plugins\Carla\Source\Carla/Sensor/SceneCaptureSensor.h(15): fatal error C1083: No se puede abrir el archivo incluir: 'Renderer/Public/GBufferView.h': No such file or directory make: *** [CarlaUE4Editor] Error 6

error make launch

The path that UE4_ROOT points to is: D:\UnrealEngine\

juanrodriguezdekra commented 8 months ago

The problem of D:\carla\Unreal\CarlaUE4\Plugins\Carla\Source\Carla/Sensor/SceneCaptureSensor.h(15): fatal error C1083: Cannot open file include: 'Renderer/Public/GBufferView.h' : No such file or directory resides in the branch in which it is being built. This way you can fix it: Clone the repository, make sure you are on the "carla" branch and make sure you rebuild the engine afterwards. Then rebuild Carla version 0.9.15. This should solve the problem.

The GBufferView header cannot be compiled because it is not found in the standard version of Unreal Engine. It is something that has been added to Carla's branch. If you do a git diff between both versions of standard Unreal and Carla's, you'll notice that there are only a few changes, and the addition of GBufferView is one of them.

The solution is reinstalling UE4 and Carla folder from the begining, and that is all.

juanrodriguezdekra commented 8 months ago

Check this issue #6362 .

juanrodriguezdekra commented 8 months ago

Check this issue #6898 .