From 732793e7adb4dc41185e05bc4e478cf02b3722d7 Mon Sep 17 00:00:00 2001 From: Artem Dinaburg Date: Thu, 24 Mar 2022 12:09:52 -0700 Subject: [PATCH 01/10] Do not build libcxx/libcxxabi when building llvm --- ports/llvm-12/vcpkg.json | 2 -- ports/llvm-13/vcpkg.json | 2 -- 2 files changed, 4 deletions(-) diff --git a/ports/llvm-12/vcpkg.json b/ports/llvm-12/vcpkg.json index a6ba0516..22cafd35 100644 --- a/ports/llvm-12/vcpkg.json +++ b/ports/llvm-12/vcpkg.json @@ -20,8 +20,6 @@ "compiler-rt", "default-options", "cxx-common-targets", - "libcxx", - "libcxxabi", "mlir", "tools", "utils" diff --git a/ports/llvm-13/vcpkg.json b/ports/llvm-13/vcpkg.json index 266f8b2f..85701c46 100644 --- a/ports/llvm-13/vcpkg.json +++ b/ports/llvm-13/vcpkg.json @@ -21,8 +21,6 @@ "compiler-rt", "default-options", "cxx-common-targets", - "libcxx", - "libcxxabi", "mlir", "tools", "utils" From 2a9af4cbc467f44469c39360af8252f58012c3ae Mon Sep 17 00:00:00 2001 From: Artem Dinaburg Date: Thu, 24 Mar 2022 12:10:04 -0700 Subject: [PATCH 02/10] Fix xed to use the correct compiler --- ports/xed/portfile.cmake | 11 +++++++++-- ports/xed/vcpkg.json | 8 +++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ports/xed/portfile.cmake b/ports/xed/portfile.cmake index 4b261bb6..fc67289e 100644 --- a/ports/xed/portfile.cmake +++ b/ports/xed/portfile.cmake @@ -18,6 +18,13 @@ vcpkg_from_github( HEAD_REF master ) +# Xed has its own compiler detection, and will readily guess wrong. +# Help it out by finding the correct compiler +vcpkg_cmake_get_vars(cmake_vars_file) +include("${cmake_vars_file}") +message(STATUS "Detected CXX compiler: ${VCPKG_DETECTED_CMAKE_CXX_COMPILER}") +message(STATUS "Detected C compiler: ${VCPKG_DETECTED_CMAKE_C_COMPILER}") + # Copy mbuild sources. message(STATUS "Copying mbuild to parallel source directory...") file(COPY ${MBUILD_SOURCE_PATH}/ DESTINATION ${SOURCE_PATH}/../mbuild) @@ -53,7 +60,7 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release) file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}) file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}) vcpkg_execute_required_process( - COMMAND ${PYTHON3} ${SOURCE_PATH}/mfile.py install --${LINK_TYPE} --install-dir ${CURRENT_PACKAGES_DIR} --build-dir "${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}" -j ${VCPKG_CONCURRENCY} "--extra-ccflags=${VCPKG_C_FLAGS} ${VCPKG_C_FLAGS_RELEASE} ${EXTRA_C_FLAGS_RELEASE}" "--extra-cxxflags=${VCPKG_CXX_FLAGS} ${VCPKG_CXX_FLAGS_RELEASE} ${EXTRA_CXX_FLAGS_RELEASE}" "--extra-linkflags=${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_RELEASE}" --verbose=9 + COMMAND ${PYTHON3} ${SOURCE_PATH}/mfile.py install --cc=${VCPKG_DETECTED_CMAKE_C_COMPILER} --cxx=${VCPKG_DETECTED_CMAKE_CXX_COMPILER} --${LINK_TYPE} --install-dir ${CURRENT_PACKAGES_DIR} --build-dir "${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}" -j ${VCPKG_CONCURRENCY} "--extra-ccflags=${VCPKG_C_FLAGS} ${VCPKG_C_FLAGS_RELEASE} ${EXTRA_C_FLAGS_RELEASE}" "--extra-cxxflags=${VCPKG_CXX_FLAGS} ${VCPKG_CXX_FLAGS_RELEASE} ${EXTRA_CXX_FLAGS_RELEASE}" "--extra-linkflags=${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_RELEASE}" --verbose=9 WORKING_DIRECTORY ${SOURCE_PATH} LOGNAME python-${TARGET_TRIPLET}-build-install-rel ) @@ -75,7 +82,7 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug) file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET}) file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET}) vcpkg_execute_required_process( - COMMAND ${PYTHON3} ${SOURCE_PATH}/mfile.py install --debug --${LINK_TYPE} --install-dir ${CURRENT_PACKAGES_DIR}/debug --build-dir "${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET}" -j ${VCPKG_CONCURRENCY} "--extra-ccflags=${VCPKG_C_FLAGS} ${VCPKG_C_FLAGS_DEBUG} ${EXTRA_C_FLAGS_DEBUG}" "--extra-cxxflags=${VCPKG_CXX_FLAGS} ${VCPKG_CXX_FLAGS_DEBUG} ${EXTRA_CXX_FLAGS_DEBUG}" "--extra-linkflags=${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_DEBUG}" --verbose=9 + COMMAND ${PYTHON3} ${SOURCE_PATH}/mfile.py install --cc=${VCPKG_DETECTED_CMAKE_C_COMPILER} --cxx=${VCPKG_DETECTED_CMAKE_CXX_COMPILER} --debug --${LINK_TYPE} --install-dir ${CURRENT_PACKAGES_DIR}/debug --build-dir "${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET}" -j ${VCPKG_CONCURRENCY} "--extra-ccflags=${VCPKG_C_FLAGS} ${VCPKG_C_FLAGS_DEBUG} ${EXTRA_C_FLAGS_DEBUG}" "--extra-cxxflags=${VCPKG_CXX_FLAGS} ${VCPKG_CXX_FLAGS_DEBUG} ${EXTRA_CXX_FLAGS_DEBUG}" "--extra-linkflags=${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_DEBUG}" --verbose=9 WORKING_DIRECTORY ${SOURCE_PATH} LOGNAME python-${TARGET_TRIPLET}-build-install-dbg ) diff --git a/ports/xed/vcpkg.json b/ports/xed/vcpkg.json index 39f4d367..2e0c29be 100644 --- a/ports/xed/vcpkg.json +++ b/ports/xed/vcpkg.json @@ -3,5 +3,11 @@ "version-string": "12.0.1", "port-version": 1, "description": "x86 encoder decoder", - "homepage": "https://intelxed.github.io/" + "homepage": "https://intelxed.github.io/", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ] } From a371e7a8669de71b867f942ebf86ee1da6da01bc Mon Sep 17 00:00:00 2001 From: Artem Dinaburg Date: Thu, 24 Mar 2022 12:10:41 -0700 Subject: [PATCH 03/10] Update triplets for asan --- triplets/arm64-osx-asan.cmake | 6 +++--- triplets/x64-linux-asan.cmake | 11 +++++++---- triplets/x64-linux-rel-asan.cmake | 2 +- triplets/x64-osx-asan.cmake | 6 +++--- triplets/x64-osx-rel-asan.cmake | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/triplets/arm64-osx-asan.cmake b/triplets/arm64-osx-asan.cmake index 4cf27600..9f8b1098 100644 --- a/triplets/arm64-osx-asan.cmake +++ b/triplets/arm64-osx-asan.cmake @@ -8,9 +8,9 @@ set(VCPKG_USE_SANITIZER "Address") # If the following flags cause errors during build, you might need to manually # ignore the PORT and check VCPKG_USE_SANITIZER -if(NOT PORT MATCHES "^((llvm)|(llvm-[0-9]+)|(upb))$") - set(VCPKG_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") - set(VCPKG_C_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") +if(NOT PORT MATCHES "^((upb))$") + set(VCPKG_CXX_FLAGS "-O1 -gfull -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_C_FLAGS "-O1 -gfull -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") endif() # Always apply sanitizer to linker flags diff --git a/triplets/x64-linux-asan.cmake b/triplets/x64-linux-asan.cmake index 45f529ec..97742cb2 100644 --- a/triplets/x64-linux-asan.cmake +++ b/triplets/x64-linux-asan.cmake @@ -5,12 +5,15 @@ set(VCPKG_LIBRARY_LINKAGE static) # ASAN # Make sure this value matches up with https://llvm.org/docs/CMake.html "LLVM_USE_SANITIZER" set(VCPKG_USE_SANITIZER "Address") + # If the following flags cause errors during build, you might need to manually # ignore the PORT and check VCPKG_USE_SANITIZER -if(NOT PORT MATCHES "^((llvm)|(llvm-[0-9]+)|(upb))$") - set(VCPKG_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") - set(VCPKG_C_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") - set(VCPKG_LINKER_FLAGS "-fsanitize=address") +if(NOT PORT MATCHES "^((upb))$") + set(VCPKG_CXX_FLAGS "-O1 -gfull -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_C_FLAGS "-O1 -gfull -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") endif() +# Always apply sanitizer to linker flags +set(VCPKG_LINKER_FLAGS "-fsanitize=address") + set(VCPKG_CMAKE_SYSTEM_NAME Linux) diff --git a/triplets/x64-linux-rel-asan.cmake b/triplets/x64-linux-rel-asan.cmake index a27f04e8..ba72018a 100644 --- a/triplets/x64-linux-rel-asan.cmake +++ b/triplets/x64-linux-rel-asan.cmake @@ -8,7 +8,7 @@ set(VCPKG_USE_SANITIZER "Address") # If the following flags cause errors during build, you might need to manually # ignore the PORT and check VCPKG_USE_SANITIZER -if(NOT PORT MATCHES "^((llvm)|(llvm-[0-9]+)|(upb))$") +if(NOT PORT MATCHES "^((upb))$") set(VCPKG_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") set(VCPKG_C_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") endif() diff --git a/triplets/x64-osx-asan.cmake b/triplets/x64-osx-asan.cmake index 504fbdb9..502315f8 100644 --- a/triplets/x64-osx-asan.cmake +++ b/triplets/x64-osx-asan.cmake @@ -8,9 +8,9 @@ set(VCPKG_USE_SANITIZER "Address") # If the following flags cause errors during build, you might need to manually # ignore the PORT and check VCPKG_USE_SANITIZER -if(NOT PORT MATCHES "^((llvm)|(llvm-[0-9]+)|(upb))$") - set(VCPKG_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") - set(VCPKG_C_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") +if(NOT PORT MATCHES "^((upb))$") + set(VCPKG_CXX_FLAGS "-O1 -gfull -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_C_FLAGS "-O1 -gfull -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") set(VCPKG_LINKER_FLAGS "-fsanitize=address") endif() diff --git a/triplets/x64-osx-rel-asan.cmake b/triplets/x64-osx-rel-asan.cmake index 3e6bb039..84f9ee20 100644 --- a/triplets/x64-osx-rel-asan.cmake +++ b/triplets/x64-osx-rel-asan.cmake @@ -9,7 +9,7 @@ set(VCPKG_USE_SANITIZER "Address") # If the following flags cause errors during build, you might need to manually # ignore the PORT and check VCPKG_USE_SANITIZER -if(NOT PORT MATCHES "^((llvm)|(llvm-[0-9]+)|(upb))$") +if(NOT PORT MATCHES "^((upb))$") set(VCPKG_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") set(VCPKG_C_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") endif() From 2f77f3167c0e5d17199b012d93785184a6997d2e Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Thu, 24 Mar 2022 15:31:45 -0400 Subject: [PATCH 04/10] Update xed port-version --- ports/xed/vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/xed/vcpkg.json b/ports/xed/vcpkg.json index 2e0c29be..8e98c20b 100644 --- a/ports/xed/vcpkg.json +++ b/ports/xed/vcpkg.json @@ -1,7 +1,7 @@ { "name": "xed", "version-string": "12.0.1", - "port-version": 1, + "port-version": 2, "description": "x86 encoder decoder", "homepage": "https://intelxed.github.io/", "dependencies": [ From f83847d3350bef9525f75e8e0f61b1866b31efb8 Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Thu, 24 Mar 2022 16:21:40 -0400 Subject: [PATCH 05/10] Add all VCPKG_DETECTED_CMAKE flags to XED --- ports/xed/portfile.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ports/xed/portfile.cmake b/ports/xed/portfile.cmake index fc67289e..d5af29b7 100644 --- a/ports/xed/portfile.cmake +++ b/ports/xed/portfile.cmake @@ -4,7 +4,7 @@ vcpkg_from_github( REF 5976632eeaaaad7890c2109d0cfaf4012eaca3b8 # 12.0.1 SHA512 9463e669cc273f55829e82d6032763221c2ba73f3c43191be847f694f6fd3609b866cc14101e8b1f88e7e44f04b4f5f7bf61bb9431b72b7e17ded1db34b7757d HEAD_REF master - PATCHES + PATCHES dont_call_evex_scan_when_error.patch ) @@ -60,7 +60,7 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release) file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}) file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}) vcpkg_execute_required_process( - COMMAND ${PYTHON3} ${SOURCE_PATH}/mfile.py install --cc=${VCPKG_DETECTED_CMAKE_C_COMPILER} --cxx=${VCPKG_DETECTED_CMAKE_CXX_COMPILER} --${LINK_TYPE} --install-dir ${CURRENT_PACKAGES_DIR} --build-dir "${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}" -j ${VCPKG_CONCURRENCY} "--extra-ccflags=${VCPKG_C_FLAGS} ${VCPKG_C_FLAGS_RELEASE} ${EXTRA_C_FLAGS_RELEASE}" "--extra-cxxflags=${VCPKG_CXX_FLAGS} ${VCPKG_CXX_FLAGS_RELEASE} ${EXTRA_CXX_FLAGS_RELEASE}" "--extra-linkflags=${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_RELEASE}" --verbose=9 + COMMAND ${PYTHON3} ${SOURCE_PATH}/mfile.py install "--cc=${VCPKG_DETECTED_CMAKE_C_COMPILER}" "--cxx=${VCPKG_DETECTED_CMAKE_CXX_COMPILER}" --${LINK_TYPE} --install-dir ${CURRENT_PACKAGES_DIR} --build-dir "${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}" -j ${VCPKG_CONCURRENCY} "--extra-ccflags=${VCPKG_DETECTED_CMAKE_C_FLAGS} ${VCPKG_DETECTED_CMAKE_C_FLAGS_RELEASE} ${EXTRA_C_FLAGS_RELEASE}" "--extra-cxxflags=${VCPKG_DETECTED_CMAKE_CXX_FLAGS} ${VCPKG_DETECTED_CMAKE_CXX_FLAGS_RELEASE} ${EXTRA_CXX_FLAGS_RELEASE}" "--extra-linkflags=${VCPKG_DETECTED_CMAKE_LINKER_FLAGS} ${VCPKG_DETECTED_CMAKE_LINKER_FLAGS_RELEASE}" --verbose=9 WORKING_DIRECTORY ${SOURCE_PATH} LOGNAME python-${TARGET_TRIPLET}-build-install-rel ) @@ -82,7 +82,7 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug) file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET}) file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET}) vcpkg_execute_required_process( - COMMAND ${PYTHON3} ${SOURCE_PATH}/mfile.py install --cc=${VCPKG_DETECTED_CMAKE_C_COMPILER} --cxx=${VCPKG_DETECTED_CMAKE_CXX_COMPILER} --debug --${LINK_TYPE} --install-dir ${CURRENT_PACKAGES_DIR}/debug --build-dir "${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET}" -j ${VCPKG_CONCURRENCY} "--extra-ccflags=${VCPKG_C_FLAGS} ${VCPKG_C_FLAGS_DEBUG} ${EXTRA_C_FLAGS_DEBUG}" "--extra-cxxflags=${VCPKG_CXX_FLAGS} ${VCPKG_CXX_FLAGS_DEBUG} ${EXTRA_CXX_FLAGS_DEBUG}" "--extra-linkflags=${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_DEBUG}" --verbose=9 + COMMAND ${PYTHON3} ${SOURCE_PATH}/mfile.py install "--cc=${VCPKG_DETECTED_CMAKE_C_COMPILER}" "--cxx=${VCPKG_DETECTED_CMAKE_CXX_COMPILER}" --debug --${LINK_TYPE} --install-dir ${CURRENT_PACKAGES_DIR}/debug --build-dir "${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET}" -j ${VCPKG_CONCURRENCY} "--extra-ccflags=${VCPKG_DETECTED_CMAKE_C_FLAGS} ${VCPKG_DETECTED_CMAKE_C_FLAGS_DEBUG} ${EXTRA_C_FLAGS_DEBUG}" "--extra-cxxflags=${VCPKG_DETECTED_CMAKE_CXX_FLAGS} ${VCPKG_DETECTED_CMAKE_CXX_FLAGS_DEBUG} ${EXTRA_CXX_FLAGS_DEBUG}" "--extra-linkflags=${VCPKG_DETECTED_CMAKE_LINKER_FLAGS} ${VCPKG_DETECTED_CMAKE_LINKER_FLAGS_DEBUG}" --verbose=9 WORKING_DIRECTORY ${SOURCE_PATH} LOGNAME python-${TARGET_TRIPLET}-build-install-dbg ) From d436fcb65e1053c889e7f78a2927773f55032a34 Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Fri, 25 Mar 2022 11:04:29 -0400 Subject: [PATCH 06/10] Bump vcpkg commit and fix XED compilation on macOS Upstream had a fix for sysroot include directory https://github.com/microsoft/vcpkg/commit/a34997af6c00d3e5711a4a75428c34a99a5f1c8b --- ports/xed/portfile.cmake | 2 +- ports/xed/vcpkg.json | 8 +------- vcpkg_info.txt | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/ports/xed/portfile.cmake b/ports/xed/portfile.cmake index d5af29b7..0bb6189e 100644 --- a/ports/xed/portfile.cmake +++ b/ports/xed/portfile.cmake @@ -20,7 +20,7 @@ vcpkg_from_github( # Xed has its own compiler detection, and will readily guess wrong. # Help it out by finding the correct compiler -vcpkg_cmake_get_vars(cmake_vars_file) +z_vcpkg_get_cmake_vars(cmake_vars_file) include("${cmake_vars_file}") message(STATUS "Detected CXX compiler: ${VCPKG_DETECTED_CMAKE_CXX_COMPILER}") message(STATUS "Detected C compiler: ${VCPKG_DETECTED_CMAKE_C_COMPILER}") diff --git a/ports/xed/vcpkg.json b/ports/xed/vcpkg.json index 8e98c20b..c90526c3 100644 --- a/ports/xed/vcpkg.json +++ b/ports/xed/vcpkg.json @@ -3,11 +3,5 @@ "version-string": "12.0.1", "port-version": 2, "description": "x86 encoder decoder", - "homepage": "https://intelxed.github.io/", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - } - ] + "homepage": "https://intelxed.github.io/" } diff --git a/vcpkg_info.txt b/vcpkg_info.txt index 7165a932..57956f96 100644 --- a/vcpkg_info.txt +++ b/vcpkg_info.txt @@ -1,2 +1,2 @@ https://github.com/microsoft/vcpkg.git -7e7dad5fe20cdc085731343e0e197a7ae655555b +a76eb002a71b6cf7bad343f5e3376dfe6bb83c5c From 1197ed01c9684c3c00a4eb79e152144ece0c39a9 Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Fri, 25 Mar 2022 16:31:37 -0400 Subject: [PATCH 07/10] Use gcc-compatible -gfull flag --- triplets/arm64-osx-asan.cmake | 4 ++-- triplets/x64-linux-asan.cmake | 4 ++-- triplets/x64-linux-rel-asan.cmake | 4 ++-- triplets/x64-osx-asan.cmake | 4 ++-- triplets/x64-osx-rel-asan.cmake | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/triplets/arm64-osx-asan.cmake b/triplets/arm64-osx-asan.cmake index 9f8b1098..eb540062 100644 --- a/triplets/arm64-osx-asan.cmake +++ b/triplets/arm64-osx-asan.cmake @@ -9,8 +9,8 @@ set(VCPKG_USE_SANITIZER "Address") # If the following flags cause errors during build, you might need to manually # ignore the PORT and check VCPKG_USE_SANITIZER if(NOT PORT MATCHES "^((upb))$") - set(VCPKG_CXX_FLAGS "-O1 -gfull -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") - set(VCPKG_C_FLAGS "-O1 -gfull -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_CXX_FLAGS "-O1 -g -fno-eliminate-unused-debug-symbols -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_C_FLAGS "-O1 -g -fno-eliminate-unused-debug-symbols -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") endif() # Always apply sanitizer to linker flags diff --git a/triplets/x64-linux-asan.cmake b/triplets/x64-linux-asan.cmake index 97742cb2..58d4d326 100644 --- a/triplets/x64-linux-asan.cmake +++ b/triplets/x64-linux-asan.cmake @@ -9,8 +9,8 @@ set(VCPKG_USE_SANITIZER "Address") # If the following flags cause errors during build, you might need to manually # ignore the PORT and check VCPKG_USE_SANITIZER if(NOT PORT MATCHES "^((upb))$") - set(VCPKG_CXX_FLAGS "-O1 -gfull -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") - set(VCPKG_C_FLAGS "-O1 -gfull -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_CXX_FLAGS "-O1 -g -fno-eliminate-unused-debug-symbols -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_C_FLAGS "-O1 -g -fno-eliminate-unused-debug-symbols -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") endif() # Always apply sanitizer to linker flags diff --git a/triplets/x64-linux-rel-asan.cmake b/triplets/x64-linux-rel-asan.cmake index ba72018a..3bd7204a 100644 --- a/triplets/x64-linux-rel-asan.cmake +++ b/triplets/x64-linux-rel-asan.cmake @@ -9,8 +9,8 @@ set(VCPKG_USE_SANITIZER "Address") # If the following flags cause errors during build, you might need to manually # ignore the PORT and check VCPKG_USE_SANITIZER if(NOT PORT MATCHES "^((upb))$") - set(VCPKG_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") - set(VCPKG_C_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_CXX_FLAGS "-fsanitize=address -g -fno-eliminate-unused-debug-symbols -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_C_FLAGS "-fsanitize=address -g -fno-eliminate-unused-debug-symbols -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") endif() # Always apply sanitizer to linker flags diff --git a/triplets/x64-osx-asan.cmake b/triplets/x64-osx-asan.cmake index 502315f8..bd4b45e1 100644 --- a/triplets/x64-osx-asan.cmake +++ b/triplets/x64-osx-asan.cmake @@ -9,8 +9,8 @@ set(VCPKG_USE_SANITIZER "Address") # If the following flags cause errors during build, you might need to manually # ignore the PORT and check VCPKG_USE_SANITIZER if(NOT PORT MATCHES "^((upb))$") - set(VCPKG_CXX_FLAGS "-O1 -gfull -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") - set(VCPKG_C_FLAGS "-O1 -gfull -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_CXX_FLAGS "-O1 -g -fno-eliminate-unused-debug-symbols -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_C_FLAGS "-O1 -g -fno-eliminate-unused-debug-symbols -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") set(VCPKG_LINKER_FLAGS "-fsanitize=address") endif() diff --git a/triplets/x64-osx-rel-asan.cmake b/triplets/x64-osx-rel-asan.cmake index 84f9ee20..2a22c750 100644 --- a/triplets/x64-osx-rel-asan.cmake +++ b/triplets/x64-osx-rel-asan.cmake @@ -10,8 +10,8 @@ set(VCPKG_USE_SANITIZER "Address") # If the following flags cause errors during build, you might need to manually # ignore the PORT and check VCPKG_USE_SANITIZER if(NOT PORT MATCHES "^((upb))$") - set(VCPKG_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") - set(VCPKG_C_FLAGS "-fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_CXX_FLAGS "-fsanitize=address -g -fno-eliminate-unused-debug-symbols -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_C_FLAGS "-fsanitize=address -g -fno-eliminate-unused-debug-symbols -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") endif() # Always apply sanitizer to linker flags From 906fc2a6a48228265ac732b72727d77d98e466d3 Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Fri, 25 Mar 2022 16:36:39 -0400 Subject: [PATCH 08/10] Update vcpkg to latest commit --- vcpkg_info.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcpkg_info.txt b/vcpkg_info.txt index 7165a932..57956f96 100644 --- a/vcpkg_info.txt +++ b/vcpkg_info.txt @@ -1,2 +1,2 @@ https://github.com/microsoft/vcpkg.git -7e7dad5fe20cdc085731343e0e197a7ae655555b +a76eb002a71b6cf7bad343f5e3376dfe6bb83c5c From e04607cf087cd21e7770b2050d5bd2c946dcc0ca Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Fri, 25 Mar 2022 16:38:37 -0400 Subject: [PATCH 09/10] Correctly pass all vcpkg flags to XED buildsystem Now we build with the selected compiler instead of whatever mbuild was picking up. We also correctly add the requested vcpkg flags, which affects the sanitizer build(s). --- ports/xed/portfile.cmake | 13 ++++++++++--- ports/xed/vcpkg.json | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ports/xed/portfile.cmake b/ports/xed/portfile.cmake index 4b261bb6..0bb6189e 100644 --- a/ports/xed/portfile.cmake +++ b/ports/xed/portfile.cmake @@ -4,7 +4,7 @@ vcpkg_from_github( REF 5976632eeaaaad7890c2109d0cfaf4012eaca3b8 # 12.0.1 SHA512 9463e669cc273f55829e82d6032763221c2ba73f3c43191be847f694f6fd3609b866cc14101e8b1f88e7e44f04b4f5f7bf61bb9431b72b7e17ded1db34b7757d HEAD_REF master - PATCHES + PATCHES dont_call_evex_scan_when_error.patch ) @@ -18,6 +18,13 @@ vcpkg_from_github( HEAD_REF master ) +# Xed has its own compiler detection, and will readily guess wrong. +# Help it out by finding the correct compiler +z_vcpkg_get_cmake_vars(cmake_vars_file) +include("${cmake_vars_file}") +message(STATUS "Detected CXX compiler: ${VCPKG_DETECTED_CMAKE_CXX_COMPILER}") +message(STATUS "Detected C compiler: ${VCPKG_DETECTED_CMAKE_C_COMPILER}") + # Copy mbuild sources. message(STATUS "Copying mbuild to parallel source directory...") file(COPY ${MBUILD_SOURCE_PATH}/ DESTINATION ${SOURCE_PATH}/../mbuild) @@ -53,7 +60,7 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release) file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}) file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}) vcpkg_execute_required_process( - COMMAND ${PYTHON3} ${SOURCE_PATH}/mfile.py install --${LINK_TYPE} --install-dir ${CURRENT_PACKAGES_DIR} --build-dir "${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}" -j ${VCPKG_CONCURRENCY} "--extra-ccflags=${VCPKG_C_FLAGS} ${VCPKG_C_FLAGS_RELEASE} ${EXTRA_C_FLAGS_RELEASE}" "--extra-cxxflags=${VCPKG_CXX_FLAGS} ${VCPKG_CXX_FLAGS_RELEASE} ${EXTRA_CXX_FLAGS_RELEASE}" "--extra-linkflags=${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_RELEASE}" --verbose=9 + COMMAND ${PYTHON3} ${SOURCE_PATH}/mfile.py install "--cc=${VCPKG_DETECTED_CMAKE_C_COMPILER}" "--cxx=${VCPKG_DETECTED_CMAKE_CXX_COMPILER}" --${LINK_TYPE} --install-dir ${CURRENT_PACKAGES_DIR} --build-dir "${CURRENT_BUILDTREES_DIR}/${RELEASE_TRIPLET}" -j ${VCPKG_CONCURRENCY} "--extra-ccflags=${VCPKG_DETECTED_CMAKE_C_FLAGS} ${VCPKG_DETECTED_CMAKE_C_FLAGS_RELEASE} ${EXTRA_C_FLAGS_RELEASE}" "--extra-cxxflags=${VCPKG_DETECTED_CMAKE_CXX_FLAGS} ${VCPKG_DETECTED_CMAKE_CXX_FLAGS_RELEASE} ${EXTRA_CXX_FLAGS_RELEASE}" "--extra-linkflags=${VCPKG_DETECTED_CMAKE_LINKER_FLAGS} ${VCPKG_DETECTED_CMAKE_LINKER_FLAGS_RELEASE}" --verbose=9 WORKING_DIRECTORY ${SOURCE_PATH} LOGNAME python-${TARGET_TRIPLET}-build-install-rel ) @@ -75,7 +82,7 @@ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug) file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET}) file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET}) vcpkg_execute_required_process( - COMMAND ${PYTHON3} ${SOURCE_PATH}/mfile.py install --debug --${LINK_TYPE} --install-dir ${CURRENT_PACKAGES_DIR}/debug --build-dir "${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET}" -j ${VCPKG_CONCURRENCY} "--extra-ccflags=${VCPKG_C_FLAGS} ${VCPKG_C_FLAGS_DEBUG} ${EXTRA_C_FLAGS_DEBUG}" "--extra-cxxflags=${VCPKG_CXX_FLAGS} ${VCPKG_CXX_FLAGS_DEBUG} ${EXTRA_CXX_FLAGS_DEBUG}" "--extra-linkflags=${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_DEBUG}" --verbose=9 + COMMAND ${PYTHON3} ${SOURCE_PATH}/mfile.py install "--cc=${VCPKG_DETECTED_CMAKE_C_COMPILER}" "--cxx=${VCPKG_DETECTED_CMAKE_CXX_COMPILER}" --debug --${LINK_TYPE} --install-dir ${CURRENT_PACKAGES_DIR}/debug --build-dir "${CURRENT_BUILDTREES_DIR}/${DEBUG_TRIPLET}" -j ${VCPKG_CONCURRENCY} "--extra-ccflags=${VCPKG_DETECTED_CMAKE_C_FLAGS} ${VCPKG_DETECTED_CMAKE_C_FLAGS_DEBUG} ${EXTRA_C_FLAGS_DEBUG}" "--extra-cxxflags=${VCPKG_DETECTED_CMAKE_CXX_FLAGS} ${VCPKG_DETECTED_CMAKE_CXX_FLAGS_DEBUG} ${EXTRA_CXX_FLAGS_DEBUG}" "--extra-linkflags=${VCPKG_DETECTED_CMAKE_LINKER_FLAGS} ${VCPKG_DETECTED_CMAKE_LINKER_FLAGS_DEBUG}" --verbose=9 WORKING_DIRECTORY ${SOURCE_PATH} LOGNAME python-${TARGET_TRIPLET}-build-install-dbg ) diff --git a/ports/xed/vcpkg.json b/ports/xed/vcpkg.json index 39f4d367..c90526c3 100644 --- a/ports/xed/vcpkg.json +++ b/ports/xed/vcpkg.json @@ -1,7 +1,7 @@ { "name": "xed", "version-string": "12.0.1", - "port-version": 1, + "port-version": 2, "description": "x86 encoder decoder", "homepage": "https://intelxed.github.io/" } From 6d89f21b0f7535bbfb69e20e8d21d3da1ef35e33 Mon Sep 17 00:00:00 2001 From: Eric Kilmer Date: Fri, 25 Mar 2022 18:12:26 -0400 Subject: [PATCH 10/10] Remove unneeded flags for sanitizers --- triplets/arm64-osx-asan.cmake | 4 ++-- triplets/x64-linux-asan.cmake | 4 ++-- triplets/x64-linux-rel-asan.cmake | 4 ++-- triplets/x64-osx-asan.cmake | 4 ++-- triplets/x64-osx-rel-asan.cmake | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/triplets/arm64-osx-asan.cmake b/triplets/arm64-osx-asan.cmake index eb540062..e710b8e0 100644 --- a/triplets/arm64-osx-asan.cmake +++ b/triplets/arm64-osx-asan.cmake @@ -9,8 +9,8 @@ set(VCPKG_USE_SANITIZER "Address") # If the following flags cause errors during build, you might need to manually # ignore the PORT and check VCPKG_USE_SANITIZER if(NOT PORT MATCHES "^((upb))$") - set(VCPKG_CXX_FLAGS "-O1 -g -fno-eliminate-unused-debug-symbols -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") - set(VCPKG_C_FLAGS "-O1 -g -fno-eliminate-unused-debug-symbols -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_CXX_FLAGS "-O1 -g -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls") + set(VCPKG_C_FLAGS "-O1 -g -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls") endif() # Always apply sanitizer to linker flags diff --git a/triplets/x64-linux-asan.cmake b/triplets/x64-linux-asan.cmake index 58d4d326..a3f1a592 100644 --- a/triplets/x64-linux-asan.cmake +++ b/triplets/x64-linux-asan.cmake @@ -9,8 +9,8 @@ set(VCPKG_USE_SANITIZER "Address") # If the following flags cause errors during build, you might need to manually # ignore the PORT and check VCPKG_USE_SANITIZER if(NOT PORT MATCHES "^((upb))$") - set(VCPKG_CXX_FLAGS "-O1 -g -fno-eliminate-unused-debug-symbols -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") - set(VCPKG_C_FLAGS "-O1 -g -fno-eliminate-unused-debug-symbols -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_CXX_FLAGS "-O1 -g -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls") + set(VCPKG_C_FLAGS "-O1 -g -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls") endif() # Always apply sanitizer to linker flags diff --git a/triplets/x64-linux-rel-asan.cmake b/triplets/x64-linux-rel-asan.cmake index 3bd7204a..6c1c595c 100644 --- a/triplets/x64-linux-rel-asan.cmake +++ b/triplets/x64-linux-rel-asan.cmake @@ -9,8 +9,8 @@ set(VCPKG_USE_SANITIZER "Address") # If the following flags cause errors during build, you might need to manually # ignore the PORT and check VCPKG_USE_SANITIZER if(NOT PORT MATCHES "^((upb))$") - set(VCPKG_CXX_FLAGS "-fsanitize=address -g -fno-eliminate-unused-debug-symbols -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") - set(VCPKG_C_FLAGS "-fsanitize=address -g -fno-eliminate-unused-debug-symbols -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_CXX_FLAGS "-fsanitize=address -g -fno-omit-frame-pointer -fno-optimize-sibling-calls") + set(VCPKG_C_FLAGS "-fsanitize=address -g -fno-omit-frame-pointer -fno-optimize-sibling-calls") endif() # Always apply sanitizer to linker flags diff --git a/triplets/x64-osx-asan.cmake b/triplets/x64-osx-asan.cmake index bd4b45e1..7d6314c0 100644 --- a/triplets/x64-osx-asan.cmake +++ b/triplets/x64-osx-asan.cmake @@ -9,8 +9,8 @@ set(VCPKG_USE_SANITIZER "Address") # If the following flags cause errors during build, you might need to manually # ignore the PORT and check VCPKG_USE_SANITIZER if(NOT PORT MATCHES "^((upb))$") - set(VCPKG_CXX_FLAGS "-O1 -g -fno-eliminate-unused-debug-symbols -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") - set(VCPKG_C_FLAGS "-O1 -g -fno-eliminate-unused-debug-symbols -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_CXX_FLAGS "-O1 -g -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls") + set(VCPKG_C_FLAGS "-O1 -g -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls") set(VCPKG_LINKER_FLAGS "-fsanitize=address") endif() diff --git a/triplets/x64-osx-rel-asan.cmake b/triplets/x64-osx-rel-asan.cmake index 2a22c750..1117f946 100644 --- a/triplets/x64-osx-rel-asan.cmake +++ b/triplets/x64-osx-rel-asan.cmake @@ -10,8 +10,8 @@ set(VCPKG_USE_SANITIZER "Address") # If the following flags cause errors during build, you might need to manually # ignore the PORT and check VCPKG_USE_SANITIZER if(NOT PORT MATCHES "^((upb))$") - set(VCPKG_CXX_FLAGS "-fsanitize=address -g -fno-eliminate-unused-debug-symbols -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") - set(VCPKG_C_FLAGS "-fsanitize=address -g -fno-eliminate-unused-debug-symbols -fno-omit-frame-pointer -fno-optimize-sibling-calls -ffunction-sections -fdata-sections") + set(VCPKG_CXX_FLAGS "-fsanitize=address -g -fno-omit-frame-pointer -fno-optimize-sibling-calls") + set(VCPKG_C_FLAGS "-fsanitize=address -g -fno-omit-frame-pointer -fno-optimize-sibling-calls") endif() # Always apply sanitizer to linker flags