From 3380772277afcdabfa803f47fec4783103a8e199 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:19:26 +0200 Subject: [PATCH 01/38] [openfhe_julia_int128] Initialize --- O/openfhe_julia_int128/build_tarballs.jl | 94 ++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 O/openfhe_julia_int128/build_tarballs.jl diff --git a/O/openfhe_julia_int128/build_tarballs.jl b/O/openfhe_julia_int128/build_tarballs.jl new file mode 100644 index 00000000000..ee995aced45 --- /dev/null +++ b/O/openfhe_julia_int128/build_tarballs.jl @@ -0,0 +1,94 @@ +# Note that this script can accept some limited command-line arguments, run +# `julia build_tarballs.jl --help` to see a usage message. +using BinaryBuilder, Pkg + +# See https://github.com/JuliaLang/Pkg.jl/issues/2942 +# Once this Pkg issue is resolved, this must be removed +uuid = Base.UUID("a83860b7-747b-57cf-bf1f-3e79990d037f") +delete!(Pkg.Types.get_last_stdlibs(v"1.6.3"), uuid) + +name = "openfhe_julia_int128" +version = v"0.3.6" + +# Collection of sources required to complete build +sources = [ + GitSource("https://github.com/hpsc-lab/openfhe-julia.git", + "4939f1dd11ae2640b5bb397f731df8ef94307e74"), +] + +# Bash recipe for building across all platforms +script = raw""" +cd $WORKSPACE/srcdir/openfhe-julia/ + +if [[ "${target}" == *-mingw* ]]; then + # This is needed because otherwise we get unusable binaries (error "The specified + # executable is not a valid application for this OS platform"). These come from + # CompilerSupportLibraries_jll. + # xref: https://github.com/JuliaPackaging/Yggdrasil/issues/7904 + # + # The remove path pattern matches `lib/gcc///`, where `` is the + # platform triplet and `` is the GCC major version with which CSL was built + # xref: https://github.com/JuliaPackaging/Yggdrasil/pull/7535 + # + # However, before CSL v1.1, these files were located in just `lib/`, thus we clean this + # directory as well. + if test -n "$(find $prefix/lib/gcc/*mingw*/*/libgcc*)"; then + rm $prefix/lib/gcc/*mingw*/*/libgcc* $prefix/lib/gcc/*mingw*/*/libmsvcrt* + elif test -n "$(find $prefix/lib/libgcc*)"; then + rm $prefix/lib/libgcc* $prefix/lib/libmsvcrt* + else + echo "Could not find any libraries to remove :-/" + find $prefix/lib + fi +fi + +mkdir build && cd build + +cmake .. \ + -DCMAKE_INSTALL_PREFIX=$prefix \ + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ + -DCMAKE_BUILD_TYPE=Release \ + -DJulia_PREFIX=$prefix + +make -j${nproc} +make install +""" + +# These are the platforms we will build for by default, unless further +# platforms are passed in on the command line +include("../../L/libjulia/common.jl") +platforms = vcat(libjulia_platforms.(julia_versions)...) + +# We cannot build with musl since OpenFHE requires the `execinfo.h` header for `backtrace` +platforms = filter(p -> libc(p) != "musl", platforms) + +# PowerPC and 32-bit x86 and 64-bit FreeBSD on ARM 64 platforms are not supported by OpenFHE +platforms = filter(p -> arch(p) != "i686", platforms) +platforms = filter(p -> arch(p) != "powerpc64le", platforms) +platforms = filter(p -> !(Sys.isfreebsd(p) && arch(p) == "aarch64"), platforms) + +# Expand C++ string ABIs since we use std::string +platforms = expand_cxxstring_abis(platforms) + + +# The products that we will ensure are always built +products = [ + LibraryProduct("libopenfhe_julia", :libopenfhe_julia), +] + +# Dependencies that must be installed before this package can be built +dependencies = [ + BuildDependency(PackageSpec(;name="libjulia_jll", version=v"1.10.9")), + Dependency(PackageSpec(name="libcxxwrap_julia_jll", uuid="3eaa8342-bff7-56a5-9981-c04077f7cee7"); compat="0.13.0"), + Dependency(PackageSpec(name="OpenFHE_int128_jll", uuid="a89a0bdd-1663-5679-8b21-c3a5388322bc"); compat="1.2.3"), + # For OpenMP we use libomp from `LLVMOpenMP_jll` where we use LLVM as compiler (BSD + # systems), and libgomp from `CompilerSupportLibraries_jll` everywhere else. + Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae"); + platforms=filter(!Sys.isbsd, platforms)), + Dependency(PackageSpec(name="LLVMOpenMP_jll", uuid="1d63c593-3942-5779-bab2-d838dc0a180e"); + platforms=filter(Sys.isbsd, platforms)), +] + +# Build the tarballs, and possibly a `build.jl` as well. +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; + julia_compat="1.6", preferred_gcc_version = v"9") From 39b1c3ee92c2bd095712d5d60fe75b0c0067327c Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:45:46 +0200 Subject: [PATCH 02/38] introduce common.jl --- O/openfhe_julia/README.md | 11 +++ O/openfhe_julia/build_tarballs.jl | 88 ++-------------------- O/openfhe_julia/common.jl | 94 ++++++++++++++++++++++++ O/openfhe_julia_int128/README.md | 11 +++ O/openfhe_julia_int128/build_tarballs.jl | 88 ++-------------------- 5 files changed, 128 insertions(+), 164 deletions(-) create mode 100644 O/openfhe_julia/README.md create mode 100644 O/openfhe_julia/common.jl create mode 100644 O/openfhe_julia_int128/README.md diff --git a/O/openfhe_julia/README.md b/O/openfhe_julia/README.md new file mode 100644 index 00000000000..d477872b0f7 --- /dev/null +++ b/O/openfhe_julia/README.md @@ -0,0 +1,11 @@ +The OpenFHE library works with both 64-bit and 128-bit integers. + +This package builds upon the default 64-bit version. + +To use the 128-bit version, use +[openfhe_julia_int128](https://github.com/JuliaPackaging/Yggdrasil/tree/master/O/openfhe_julia_int128). + +Most of the build steps for openfhe_julia and +[openfhe_julia_int128](https://github.com/JuliaPackaging/Yggdrasil/tree/master/O/openfhe_julia_int128) are the same, +so the shared parts are in the +[common.jl](https://github.com/JuliaPackaging/Yggdrasil/blob/master/O/openfhe_julia/common.jl) script. \ No newline at end of file diff --git a/O/openfhe_julia/build_tarballs.jl b/O/openfhe_julia/build_tarballs.jl index cdb504c833a..a37247fdc74 100644 --- a/O/openfhe_julia/build_tarballs.jl +++ b/O/openfhe_julia/build_tarballs.jl @@ -1,93 +1,17 @@ # Note that this script can accept some limited command-line arguments, run # `julia build_tarballs.jl --help` to see a usage message. -using BinaryBuilder, Pkg - -# See https://github.com/JuliaLang/Pkg.jl/issues/2942 -# Once this Pkg issue is resolved, this must be removed -uuid = Base.UUID("a83860b7-747b-57cf-bf1f-3e79990d037f") -delete!(Pkg.Types.get_last_stdlibs(v"1.6.3"), uuid) +include("common.jl") +# If you make changes in this file, e.g., to release a new version, +# be sure to also release a new version of `openfhe_julia_int128` as well (see `../openfhe_julia_int128/build_tarballs.jl`) name = "openfhe_julia" version = v"0.3.6" -# Collection of sources required to complete build -sources = [ - GitSource("https://github.com/hpsc-lab/openfhe-julia.git", - "4939f1dd11ae2640b5bb397f731df8ef94307e74"), -] - -# Bash recipe for building across all platforms -script = raw""" -cd $WORKSPACE/srcdir/openfhe-julia/ - -if [[ "${target}" == *-mingw* ]]; then - # This is needed because otherwise we get unusable binaries (error "The specified - # executable is not a valid application for this OS platform"). These come from - # CompilerSupportLibraries_jll. - # xref: https://github.com/JuliaPackaging/Yggdrasil/issues/7904 - # - # The remove path pattern matches `lib/gcc///`, where `` is the - # platform triplet and `` is the GCC major version with which CSL was built - # xref: https://github.com/JuliaPackaging/Yggdrasil/pull/7535 - # - # However, before CSL v1.1, these files were located in just `lib/`, thus we clean this - # directory as well. - if test -n "$(find $prefix/lib/gcc/*mingw*/*/libgcc*)"; then - rm $prefix/lib/gcc/*mingw*/*/libgcc* $prefix/lib/gcc/*mingw*/*/libmsvcrt* - elif test -n "$(find $prefix/lib/libgcc*)"; then - rm $prefix/lib/libgcc* $prefix/lib/libmsvcrt* - else - echo "Could not find any libraries to remove :-/" - find $prefix/lib - fi -fi - -mkdir build && cd build - -cmake .. \ - -DCMAKE_INSTALL_PREFIX=$prefix \ - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ - -DCMAKE_BUILD_TYPE=Release \ - -DJulia_PREFIX=$prefix - -make -j${nproc} -make install -""" - -# These are the platforms we will build for by default, unless further -# platforms are passed in on the command line -include("../../L/libjulia/common.jl") -platforms = vcat(libjulia_platforms.(julia_versions)...) - -# We cannot build with musl since OpenFHE requires the `execinfo.h` header for `backtrace` -platforms = filter(p -> libc(p) != "musl", platforms) - -# PowerPC and 32-bit x86 and 64-bit FreeBSD on ARM 64 platforms are not supported by OpenFHE -platforms = filter(p -> arch(p) != "i686", platforms) -platforms = filter(p -> arch(p) != "powerpc64le", platforms) -platforms = filter(p -> !(Sys.isfreebsd(p) && arch(p) == "aarch64"), platforms) - -# Expand C++ string ABIs since we use std::string -platforms = expand_cxxstring_abis(platforms) - +git_hash = "4939f1dd11ae2640b5bb397f731df8ef94307e74" -# The products that we will ensure are always built -products = [ - LibraryProduct("libopenfhe_julia", :libopenfhe_julia), -] +sources, script, platforms, products, dependencies = prepare_openfhe_julia_build(name, git_hash) -# Dependencies that must be installed before this package can be built -dependencies = [ - BuildDependency(PackageSpec(;name="libjulia_jll", version=v"1.10.9")), - Dependency(PackageSpec(name="libcxxwrap_julia_jll", uuid="3eaa8342-bff7-56a5-9981-c04077f7cee7"); compat="0.13.0"), - Dependency(PackageSpec(name="OpenFHE_jll", uuid="a2687184-f17b-54bc-b2bb-b849352af807"); compat="1.2.3"), - # For OpenMP we use libomp from `LLVMOpenMP_jll` where we use LLVM as compiler (BSD - # systems), and libgomp from `CompilerSupportLibraries_jll` everywhere else. - Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae"); - platforms=filter(!Sys.isbsd, platforms)), - Dependency(PackageSpec(name="LLVMOpenMP_jll", uuid="1d63c593-3942-5779-bab2-d838dc0a180e"); - platforms=filter(Sys.isbsd, platforms)), -] +push!(dependencies, Dependency(PackageSpec(name="OpenFHE_jll", uuid="a2687184-f17b-54bc-b2bb-b849352af807"); compat="1.2.3")) # Build the tarballs, and possibly a `build.jl` as well. build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl new file mode 100644 index 00000000000..c8d458b88ba --- /dev/null +++ b/O/openfhe_julia/common.jl @@ -0,0 +1,94 @@ +using BinaryBuilder, Pkg + +function prepare_openfhe_julia_build(name::String, git_hash::String) + # See https://github.com/JuliaLang/Pkg.jl/issues/2942 + # Once this Pkg issue is resolved, this must be removed + uuid = Base.UUID("a83860b7-747b-57cf-bf1f-3e79990d037f") + delete!(Pkg.Types.get_last_stdlibs(v"1.6.3"), uuid) + + # Collection of sources required to complete build + sources = [ + GitSource("https://github.com/hpsc-lab/openfhe-julia.git", + git_hash), + ] + + # Bash recipe for building across all platforms + script = raw""" + cd $WORKSPACE/srcdir/openfhe-julia/ + + if [[ "${target}" == *-mingw* ]]; then + # This is needed because otherwise we get unusable binaries (error "The specified + # executable is not a valid application for this OS platform"). These come from + # CompilerSupportLibraries_jll. + # xref: https://github.com/JuliaPackaging/Yggdrasil/issues/7904 + # + # The remove path pattern matches `lib/gcc///`, where `` is the + # platform triplet and `` is the GCC major version with which CSL was built + # xref: https://github.com/JuliaPackaging/Yggdrasil/pull/7535 + # + # However, before CSL v1.1, these files were located in just `lib/`, thus we clean this + # directory as well. + if test -n "$(find $prefix/lib/gcc/*mingw*/*/libgcc*)"; then + rm $prefix/lib/gcc/*mingw*/*/libgcc* $prefix/lib/gcc/*mingw*/*/libmsvcrt* + elif test -n "$(find $prefix/lib/libgcc*)"; then + rm $prefix/lib/libgcc* $prefix/lib/libmsvcrt* + else + echo "Could not find any libraries to remove :-/" + find $prefix/lib + fi + fi + + mkdir build && cd build + + cmake .. \ + -DCMAKE_INSTALL_PREFIX=$prefix \ + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ + -DCMAKE_BUILD_TYPE=Release \ + -DJulia_PREFIX=$prefix + + make -j${nproc} + make install + """ + + # These are the platforms we will build for by default, unless further + # platforms are passed in on the command line + include("../../L/libjulia/common.jl") + platforms = vcat(libjulia_platforms.(julia_versions)...) + + # We cannot build with musl since OpenFHE requires the `execinfo.h` header for `backtrace` + platforms = filter(p -> libc(p) != "musl", platforms) + + # PowerPC and 32-bit x86 and 64-bit FreeBSD on ARM 64 platforms are not supported by OpenFHE + platforms = filter(p -> arch(p) != "i686", platforms) + platforms = filter(p -> arch(p) != "powerpc64le", platforms) + platforms = filter(p -> !(Sys.isfreebsd(p) && arch(p) == "aarch64"), platforms) + + # armv6l and armv7l do not support 128 bit int size + if name == "openfhe_julia_int128" + platforms = filter(p -> arch(p) != "armv6l", platforms) + platforms = filter(p -> arch(p) != "armv7l", platforms) + end + + # Expand C++ string ABIs since we use std::string + platforms = expand_cxxstring_abis(platforms) + + + # The products that we will ensure are always built + products = [ + LibraryProduct("libopenfhe_julia", :libopenfhe_julia), + ] + + # Dependencies that must be installed before this package can be built + dependencies = [ + BuildDependency(PackageSpec(;name="libjulia_jll", version=v"1.10.9")), + Dependency(PackageSpec(name="libcxxwrap_julia_jll", uuid="3eaa8342-bff7-56a5-9981-c04077f7cee7"); compat="0.13.0"), + # For OpenMP we use libomp from `LLVMOpenMP_jll` where we use LLVM as compiler (BSD + # systems), and libgomp from `CompilerSupportLibraries_jll` everywhere else. + Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae"); + platforms=filter(!Sys.isbsd, platforms)), + Dependency(PackageSpec(name="LLVMOpenMP_jll", uuid="1d63c593-3942-5779-bab2-d838dc0a180e"); + platforms=filter(Sys.isbsd, platforms)), + ] + + return sources, script, platforms, products, dependencies +end \ No newline at end of file diff --git a/O/openfhe_julia_int128/README.md b/O/openfhe_julia_int128/README.md new file mode 100644 index 00000000000..b4683bf3b62 --- /dev/null +++ b/O/openfhe_julia_int128/README.md @@ -0,0 +1,11 @@ +The OpenFHE library works with both 64-bit and 128-bit integers. + +This package builds upon the 128-bit version. + +To use the 64-bit version, use +[openfhe_julia](https://github.com/JuliaPackaging/Yggdrasil/tree/master/O/openfhe_julia). + +Most of the build steps for openfhe_julia_int128 and +[openfhe_julia](https://github.com/JuliaPackaging/Yggdrasil/tree/master/O/openfhe_julia) are the same, +so the shared parts are in the +[common.jl](https://github.com/JuliaPackaging/Yggdrasil/blob/master/O/openfhe_julia/common.jl) script. \ No newline at end of file diff --git a/O/openfhe_julia_int128/build_tarballs.jl b/O/openfhe_julia_int128/build_tarballs.jl index ee995aced45..6741c2e9066 100644 --- a/O/openfhe_julia_int128/build_tarballs.jl +++ b/O/openfhe_julia_int128/build_tarballs.jl @@ -1,93 +1,17 @@ # Note that this script can accept some limited command-line arguments, run # `julia build_tarballs.jl --help` to see a usage message. -using BinaryBuilder, Pkg - -# See https://github.com/JuliaLang/Pkg.jl/issues/2942 -# Once this Pkg issue is resolved, this must be removed -uuid = Base.UUID("a83860b7-747b-57cf-bf1f-3e79990d037f") -delete!(Pkg.Types.get_last_stdlibs(v"1.6.3"), uuid) +include(joinpath(pwd(), "..", "openfhe_julia", "common.jl")) +# If you make changes in this file, e.g., to release a new version, +# be sure to also release a new version of `openfhe_julia` as well (see `../openfhe_julia/build_tarballs.jl`) name = "openfhe_julia_int128" version = v"0.3.6" -# Collection of sources required to complete build -sources = [ - GitSource("https://github.com/hpsc-lab/openfhe-julia.git", - "4939f1dd11ae2640b5bb397f731df8ef94307e74"), -] - -# Bash recipe for building across all platforms -script = raw""" -cd $WORKSPACE/srcdir/openfhe-julia/ - -if [[ "${target}" == *-mingw* ]]; then - # This is needed because otherwise we get unusable binaries (error "The specified - # executable is not a valid application for this OS platform"). These come from - # CompilerSupportLibraries_jll. - # xref: https://github.com/JuliaPackaging/Yggdrasil/issues/7904 - # - # The remove path pattern matches `lib/gcc///`, where `` is the - # platform triplet and `` is the GCC major version with which CSL was built - # xref: https://github.com/JuliaPackaging/Yggdrasil/pull/7535 - # - # However, before CSL v1.1, these files were located in just `lib/`, thus we clean this - # directory as well. - if test -n "$(find $prefix/lib/gcc/*mingw*/*/libgcc*)"; then - rm $prefix/lib/gcc/*mingw*/*/libgcc* $prefix/lib/gcc/*mingw*/*/libmsvcrt* - elif test -n "$(find $prefix/lib/libgcc*)"; then - rm $prefix/lib/libgcc* $prefix/lib/libmsvcrt* - else - echo "Could not find any libraries to remove :-/" - find $prefix/lib - fi -fi - -mkdir build && cd build - -cmake .. \ - -DCMAKE_INSTALL_PREFIX=$prefix \ - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ - -DCMAKE_BUILD_TYPE=Release \ - -DJulia_PREFIX=$prefix - -make -j${nproc} -make install -""" - -# These are the platforms we will build for by default, unless further -# platforms are passed in on the command line -include("../../L/libjulia/common.jl") -platforms = vcat(libjulia_platforms.(julia_versions)...) - -# We cannot build with musl since OpenFHE requires the `execinfo.h` header for `backtrace` -platforms = filter(p -> libc(p) != "musl", platforms) - -# PowerPC and 32-bit x86 and 64-bit FreeBSD on ARM 64 platforms are not supported by OpenFHE -platforms = filter(p -> arch(p) != "i686", platforms) -platforms = filter(p -> arch(p) != "powerpc64le", platforms) -platforms = filter(p -> !(Sys.isfreebsd(p) && arch(p) == "aarch64"), platforms) - -# Expand C++ string ABIs since we use std::string -platforms = expand_cxxstring_abis(platforms) - +git_hash = "4939f1dd11ae2640b5bb397f731df8ef94307e74" -# The products that we will ensure are always built -products = [ - LibraryProduct("libopenfhe_julia", :libopenfhe_julia), -] +sources, script, platforms, products, dependencies = prepare_openfhe_julia_build(name, git_hash) -# Dependencies that must be installed before this package can be built -dependencies = [ - BuildDependency(PackageSpec(;name="libjulia_jll", version=v"1.10.9")), - Dependency(PackageSpec(name="libcxxwrap_julia_jll", uuid="3eaa8342-bff7-56a5-9981-c04077f7cee7"); compat="0.13.0"), - Dependency(PackageSpec(name="OpenFHE_int128_jll", uuid="a89a0bdd-1663-5679-8b21-c3a5388322bc"); compat="1.2.3"), - # For OpenMP we use libomp from `LLVMOpenMP_jll` where we use LLVM as compiler (BSD - # systems), and libgomp from `CompilerSupportLibraries_jll` everywhere else. - Dependency(PackageSpec(name="CompilerSupportLibraries_jll", uuid="e66e0078-7015-5450-92f7-15fbd957f2ae"); - platforms=filter(!Sys.isbsd, platforms)), - Dependency(PackageSpec(name="LLVMOpenMP_jll", uuid="1d63c593-3942-5779-bab2-d838dc0a180e"); - platforms=filter(Sys.isbsd, platforms)), -] +push!(dependencies, Dependency(PackageSpec(name="OpenFHE_int128_jll", uuid="a89a0bdd-1663-5679-8b21-c3a5388322bc"); compat="1.2.3")) # Build the tarballs, and possibly a `build.jl` as well. build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; From 04dbeadf87a69d43ffd9a9d814c786550fc966f4 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 9 Dec 2024 17:53:06 +0200 Subject: [PATCH 03/38] Update common.jl --- O/openfhe_julia/common.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index c8d458b88ba..d6c182eea77 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -1,5 +1,7 @@ using BinaryBuilder, Pkg +include("../../L/libjulia/common.jl") + function prepare_openfhe_julia_build(name::String, git_hash::String) # See https://github.com/JuliaLang/Pkg.jl/issues/2942 # Once this Pkg issue is resolved, this must be removed @@ -52,7 +54,6 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) # These are the platforms we will build for by default, unless further # platforms are passed in on the command line - include("../../L/libjulia/common.jl") platforms = vcat(libjulia_platforms.(julia_versions)...) # We cannot build with musl since OpenFHE requires the `execinfo.h` header for `backtrace` From 057a282f551b78b0cb85c37b1d869ab0daa00156 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:38:08 +0200 Subject: [PATCH 04/38] Update common.jl --- O/openfhe_julia/common.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index d6c182eea77..7df0a02dc95 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -46,7 +46,9 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) -DCMAKE_INSTALL_PREFIX=$prefix \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ - -DJulia_PREFIX=$prefix + -DJulia_PREFIX=$prefix \ + -D__GLIBCXX_TYPE_INT_N_0=__int128 \ + -D__GLIBCXX_BITSIZE_INT_N_0=128 make -j${nproc} make install From 4d91a16d47134b793a22a788c83939ac186f2572 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 10 Dec 2024 09:39:12 +0200 Subject: [PATCH 05/38] disable apple --- O/openfhe_julia/common.jl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 7df0a02dc95..5a4790df492 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -46,9 +46,7 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) -DCMAKE_INSTALL_PREFIX=$prefix \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ - -DJulia_PREFIX=$prefix \ - -D__GLIBCXX_TYPE_INT_N_0=__int128 \ - -D__GLIBCXX_BITSIZE_INT_N_0=128 + -DJulia_PREFIX=$prefix make -j${nproc} make install @@ -66,10 +64,13 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) platforms = filter(p -> arch(p) != "powerpc64le", platforms) platforms = filter(p -> !(Sys.isfreebsd(p) && arch(p) == "aarch64"), platforms) - # armv6l and armv7l do not support 128 bit int size if name == "openfhe_julia_int128" + # armv6l and armv7l do not support 128 bit int size platforms = filter(p -> arch(p) != "armv6l", platforms) platforms = filter(p -> arch(p) != "armv7l", platforms) + # apple does not support typeid(__int128) + platforms = filter(p -> !(Sys.isapple(p)), platforms) + end # Expand C++ string ABIs since we use std::string From 91c1ffd00cac3999fefe23fe76061079a377ae9b Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:01:51 +0200 Subject: [PATCH 06/38] enable apple --- O/openfhe_julia/common.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 5a4790df492..278fb40c904 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -69,7 +69,7 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) platforms = filter(p -> arch(p) != "armv6l", platforms) platforms = filter(p -> arch(p) != "armv7l", platforms) # apple does not support typeid(__int128) - platforms = filter(p -> !(Sys.isapple(p)), platforms) + # platforms = filter(p -> !(Sys.isapple(p)), platforms) end From a604c583d7b8fb8a053fd6ec970cdfe933c3cff0 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:27:44 +0200 Subject: [PATCH 07/38] tru later gcc --- O/openfhe_julia/build_tarballs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/O/openfhe_julia/build_tarballs.jl b/O/openfhe_julia/build_tarballs.jl index a37247fdc74..1a851e3aece 100644 --- a/O/openfhe_julia/build_tarballs.jl +++ b/O/openfhe_julia/build_tarballs.jl @@ -15,4 +15,4 @@ push!(dependencies, Dependency(PackageSpec(name="OpenFHE_jll", uuid="a2687184-f1 # Build the tarballs, and possibly a `build.jl` as well. build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; - julia_compat="1.6", preferred_gcc_version = v"9") + julia_compat="1.6", preferred_gcc_version = v"10.2.0") From 3b14d1224476af4d1fa26fbe3d7d4bc32527533f Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 10 Dec 2024 19:22:18 +0200 Subject: [PATCH 08/38] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mosè Giordano <765740+giordano@users.noreply.github.com> --- O/openfhe_julia/common.jl | 2 +- O/openfhe_julia_int128/build_tarballs.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 278fb40c904..0657bbb42c4 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -95,4 +95,4 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) ] return sources, script, platforms, products, dependencies -end \ No newline at end of file +end diff --git a/O/openfhe_julia_int128/build_tarballs.jl b/O/openfhe_julia_int128/build_tarballs.jl index 6741c2e9066..67d09d0dd1b 100644 --- a/O/openfhe_julia_int128/build_tarballs.jl +++ b/O/openfhe_julia_int128/build_tarballs.jl @@ -1,6 +1,6 @@ # Note that this script can accept some limited command-line arguments, run # `julia build_tarballs.jl --help` to see a usage message. -include(joinpath(pwd(), "..", "openfhe_julia", "common.jl")) +include(joinpath(@__DIR__, "..", "openfhe_julia", "common.jl")) # If you make changes in this file, e.g., to release a new version, # be sure to also release a new version of `openfhe_julia` as well (see `../openfhe_julia/build_tarballs.jl`) From da24c49a71c67c8012ef8dbde9f72471f34d5d47 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:28:08 +0200 Subject: [PATCH 09/38] Update build_tarballs.jl --- O/openfhe_julia_int128/build_tarballs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/O/openfhe_julia_int128/build_tarballs.jl b/O/openfhe_julia_int128/build_tarballs.jl index 67d09d0dd1b..41ef5f143b8 100644 --- a/O/openfhe_julia_int128/build_tarballs.jl +++ b/O/openfhe_julia_int128/build_tarballs.jl @@ -15,4 +15,4 @@ push!(dependencies, Dependency(PackageSpec(name="OpenFHE_int128_jll", uuid="a89a # Build the tarballs, and possibly a `build.jl` as well. build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; - julia_compat="1.6", preferred_gcc_version = v"9") + julia_compat="1.6", preferred_gcc_version = v"10.2.0") From a38a300507da60c2b8d3531e6c745a09abdb76c9 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 10 Dec 2024 19:17:57 +0200 Subject: [PATCH 10/38] use gcc in macos --- O/openfhe_julia/build_tarballs.jl | 2 +- O/openfhe_julia/common.jl | 3 ++- O/openfhe_julia_int128/build_tarballs.jl | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/O/openfhe_julia/build_tarballs.jl b/O/openfhe_julia/build_tarballs.jl index 1a851e3aece..a37247fdc74 100644 --- a/O/openfhe_julia/build_tarballs.jl +++ b/O/openfhe_julia/build_tarballs.jl @@ -15,4 +15,4 @@ push!(dependencies, Dependency(PackageSpec(name="OpenFHE_jll", uuid="a2687184-f1 # Build the tarballs, and possibly a `build.jl` as well. build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; - julia_compat="1.6", preferred_gcc_version = v"10.2.0") + julia_compat="1.6", preferred_gcc_version = v"9") diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 0657bbb42c4..465bc6e1ad7 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -46,7 +46,8 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) -DCMAKE_INSTALL_PREFIX=$prefix \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ - -DJulia_PREFIX=$prefix + -DJulia_PREFIX=$prefix \ + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN%.*}_gcc.cmake make -j${nproc} make install diff --git a/O/openfhe_julia_int128/build_tarballs.jl b/O/openfhe_julia_int128/build_tarballs.jl index 41ef5f143b8..67d09d0dd1b 100644 --- a/O/openfhe_julia_int128/build_tarballs.jl +++ b/O/openfhe_julia_int128/build_tarballs.jl @@ -15,4 +15,4 @@ push!(dependencies, Dependency(PackageSpec(name="OpenFHE_int128_jll", uuid="a89a # Build the tarballs, and possibly a `build.jl` as well. build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; - julia_compat="1.6", preferred_gcc_version = v"10.2.0") + julia_compat="1.6", preferred_gcc_version = v"9") From 3877a16c27f1d019c7076d8e49a02a1d8795b2ae Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 10 Dec 2024 19:44:38 +0200 Subject: [PATCH 11/38] Set gcc and g++ compilers for apple and freebsd --- O/openfhe_julia/common.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 465bc6e1ad7..70ae6e1f2f0 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -40,6 +40,12 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) fi fi + # Set gcc and g++ compilers for apple and freebsd + if [[ "${target}" == *-freebsd* ]] || [[ "${target}" == *-apple-* ]]; then + CC=gcc + CXX=g++ + fi + mkdir build && cd build cmake .. \ From b62a12b2303789fa185882aec92d61eb7ab5ddbe Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 10 Dec 2024 20:25:47 +0200 Subject: [PATCH 12/38] filter 32 bit systems --- O/openfhe_julia/common.jl | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 70ae6e1f2f0..d951eace34f 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -40,20 +40,13 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) fi fi - # Set gcc and g++ compilers for apple and freebsd - if [[ "${target}" == *-freebsd* ]] || [[ "${target}" == *-apple-* ]]; then - CC=gcc - CXX=g++ - fi - mkdir build && cd build cmake .. \ -DCMAKE_INSTALL_PREFIX=$prefix \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ - -DJulia_PREFIX=$prefix \ - -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN%.*}_gcc.cmake + -DJulia_PREFIX=$prefix make -j${nproc} make install @@ -72,6 +65,8 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) platforms = filter(p -> !(Sys.isfreebsd(p) && arch(p) == "aarch64"), platforms) if name == "openfhe_julia_int128" + # 32 bit systems does not support __int128 + platforms = filter(p -> nbits(p) != 32, platforms) # armv6l and armv7l do not support 128 bit int size platforms = filter(p -> arch(p) != "armv6l", platforms) platforms = filter(p -> arch(p) != "armv7l", platforms) From 3ced4954698db040c673ed596a5aa04498dd2204 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 10 Dec 2024 20:45:00 +0200 Subject: [PATCH 13/38] set new compiler flag --- O/openfhe_julia/common.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index d951eace34f..e23d10acc8d 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -46,7 +46,8 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) -DCMAKE_INSTALL_PREFIX=$prefix \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ - -DJulia_PREFIX=$prefix + -DJulia_PREFIX=$prefix \ + -DCMAKE_CXX_FLAGS="-std=gnu++17" make -j${nproc} make install From 63dbfbdb46d4c04337860e223d5958fb8e495289 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 10 Dec 2024 22:42:44 +0200 Subject: [PATCH 14/38] try to built from pr with GNU_SOURCE --- O/openfhe_julia/build_tarballs.jl | 2 +- O/openfhe_julia/common.jl | 3 +-- O/openfhe_julia_int128/build_tarballs.jl | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/O/openfhe_julia/build_tarballs.jl b/O/openfhe_julia/build_tarballs.jl index a37247fdc74..89224349247 100644 --- a/O/openfhe_julia/build_tarballs.jl +++ b/O/openfhe_julia/build_tarballs.jl @@ -7,7 +7,7 @@ include("common.jl") name = "openfhe_julia" version = v"0.3.6" -git_hash = "4939f1dd11ae2640b5bb397f731df8ef94307e74" +git_hash = "8eafc05cf7bd2f3efbc8684ee4cdeefa5dcdcddf" sources, script, platforms, products, dependencies = prepare_openfhe_julia_build(name, git_hash) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index e23d10acc8d..d951eace34f 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -46,8 +46,7 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) -DCMAKE_INSTALL_PREFIX=$prefix \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ - -DJulia_PREFIX=$prefix \ - -DCMAKE_CXX_FLAGS="-std=gnu++17" + -DJulia_PREFIX=$prefix make -j${nproc} make install diff --git a/O/openfhe_julia_int128/build_tarballs.jl b/O/openfhe_julia_int128/build_tarballs.jl index 67d09d0dd1b..1475a2bbd05 100644 --- a/O/openfhe_julia_int128/build_tarballs.jl +++ b/O/openfhe_julia_int128/build_tarballs.jl @@ -7,7 +7,7 @@ include(joinpath(@__DIR__, "..", "openfhe_julia", "common.jl")) name = "openfhe_julia_int128" version = v"0.3.6" -git_hash = "4939f1dd11ae2640b5bb397f731df8ef94307e74" +git_hash = "8eafc05cf7bd2f3efbc8684ee4cdeefa5dcdcddf" sources, script, platforms, products, dependencies = prepare_openfhe_julia_build(name, git_hash) From 4bce691d01dce1de1df3e17cf3e1caf4de483122 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 10 Dec 2024 22:56:22 +0200 Subject: [PATCH 15/38] add gnu source as command line option --- O/openfhe_julia/build_tarballs.jl | 2 +- O/openfhe_julia/common.jl | 3 ++- O/openfhe_julia_int128/build_tarballs.jl | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/O/openfhe_julia/build_tarballs.jl b/O/openfhe_julia/build_tarballs.jl index 89224349247..a37247fdc74 100644 --- a/O/openfhe_julia/build_tarballs.jl +++ b/O/openfhe_julia/build_tarballs.jl @@ -7,7 +7,7 @@ include("common.jl") name = "openfhe_julia" version = v"0.3.6" -git_hash = "8eafc05cf7bd2f3efbc8684ee4cdeefa5dcdcddf" +git_hash = "4939f1dd11ae2640b5bb397f731df8ef94307e74" sources, script, platforms, products, dependencies = prepare_openfhe_julia_build(name, git_hash) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index d951eace34f..c23113601d0 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -46,7 +46,8 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) -DCMAKE_INSTALL_PREFIX=$prefix \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ - -DJulia_PREFIX=$prefix + -DJulia_PREFIX=$prefix \ + -D_GNU_SOURCE make -j${nproc} make install diff --git a/O/openfhe_julia_int128/build_tarballs.jl b/O/openfhe_julia_int128/build_tarballs.jl index 1475a2bbd05..67d09d0dd1b 100644 --- a/O/openfhe_julia_int128/build_tarballs.jl +++ b/O/openfhe_julia_int128/build_tarballs.jl @@ -7,7 +7,7 @@ include(joinpath(@__DIR__, "..", "openfhe_julia", "common.jl")) name = "openfhe_julia_int128" version = v"0.3.6" -git_hash = "8eafc05cf7bd2f3efbc8684ee4cdeefa5dcdcddf" +git_hash = "4939f1dd11ae2640b5bb397f731df8ef94307e74" sources, script, platforms, products, dependencies = prepare_openfhe_julia_build(name, git_hash) From 76d8bbf858f51573aeacc80ba7bfee10a7be2330 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 10 Dec 2024 23:54:56 +0200 Subject: [PATCH 16/38] new try --- O/openfhe_julia/common.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index c23113601d0..da32079a326 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -47,7 +47,7 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ -DJulia_PREFIX=$prefix \ - -D_GNU_SOURCE + -DCMAKE_CXX_FLAGS="-D_GNU_SOURCE" make -j${nproc} make install From 1c2f462e2198970fb2b4ffa2d586f9bed9b7dc0e Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Wed, 11 Dec 2024 12:11:57 +0200 Subject: [PATCH 17/38] try sdk 14 --- O/openfhe_julia/common.jl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index da32079a326..d2da67e506b 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -12,6 +12,8 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) sources = [ GitSource("https://github.com/hpsc-lab/openfhe-julia.git", git_hash), + ArchiveSource("https://github.com/roblabla/MacOSX-SDKs/releases/download/macosx14.0/MacOSX14.0.sdk.tar.xz", + "4a31565fd2644d1aec23da3829977f83632a20985561a2038e198681e7e7bf49") ] # Bash recipe for building across all platforms @@ -40,14 +42,19 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) fi fi + if [[ "$target" == *-apple-darwin* ]]; then + apple_sdk_root=$WORKSPACE/srcdir/MacOSX14.0.sdk + sed -i "s!/opt/$bb_target/$bb_target/sys-root!$apple_sdk_root!" $CMAKE_TARGET_TOOLCHAIN + sed -i "s!/opt/$bb_target/$bb_target/sys-root!$apple_sdk_root!" /opt/bin/$bb_full_target/$target-clang++ + fi + mkdir build && cd build cmake .. \ -DCMAKE_INSTALL_PREFIX=$prefix \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ - -DJulia_PREFIX=$prefix \ - -DCMAKE_CXX_FLAGS="-D_GNU_SOURCE" + -DJulia_PREFIX=$prefix make -j${nproc} make install From fb52087547bef83155e8b1c3173b56b2589b1a6b Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Thu, 12 Dec 2024 08:34:21 +0200 Subject: [PATCH 18/38] disable apple --- O/openfhe_julia/common.jl | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index d2da67e506b..7ca157f3588 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -12,8 +12,6 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) sources = [ GitSource("https://github.com/hpsc-lab/openfhe-julia.git", git_hash), - ArchiveSource("https://github.com/roblabla/MacOSX-SDKs/releases/download/macosx14.0/MacOSX14.0.sdk.tar.xz", - "4a31565fd2644d1aec23da3829977f83632a20985561a2038e198681e7e7bf49") ] # Bash recipe for building across all platforms @@ -42,12 +40,6 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) fi fi - if [[ "$target" == *-apple-darwin* ]]; then - apple_sdk_root=$WORKSPACE/srcdir/MacOSX14.0.sdk - sed -i "s!/opt/$bb_target/$bb_target/sys-root!$apple_sdk_root!" $CMAKE_TARGET_TOOLCHAIN - sed -i "s!/opt/$bb_target/$bb_target/sys-root!$apple_sdk_root!" /opt/bin/$bb_full_target/$target-clang++ - fi - mkdir build && cd build cmake .. \ @@ -78,8 +70,9 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) # armv6l and armv7l do not support 128 bit int size platforms = filter(p -> arch(p) != "armv6l", platforms) platforms = filter(p -> arch(p) != "armv7l", platforms) - # apple does not support typeid(__int128) - # platforms = filter(p -> !(Sys.isapple(p)), platforms) + # apple does not support typeid(__int128), remove when + # https://github.com/llvm/llvm-project/issues/119608 resolved + platforms = filter(p -> !(Sys.isapple(p)), platforms) end From 61a869aaaef8c3508a404935b70f2c5b65ad1852 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Thu, 12 Dec 2024 08:39:29 +0200 Subject: [PATCH 19/38] remove new line --- O/openfhe_julia/common.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 7ca157f3588..c3c23957884 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -73,7 +73,6 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) # apple does not support typeid(__int128), remove when # https://github.com/llvm/llvm-project/issues/119608 resolved platforms = filter(p -> !(Sys.isapple(p)), platforms) - end # Expand C++ string ABIs since we use std::string From 7de451814e13c361f68e1c878c1282831fceca4f Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:37:33 +0200 Subject: [PATCH 20/38] add lc++abi flag --- O/openfhe_julia/common.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index c3c23957884..3d02950fca9 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -46,7 +46,8 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) -DCMAKE_INSTALL_PREFIX=$prefix \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ - -DJulia_PREFIX=$prefix + -DJulia_PREFIX=$prefix \ + -DCMAKE_CXX_FLAGS="-lc++abi" make -j${nproc} make install @@ -72,7 +73,7 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) platforms = filter(p -> arch(p) != "armv7l", platforms) # apple does not support typeid(__int128), remove when # https://github.com/llvm/llvm-project/issues/119608 resolved - platforms = filter(p -> !(Sys.isapple(p)), platforms) + # platforms = filter(p -> !(Sys.isapple(p)), platforms) end # Expand C++ string ABIs since we use std::string From 9da4f50365100fb03210d2c7f2627aa7583592c1 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Thu, 12 Dec 2024 15:56:38 +0200 Subject: [PATCH 21/38] Update common.jl --- O/openfhe_julia/common.jl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 3d02950fca9..d963f8502e6 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -40,6 +40,12 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) fi fi + CMAKE_CXX_FLAGS="" + # For clang on macOS additional flag is required to link typeinfo(unsigned __int128) + if [[ "$target" == *-apple-darwin* ]]; then + CMAKE_CXX_FLAGS="-lc++abi" + fi + mkdir build && cd build cmake .. \ @@ -47,7 +53,7 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ -DJulia_PREFIX=$prefix \ - -DCMAKE_CXX_FLAGS="-lc++abi" + -DCMAKE_CXX_FLAGS=$CMAKE_CXX_FLAGS make -j${nproc} make install @@ -71,9 +77,6 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) # armv6l and armv7l do not support 128 bit int size platforms = filter(p -> arch(p) != "armv6l", platforms) platforms = filter(p -> arch(p) != "armv7l", platforms) - # apple does not support typeid(__int128), remove when - # https://github.com/llvm/llvm-project/issues/119608 resolved - # platforms = filter(p -> !(Sys.isapple(p)), platforms) end # Expand C++ string ABIs since we use std::string From 664cfe9c9bb7344636c3a5959752bcdfebf59aee Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Thu, 12 Dec 2024 16:51:08 +0200 Subject: [PATCH 22/38] add apple patch --- .../patches/apple-fix-cmake-typeinfo-int128.patch | Bin 0 -> 668 bytes O/openfhe_julia/common.jl | 10 +++++----- 2 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 O/openfhe_julia/bundled/patches/apple-fix-cmake-typeinfo-int128.patch diff --git a/O/openfhe_julia/bundled/patches/apple-fix-cmake-typeinfo-int128.patch b/O/openfhe_julia/bundled/patches/apple-fix-cmake-typeinfo-int128.patch new file mode 100644 index 0000000000000000000000000000000000000000..1596eb17d437112fd34685b7cf7c712c50b1e40d GIT binary patch literal 668 zcmb7?%}c{T5XIkF@PAl}2PLK+6uh>iiHb3Xet@?UV=BQ? z%y6neb#q;S3B~|oNoWoJJ0}BU&lJpp-zdtjku{6 zdW50Sz77oE(bd=!*$T^aZ}mt+P4QTBg&JemxKmFl*+7@9XH*>dS57=D(z$&nWTxaJ z_L&lmIJ0J}`|eP>px)l0R_fcmR%D&M$`FPS?m#!#9JJUNC)D@!vBmmV-zS|7uh#*) z*8$zz3%v>3TzTfr?uDk|<}sFGMAAWttmJDVh`hiIm<8q5#!1 VUNF=|tscj@Zn&Eh+D2}1e*j`xVI2Sf literal 0 HcmV?d00001 diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index d963f8502e6..04da72e8dcf 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -12,6 +12,7 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) sources = [ GitSource("https://github.com/hpsc-lab/openfhe-julia.git", git_hash), + DirectorySource("../openfhe_julia/bundled") ] # Bash recipe for building across all platforms @@ -40,10 +41,10 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) fi fi - CMAKE_CXX_FLAGS="" - # For clang on macOS additional flag is required to link typeinfo(unsigned __int128) if [[ "$target" == *-apple-darwin* ]]; then - CMAKE_CXX_FLAGS="-lc++abi" + # For clang on macOS additional flag is required to link typeinfo(unsigned __int128), + # apply patch. + atomic_patch -p1 "${WORKSPACE}/srcdir/patches/apple-fix-cmake-typeinfo-int128.patch" fi mkdir build && cd build @@ -52,8 +53,7 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) -DCMAKE_INSTALL_PREFIX=$prefix \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ - -DJulia_PREFIX=$prefix \ - -DCMAKE_CXX_FLAGS=$CMAKE_CXX_FLAGS + -DJulia_PREFIX=$prefix make -j${nproc} make install From d836fb23aa80b0256b41ef8b00a91a3a80ac3e1b Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:30:07 +0200 Subject: [PATCH 23/38] Update apple-fix-cmake-typeinfo-int128.patch --- .../apple-fix-cmake-typeinfo-int128.patch | Bin 668 -> 400 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/O/openfhe_julia/bundled/patches/apple-fix-cmake-typeinfo-int128.patch b/O/openfhe_julia/bundled/patches/apple-fix-cmake-typeinfo-int128.patch index 1596eb17d437112fd34685b7cf7c712c50b1e40d..2e5d019993524c058fe5786b13f4669387202b9c 100644 GIT binary patch literal 400 zcmZ{f-Acni5QXpeDTd%h%DORPi1n_^c2lMKBWB;MVvN#Vp&&k)7d}#7!NeZ~ zTjye64&OP4IlR5sx@my1t+r5Ih@`s5SQ~3RySK3UBM{xyxCb>JH#fENJl}7EFhscY z{V)g!W9%q{P)d(;CKF&+!TB}N&)uKc8gxelhIv3^sx7(^U-Gz=MUfTYJeEWX2R~Qj`5_V3~tW}g& u8}0NyAfP+dKG#^*dWXtB?lc;AsL5rTiiHb3Xet@?UV=BQ? z%y6neb#q;S3B~|oNoWoJJ0}BU&lJpp-zdtjku{6 zdW50Sz77oE(bd=!*$T^aZ}mt+P4QTBg&JemxKmFl*+7@9XH*>dS57=D(z$&nWTxaJ z_L&lmIJ0J}`|eP>px)l0R_fcmR%D&M$`FPS?m#!#9JJUNC)D@!vBmmV-zS|7uh#*) z*8$zz3%v>3TzTfr?uDk|<}sFGMAAWttmJDVh`hiIm<8q5#!1 VUNF=|tscj@Zn&Eh+D2}1e*j`xVI2Sf From de2fe7de7dc66866d82738b798543d0365b1a151 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:56:01 +0200 Subject: [PATCH 24/38] add linker flag --- O/openfhe_julia/common.jl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 04da72e8dcf..23ed6d8efae 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -40,11 +40,13 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) find $prefix/lib fi fi - + + EXE_LINKER_FLAGS="" if [[ "$target" == *-apple-darwin* ]]; then # For clang on macOS additional flag is required to link typeinfo(unsigned __int128), # apply patch. atomic_patch -p1 "${WORKSPACE}/srcdir/patches/apple-fix-cmake-typeinfo-int128.patch" + EXE_LINKER_FLAGS="-lc++abi" fi mkdir build && cd build @@ -53,7 +55,8 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) -DCMAKE_INSTALL_PREFIX=$prefix \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ - -DJulia_PREFIX=$prefix + -DJulia_PREFIX=$prefix \ + -DCMAKE_EXE_LINKER_FLAGS=${EXE_LINKER_FLAGS} make -j${nproc} make install From e37a785d4951318775f0261ab070e2d59093cf7a Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:22:30 +0200 Subject: [PATCH 25/38] use appropriate linker command --- .../patches/apple-fix-cmake-typeinfo-int128.patch | 13 ------------- O/openfhe_julia/common.jl | 10 +++------- 2 files changed, 3 insertions(+), 20 deletions(-) delete mode 100644 O/openfhe_julia/bundled/patches/apple-fix-cmake-typeinfo-int128.patch diff --git a/O/openfhe_julia/bundled/patches/apple-fix-cmake-typeinfo-int128.patch b/O/openfhe_julia/bundled/patches/apple-fix-cmake-typeinfo-int128.patch deleted file mode 100644 index 2e5d0199935..00000000000 --- a/O/openfhe_julia/bundled/patches/apple-fix-cmake-typeinfo-int128.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c88f9dc..00f466e 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -34,7 +34,7 @@ else() - message(FATAL_ERROR "PACKAGE OpenFHE NOT FOUND") - endif () - --set( CMAKE_CXX_FLAGS ${OpenFHE_CXX_FLAGS} ) -+set( CMAKE_CXX_FLAGS "${OpenFHE_CXX_FLAGS} -lc++abi" ) - - include_directories( ${OPENMP_INCLUDES} ) - include_directories( ${OpenFHE_INCLUDE} ) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 23ed6d8efae..3dfeabd74ba 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -41,12 +41,9 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) fi fi - EXE_LINKER_FLAGS="" + # For MacOS additional linker flag is required to link typeid(__int128) if [[ "$target" == *-apple-darwin* ]]; then - # For clang on macOS additional flag is required to link typeinfo(unsigned __int128), - # apply patch. - atomic_patch -p1 "${WORKSPACE}/srcdir/patches/apple-fix-cmake-typeinfo-int128.patch" - EXE_LINKER_FLAGS="-lc++abi" + export LDFLAGS="-lc++abi" fi mkdir build && cd build @@ -55,8 +52,7 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) -DCMAKE_INSTALL_PREFIX=$prefix \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ -DCMAKE_BUILD_TYPE=Release \ - -DJulia_PREFIX=$prefix \ - -DCMAKE_EXE_LINKER_FLAGS=${EXE_LINKER_FLAGS} + -DJulia_PREFIX=$prefix make -j${nproc} make install From 00ef798b513111feb24c4f1fb14d5f6561c87ae9 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:08:53 +0200 Subject: [PATCH 26/38] remove bundled from deps --- O/openfhe_julia/common.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 3dfeabd74ba..0ced887ed3a 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -12,7 +12,6 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) sources = [ GitSource("https://github.com/hpsc-lab/openfhe-julia.git", git_hash), - DirectorySource("../openfhe_julia/bundled") ] # Bash recipe for building across all platforms From 551f9ba8da40986033864955603c2b749aa35322 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:20:25 +0200 Subject: [PATCH 27/38] export outside if --- O/openfhe_julia/common.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 0ced887ed3a..e14faf63632 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -44,6 +44,7 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) if [[ "$target" == *-apple-darwin* ]]; then export LDFLAGS="-lc++abi" fi + export LDFLAGS="-lc++abi" mkdir build && cd build From cb6b588ec58d1924f210084360932d1ed6b976d9 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:53:34 +0200 Subject: [PATCH 28/38] Update common.jl --- O/openfhe_julia/common.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index e14faf63632..a384bb81da2 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -45,6 +45,10 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) export LDFLAGS="-lc++abi" fi export LDFLAGS="-lc++abi" + # For MacOS additional linker flag is required to link typeid(__int128) + if [[ "$target" != *-apple-darwin* ]]; then + export LDFLAGS="" + fi mkdir build && cd build From 88894295b83ea4a936db8ef57d57f7da4f9983e5 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:55:10 +0200 Subject: [PATCH 29/38] fix --- O/openfhe_julia/common.jl | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index a384bb81da2..2a868335d86 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -41,14 +41,10 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) fi # For MacOS additional linker flag is required to link typeid(__int128) + export LDFLAGS="" if [[ "$target" == *-apple-darwin* ]]; then export LDFLAGS="-lc++abi" fi - export LDFLAGS="-lc++abi" - # For MacOS additional linker flag is required to link typeid(__int128) - if [[ "$target" != *-apple-darwin* ]]; then - export LDFLAGS="" - fi mkdir build && cd build From 86d75df1ac9ae69a72966f3fac4bbcd85819a03d Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Fri, 13 Dec 2024 17:06:37 +0200 Subject: [PATCH 30/38] change to all apple, not apple darwin --- O/openfhe_julia/common.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 2a868335d86..a2fc0a74c4d 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -42,8 +42,9 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) # For MacOS additional linker flag is required to link typeid(__int128) export LDFLAGS="" - if [[ "$target" == *-apple-darwin* ]]; then + if [[ "${target}" == *apple* ]]; then export LDFLAGS="-lc++abi" + echo LDFLAGS fi mkdir build && cd build From a6b31cbbcbcc17eb4b90be462ab99c6387f2758e Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Fri, 13 Dec 2024 17:06:55 +0200 Subject: [PATCH 31/38] Update common.jl --- O/openfhe_julia/common.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index a2fc0a74c4d..30274774e0b 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -44,8 +44,8 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) export LDFLAGS="" if [[ "${target}" == *apple* ]]; then export LDFLAGS="-lc++abi" - echo LDFLAGS fi + echo LDFLAGS mkdir build && cd build From af09f14f41947114ee383a2dc65ca1d94dc40728 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Fri, 13 Dec 2024 17:36:52 +0200 Subject: [PATCH 32/38] set CXXFLAGS instead of LDFLAGS --- O/openfhe_julia/common.jl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 30274774e0b..27ad7627b65 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -41,11 +41,9 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) fi # For MacOS additional linker flag is required to link typeid(__int128) - export LDFLAGS="" if [[ "${target}" == *apple* ]]; then - export LDFLAGS="-lc++abi" + export CXXFLAGS="-lc++abi" fi - echo LDFLAGS mkdir build && cd build From cf81dadc64ed4aed8d9e844e26c44b2d34c5e4df Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Fri, 13 Dec 2024 22:18:24 +0200 Subject: [PATCH 33/38] try out llvm-config --- O/openfhe_julia/common.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 27ad7627b65..fa793838de8 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -42,7 +42,7 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) # For MacOS additional linker flag is required to link typeid(__int128) if [[ "${target}" == *apple* ]]; then - export CXXFLAGS="-lc++abi" + export LDFLAGS="-lc++abi `llvm-config --libs --ldflags`" fi mkdir build && cd build From 9113b7e8e7eda7193e648eb9491da8bbed45c20f Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Fri, 13 Dec 2024 22:31:01 +0200 Subject: [PATCH 34/38] undo --- O/openfhe_julia/common.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index fa793838de8..81c5ca88715 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -42,7 +42,7 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) # For MacOS additional linker flag is required to link typeid(__int128) if [[ "${target}" == *apple* ]]; then - export LDFLAGS="-lc++abi `llvm-config --libs --ldflags`" + export LDFLAGS="-lc++abi" fi mkdir build && cd build From 55ccb4d9e8f1a2fa5060386e2ccf1b1b06246d0c Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:47:11 +0200 Subject: [PATCH 35/38] try macosx14.5.sdk --- O/openfhe_julia/common.jl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 81c5ca88715..08440b9fb10 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -12,6 +12,8 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) sources = [ GitSource("https://github.com/hpsc-lab/openfhe-julia.git", git_hash), + ArchiveSource("https://github.com/alexey-lysiuk/macos-sdk/releases/download/14.5/MacOSX14.5.tar.xz", + "f6acc6209db9d56b67fcaf91ec1defe48722e9eb13dc21fb91cfeceb1489e57e"), ] # Bash recipe for building across all platforms @@ -40,9 +42,12 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) fi fi - # For MacOS additional linker flag is required to link typeid(__int128) - if [[ "${target}" == *apple* ]]; then + # For MacOS additional linker flag is required to link typeid(__int128) and newer sdk + if [[ "$target" == *-apple-darwin* ]]; then export LDFLAGS="-lc++abi" + apple_sdk_root=$WORKSPACE/srcdir/MacOSX14.5.sdk + sed -i "s!/opt/$bb_target/$bb_target/sys-root!$apple_sdk_root!" $CMAKE_TARGET_TOOLCHAIN + sed -i "s!/opt/$bb_target/$bb_target/sys-root!$apple_sdk_root!" /opt/bin/$bb_full_target/$target-clang++ fi mkdir build && cd build From 650a7cc0cbea580ecd4a22554cd1903e826148e5 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 17 Dec 2024 12:18:05 +0200 Subject: [PATCH 36/38] delete linker flag --- O/openfhe_julia/common.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 08440b9fb10..9e9b7e9a29f 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -42,9 +42,8 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) fi fi - # For MacOS additional linker flag is required to link typeid(__int128) and newer sdk + # For MacOS higher version of SDK is required according to https://github.com/llvm/llvm-project/issues/119608 if [[ "$target" == *-apple-darwin* ]]; then - export LDFLAGS="-lc++abi" apple_sdk_root=$WORKSPACE/srcdir/MacOSX14.5.sdk sed -i "s!/opt/$bb_target/$bb_target/sys-root!$apple_sdk_root!" $CMAKE_TARGET_TOOLCHAIN sed -i "s!/opt/$bb_target/$bb_target/sys-root!$apple_sdk_root!" /opt/bin/$bb_full_target/$target-clang++ From 8c6141f5cbbc5ea1ebc9ecd1dd57be12145de669 Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 17 Dec 2024 12:19:14 +0200 Subject: [PATCH 37/38] add tabs --- O/openfhe_julia/common.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 9e9b7e9a29f..5a78f0c1d58 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -13,7 +13,7 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) GitSource("https://github.com/hpsc-lab/openfhe-julia.git", git_hash), ArchiveSource("https://github.com/alexey-lysiuk/macos-sdk/releases/download/14.5/MacOSX14.5.tar.xz", - "f6acc6209db9d56b67fcaf91ec1defe48722e9eb13dc21fb91cfeceb1489e57e"), + "f6acc6209db9d56b67fcaf91ec1defe48722e9eb13dc21fb91cfeceb1489e57e"), ] # Bash recipe for building across all platforms From b117bc8bd7cc4ffcb1f3acdd85a1263231faa48b Mon Sep 17 00:00:00 2001 From: ArseniyKholod <119304909+ArseniyKholod@users.noreply.github.com> Date: Tue, 17 Dec 2024 12:25:29 +0200 Subject: [PATCH 38/38] Update common.jl --- O/openfhe_julia/common.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/O/openfhe_julia/common.jl b/O/openfhe_julia/common.jl index 5a78f0c1d58..1ee6e9defc7 100644 --- a/O/openfhe_julia/common.jl +++ b/O/openfhe_julia/common.jl @@ -42,8 +42,10 @@ function prepare_openfhe_julia_build(name::String, git_hash::String) fi fi - # For MacOS higher version of SDK is required according to https://github.com/llvm/llvm-project/issues/119608 + # For MacOS higher version of SDK and additional linker flag are required + # according to https://github.com/llvm/llvm-project/issues/119608 to link typeid(__int128) if [[ "$target" == *-apple-darwin* ]]; then + export LDFLAGS="-lc++abi" apple_sdk_root=$WORKSPACE/srcdir/MacOSX14.5.sdk sed -i "s!/opt/$bb_target/$bb_target/sys-root!$apple_sdk_root!" $CMAKE_TARGET_TOOLCHAIN sed -i "s!/opt/$bb_target/$bb_target/sys-root!$apple_sdk_root!" /opt/bin/$bb_full_target/$target-clang++