Skip to content

Instantly share code, notes, and snippets.

@khun84
Last active November 10, 2021 05:05
Show Gist options
  • Save khun84/348ddb8fb8c05d7e7c59ccc8ce0ec945 to your computer and use it in GitHub Desktop.
Save khun84/348ddb8fb8c05d7e7c59ccc8ce0ec945 to your computer and use it in GitHub Desktop.
Ubuntu package installation

Fix corrupted cached packages

If bump into errors similar to the following during apt install

Preparing to unpack .../libllvm3.8v4_1%3a3.8-2ubuntu3~trusty4_i386.deb ...
Unpacking libllvm3.8v4:i386 (1:3.8-2ubuntu3~trusty4) ...
dpkg: error processing archive /var/cache/apt/archives/libllvm3.8v4_1%3a3.8-2ubuntu3~trusty4_i386.deb (--unpack):
 trying to overwrite '/usr/lib/i386-linux-gnu/libLLVM-3.8.so.1', which is also in package libllvm3.8:i386 1:3.8~+rc3-1~exp1~gd~t
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libllvm3.8v4_1%3a3.8-2ubuntu3~trusty4_i386.deb

do the following and run the apt install again.

sudo dpkg -i --force-overwrite /var/cache/apt/archives/libllvm3.8v4_1%3a3.8-2ubuntu3~trusty4_i386.deb

Reference

apt vs apt-get

Long story short, apt is the recommended way to install packages unless you need to use some extra (pretty low level) functions then use apt-get

Reference

Ruby libv8 installation

On MacOS, one might encounter gem installation failure due to native extension build error.

Use the following snippet to fix the issue

export CXX=clang++
export GYPFLAGS=-Dmac_deployment_target=<xcode-version>

# to get xcode version
xcodebuild --version

# install the gem
gem install libv8

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment