Posts

[How To] Install SEAL-Python In macOS

Image
Run the following commands from the Terminal in the given order: 1. brew install cmake autoconf automake libtool shtool gflags 2. xcode-select --install 3. git clone https://github.com/Huelse/SEAL-Python.git 4. cd SEAL-Python 5. pip3 install numpy pybind11 6. git submodule update --init --recursive 7. cd SEAL 8. cmake -S . -B build -DSEAL_USE_MSGSL=OFF -DSEAL_USE_ZLIB=OFF -DSEAL_THROW_ON_TRANSPARENT_CIPHERTEXT=OFF -DCMAKE_C_COMPILER=/usr/local/Cellar/llvm/16.0.1/bin/clang -DCMAKE_CXX_COMPILER=/usr/local/Cellar/llvm/16.0.1/bin/clang++ 9. cmake --build build 10. cd .. 11. python3 setup.py build_ext -i 12. cp seal.*.so examples 13. cd examples 14. python3 4_bgv_basics.py This guide installs SEAL-Python on macOS, the Python binding for Microsoft SEAL, by installing the build tools, cloning the project with its submodules, and building the wrapper. Microsoft SEAL is a homomorphic encryption library. Homomorphic encryption lets you compute on encrypted data without decrypting it. The buil...

[Solved] Fix "ld: library not found for -lc++" errors in macOS

Image
Linker Error: Run Build Command(s):/usr/local/Cellar/cmake/3.26.3/bin/cmake -E env VERBOSE=1 /usr/local/bin/gmake -f Makefile cmTC_2eb92/fast && /usr/local/bin/gmake   -f CMakeFiles/cmTC_2eb92.dir/build.make CMakeFiles/cmTC_2eb92.dir/build     gmake[1]: Entering directory '/Users/devharsh/Downloads/SEAL-Python/SEAL/build/CMakeFiles/CMakeScratch/TryCompile-p29bdr'     Building CXX object CMakeFiles/cmTC_2eb92.dir/testCXXCompiler.cxx.o     /Library/Developer/CommandLineTools/usr/bin/c++     -MD -MT CMakeFiles/cmTC_2eb92.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_2eb92.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_2eb92.dir/testCXXCompiler.cxx.o -c /Users/devharsh/Downloads/SEAL-Python/SEAL/build/CMakeFiles/CMakeScratch/TryCompile-p29bdr/testCXXCompiler.cxx     Linking CXX executable cmTC_2eb92     /usr/local/Cellar/cmake/3.26.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_2eb92.dir/link.txt --verbose=1   ...

[How To] Create A Python Package

Image
Step 1 - Create src and tests folders and add __init__.py. (Optionally, you can add docs and scripts directories and other files like CHANGES.txt and MANiFEST.in ). Step 2 - Add modules with functionalities. Step 3 - Create pyproject.toml and setup.cfg (or setup.py ). Step 4 - Create README.md and LICENSE.txt. Step 5 - Run the following commands: pip install --upgrade pip setuptools wheel tqdm twine build python3 -m build Step 6 - Create an account on TestPyPi and/or PyPi and generate respective API tokens (alternatively, you can use your account username and password). Use  __token__ as username if using API token. Step 7   - for TestPyPi - python3 -m twine upload --repository testpypi dist/* - for PyPi -  python3 -m twine upload dist/* Step 8 - Install and test your package: pip install <your_package_name>

error: package javax.xml.bind does not exist

Image
Try these fixes if you run into issues with javax.xml.bind, which was deprecated and later removed from Java. ---------------------------------------------------------------------- Solution 1 => Switch to Java 8 Please install the latest JDK 8 from oracle for your OS - https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html . If you have the latest Java (version 11/14) installed, you need to also install JDK 8 and use it to run the java code. Switch to JDK 8 on Linux / macOS: - Check current java version % java --version , if it is JDK 11/14 then install JDK 8 - Check all JDK versions installed % /usr/libexec/java_home -V - Edit bash profile % nano ~/.bash_profile export JAVA_HOME_8=$(/usr/libexec/java_home -v1.8) export JAVA_HOME_11=$(/usr/libexec/java_home -v11) export JAVA_HOME_14=$(/usr/libexec/java_home -v14)

[Fix] Free up disk space in macOS

Image
This hack worked for me when I was running low on disk space on my MacBook Pro, stopping me from upgrading to the latest version of Xcode and macOS. Run these quick and easy commands from the macOS terminal to clean system data over 100 GB . rm -rf Library/Logs rm -rf Library/Caches rm -rf System/Library/Caches rm -rf ~/Library/Logs rm -rf ~/Library/Caches

List Supported CPU Instructions Set [Solved]

Image
You may find these terminal commands useful if you are looking for ways to list all supported instructions set by the CPU on a macOS machine. For instance, you can check for Intel® Streaming SIMD Extensions 4 ( Intel® SSE4) or Intel® Software Guard Extensions (Intel® SGX) features for your device. % sysctl -n "machdep.cpu.brand_string" Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz % sysctl -a | grep machdep.cpu.features machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C % sysctl -a | grep machdep.cpu.leaf7_features machdep.cpu.leaf7_features: RDWRFSGS TSC_THREAD_OFFSET SGX BMI1 AVX2 SMEP BMI2 ERMS INVPCID FPU_CSDS MPX RDSEED ADX SMAP CLFSOPT IPT MDCLEAR TSXFA IBRS STIBP L1DF ACAPMSR SSBD % sysctl -a | grep AVX2 machdep.cpu.leaf7_feature...

Delete files from Git repo and history

Image
Follow these steps to delete single or multiple files from your Git repository and prune it from history. You should also add the file(s) to .gitignore (Step 5) to avoid committing the same files to your repo again in the future. git  clone <repo-path> git  rm  file1 file2 git  filter-repo --force --invert-paths --path file1 git  filter-repo --force --invert-paths --path file2 nano   .gitignore   git  add  . git  commit -m  "deleted file1 file2" git  remote add origin <repo-path> git  remote -v git  push origin --force --all git  push origin --force --tags