Skip to content

Commit f1869c0

Browse files
bnbarhamrintaro
authored andcommitted
[stdlib] Set PYTHONIOENCODING when building the stdlib
Ubuntu 18.04 seems to be defaulting to 'ascii', causing an error when using line-directive combined with the utf-8 diagnostic output used when early swift syntax is enabled. (cherry picked from commit afd3f17) (cherry picked from commit f038280)
1 parent 78188b3 commit f1869c0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

stdlib/cmake/modules/SwiftSource.cmake

+5-4
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,7 @@ function(_compile_swift_files
799799
set(swift_compiler_tool "${SWIFT_SOURCE_DIR}/utils/check-incremental" "${swift_compiler_tool}")
800800
endif()
801801

802+
set(custom_env "PYTHONIOENCODING=UTF8")
802803
if(SWIFTFILE_IS_STDLIB OR
803804
# Linux "hosttools" build require builder's runtime before building the runtime.
804805
(BOOTSTRAPPING_MODE STREQUAL "HOSTTOOLS" AND SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD|FREEBSD")
@@ -808,14 +809,14 @@ function(_compile_swift_files
808809
# When building the stdlib with bootstrapping, the compiler needs
809810
# to pick up the stdlib from the previous bootstrapping stage, because the
810811
# stdlib in the current stage is not built yet.
811-
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_APPLE_PLATFORMS)
812-
set(set_environment_args "${CMAKE_COMMAND}" "-E" "env" "DYLD_LIBRARY_PATH=${bs_lib_dir}")
812+
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
813+
list(APPEND custom_env "DYLD_LIBRARY_PATH=${bs_lib_dir}")
813814
elseif(SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD|FREEBSD")
814-
set(set_environment_args "${CMAKE_COMMAND}" "-E" "env" "LD_LIBRARY_PATH=${bs_lib_dir}")
815+
list(APPEND custom_env "LD_LIBRARY_PATH=${bs_lib_dir}")
815816
endif()
816817
endif()
817-
818818
endif()
819+
set(set_environment_args "${CMAKE_COMMAND}" "-E" "env" "${custom_env}")
819820

820821
if (SWIFT_REPORT_STATISTICS)
821822
list(GET dirs_to_create 0 first_obj_dir)

0 commit comments

Comments
 (0)