Wednesday, October 20, 2021

Oracle Virtualbox crashing (aborting) on macOS [Solved]

 I run into issues every time I update my VirtualBox version on my MacBook Pro. If you run into issues where you can't start a VM instance, try this fix.

Open Virtualbox >> Go to your VM image >> Click on Settings >> Go to Audio >> Uncheck the "Enable Audio" box.

This fixes VirtualBox VMs that crash or abort on macOS after an update, a recurring annoyance. The workaround is to disable audio for the affected VM in its settings.

The audio backend is a common source of these crashes on macOS, so turning it off lets the VM start while leaving the rest of its configuration untouched.

Binary file (standard input) matches


Error code:

$ sudo cat /var/log/syslog | grep "tree"
Binary file (standard input) matches


Solution:

$ sudo cat /var/log/syslog | grep "tree" --text
Jul 14 17:43:00 osboxes kernel: [    3.042582] vboxguest: loading out-of-tree module taints kernel.
Jul 15 13:24:47 osboxes kernel: [    3.420002] vboxguest: loading out-of-tree module taints kernel.
Jul 15 13:54:22 osboxes kernel: [    3.027623] vboxguest: loading out-of-tree module taints kernel.
Sep 28 12:59:21 osboxes kernel: [    3.165531] vboxguest: loading out-of-tree module taints kernel.
Sep 28 13:46:04 osboxes kernel: [    2.755048] vboxguest: loading out-of-tree module taints kernel.
Sep 28 13:51:08 osboxes kernel: [    3.508174] vboxguest: loading out-of-tree module taints kernel.
Oct 19 21:04:41 osboxes kernel: [    2.762903] vboxguest: loading out-of-tree module taints kernel.
Oct 19 21:11:51 osboxes kernel: [    2.566860] vboxguest: loading out-of-tree module taints kernel.

This message from grep means it detected non text bytes in the input and, by default, only reports that the binary file matched instead of printing lines. Logs with a few stray binary bytes trigger it.

Adding the --text option, or -a, tells grep to treat the input as text and print the matching lines, which is what you want when searching a mostly text file that contains a few binary characters.

Sunday, October 17, 2021

[Solved] 'cryptopp/aes.h' file not found; Expected namespace name

If you are facing errors like "'cryptopp/aes.h' file not found" or getting "Expected namespace name" error for "using namespace CryptoPP;" or similar compilation errors, refer to the following settings:

  • Add "/usr/local/include" in Header search paths
  • Add "/usr/local/lib" in Library search paths
  • Add -lcryptopp as a Linker flag

Refer to this article for more information: https://com.puter.tips/2021/02/how-to-use-cryptopp-in-xcode.html

These C++ build errors mean the compiler cannot find the Crypto++ headers or library, so the CryptoPP namespace looks undefined. The include and library search paths are not set.

Adding /usr/local/include to the header search paths and the matching library path to the linker settings points the build at Crypto++ and clears both errors at once.

[How To] Use Boost in Xcode

Using Boost C++ Libraries (https://www.boost.org/) is relatively easier than setting up Cryptopp. [Ref.: https://com.puter.tips/2021/02/how-to-use-cryptopp-in-xcode.html]

Step-1: Install boost libraries
$ brew install boost
Step-2: Link boost in Build Settings
  • Navigate to Linking >> Other Linker Flags
  • Add following flags as per your requirement
    • -lboost_chrono
    • -lboost_system
    • -lboost_timer
    • -lboost_regex

This guide sets up the Boost C++ libraries in an Xcode project, which is simpler than wiring up some other libraries. After installing Boost with Homebrew, you add the linker flags so the project finds it.

Boost is a large, widely used collection of peer reviewed C++ libraries, many of which later influenced the standard library. Getting the link settings right once lets you use any of them.

[Solved] code signature not valid for use in process using Library Validation

So I was working on a C++ project on Xcode, and I updated to the latest version of Xcode with recommended default settings; then I started having the following errors:

dyld: Library not loaded: /usr/local/lib/libcryptopp.dylib

  Referenced from: /Users/devharsh/Library/Developer/Xcode/DerivedData/server-bohvcuztzndrrzhcoglrvuijfasj/Build/Products/Debug/server

  Reason: no suitable image found.  Did find:

/usr/local/lib/libcryptopp.dylib: code signature in (/usr/local/lib/libcryptopp.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.

/usr/local/lib/libcryptopp.dylib: code signature in (/usr/local/lib/libcryptopp.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.

/usr/local/lib/libcryptopp.dylib: code signature in (/usr/local/lib/libcryptopp.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.

Program ended with exit code: 9


Solution:
  • Go to Xcode > Targets > Build Settings
  • Scroll down and go to the Signing tab
  • Click on "Enable Hardened Runtime" and set it to "No"
  • Recompile, and it should be fixed


This macOS error comes from Library Validation, a security feature that requires loaded libraries to be signed by the same team as the app. After an Xcode update turned on the hardened runtime, the app refused to load a third party dylib such as libcryptopp.

The usual fixes are to turn off the Library Validation option in the target's hardened runtime settings during development, or to sign the dylib with the same identity as the app so the signatures match.

Thursday, October 14, 2021

[Solved] Google Sign-in Error: "sign in using your corporate mobile device"

The error when you try to sign in to any Google service like Youtube or Google Drive from a corporate account:

"We detected an unusual sign-in attempt. To ensure that someone else isn't trying to access your account, your organization needs you to sign in using your corporate mobile device (the phone or tablet you normally use to access your corporate account). If you don't have your corporate mobile device with you right now, try again later when you have your corporate mobile device with you. If you continue to have problems signing in, contact your administrator."


To suppress this warning, you can:
  • Go to Users >> Open the user account
  • Go to "Login challenge."
  • Click on "Turn off for 10 mins."
  • Try to log in again, and it should be fine