Skip to content

Commit afd3f17

Browse files
committed
[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.
1 parent 2b6b3fd commit afd3f17

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

stdlib/cmake/modules/SwiftSource.cmake

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,7 @@ function(_compile_swift_files
801801
set(swift_compiler_tool "${SWIFT_SOURCE_DIR}/utils/check-incremental" "${swift_compiler_tool}")
802802
endif()
803803

804+
set(custom_env "PYTHONIOENCODING=UTF8")
804805
if(SWIFTFILE_IS_STDLIB OR
805806
# Linux "hosttools" build require builder's runtime before building the runtime.
806807
(BOOTSTRAPPING_MODE STREQUAL "HOSTTOOLS" AND SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD|FREEBSD")
@@ -811,13 +812,13 @@ function(_compile_swift_files
811812
# to pick up the stdlib from the previous bootstrapping stage, because the
812813
# stdlib in the current stage is not built yet.
813814
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_APPLE_PLATFORMS)
814-
set(set_environment_args "${CMAKE_COMMAND}" "-E" "env" "DYLD_LIBRARY_PATH=${bs_lib_dir}")
815+
list(APPEND custom_env "DYLD_LIBRARY_PATH=${bs_lib_dir}")
815816
elseif(SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD|FREEBSD")
816-
set(set_environment_args "${CMAKE_COMMAND}" "-E" "env" "LD_LIBRARY_PATH=${bs_lib_dir}")
817+
list(APPEND custom_env "LD_LIBRARY_PATH=${bs_lib_dir}")
817818
endif()
818819
endif()
819-
820820
endif()
821+
set(set_environment_args "${CMAKE_COMMAND}" "-E" "env" "${custom_env}")
821822

822823
if (SWIFT_REPORT_STATISTICS)
823824
list(GET dirs_to_create 0 first_obj_dir)

0 commit comments

Comments
 (0)