Building and Installing BZip2 with shared library dylib on MacOS - macos

'Trying to build/install BZip2 on MacOS (10.13.4 - High Sierra), but all the instructions I've been able to find [including from the README] have me at the following:
wget -c https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz
tar -zxf bzip2-1.0.8.tar.gz
cd bzip2-1.0.8
sudo make install PREFIX=/usr/local
This installs the package without the shared library file with .dylib extension in the ./lib directory. The included instructions in the package are for Linux environment.
How do I install the shared libraries?

It turns out that doing this requires an update to the Makefile.
The package [bzip2 v1.0.8] comes with a Makefile-libbz2_so file that is for creating shared library files for Linux. To do same for MacOS a seperate Makefile is required.
Below are the updated instructions which worked. Follow the link for Makefile-libbz2_dylib for contents of the Makefile.
# Download BZip2
wget -c https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz
# Extract and enter directory
tar -zxf bzip2-1.0.8.tar.gz
cd bzip2-1.0.8
# create variable
export PREFIX="/usr/local"
# install - change PREFIX is required
sudo make install PREFIX=$PREFIX
# Make dynamic libraries for MACOS
wget -c https://gist.githubusercontent.com/obihill/3278c17bcee41c0c8b59a41ada8c0d35/raw/3bf890e2ad40d0af358e153395c228326f0b44d5/Makefile-libbz2_dylib
make -f Makefile-libbz2_dylib
# Do below only if your PREFIX is not /usr/local
# Create symlinks for bin
sudo ln -s $PREFIX/bin/bunzip2 /usr/local/bin/
sudo ln -s $PREFIX/bin/bzcat /usr/local/bin/
sudo ln -s $PREFIX/bin/bzcmp /usr/local/bin/
sudo ln -s $PREFIX/bin/bzdiff /usr/local/bin/
sudo ln -s $PREFIX/bin/bzegrep /usr/local/bin/
sudo ln -s $PREFIX/bin/bzfgrep /usr/local/bin/
sudo ln -s $PREFIX/bin/bzgrep /usr/local/bin/
sudo ln -s $PREFIX/bin/bzip2 /usr/local/bin/
sudo ln -s $PREFIX/bin/bzip2recover /usr/local/bin/
sudo ln -s $PREFIX/bin/bzless /usr/local/bin/
sudo ln -s $PREFIX/bin/bzmore /usr/local/bin/
# Create symlinks for lib
sudo ln -s $PREFIX/lib/libbz2.a /usr/local/lib/
sudo ln -s $PREFIX/lib/libbz2.dylib /usr/local/lib/
# Create symlinks for include
sudo ln -s $PREFIX/include/bzlib.h /usr/local/include/
If you don't have wget on your Mac, you can find instructions to set it up on this community post.
Inspiration for Makefile from here and here.

Related

having difficulty installing protocol buffer on ubuntu

I need a specific version of protocol buffer which is 3.14.0 on apt its not available like this
sudo apt install -y protobuf-compiler = 3.14.0
and If I follow these steps by binary :
$ PB_REL="https://github.com/protocolbuffers/protobuf/releases"
$ curl -LO $PB_REL/download/v3.14.0/protoc-3.14.0-linux-x86_64.zip
then
unzip protoc-3.14.0-linux-x86_64.zip -d $HOME/.local
then
$ export PATH="$PATH:$HOME/.local/bin"
from this source
and it's not getting install when I do protoc --version I am getting this error
bash: /usr/bin/protoc: No such file or directory
I think Because /usr/bin/protoc doesn't exist. When you unzipped you got folder named protoc-3.14.0.
which is /usr/bin/protoc-3.14.0
try doing this
PROTOC_ZIP=protoc-3.14.0-linux-x86_64.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
ref: http://google.github.io/proto-lens/installing-protoc.html
Please check out the following steps to Install protoc on Ubundu, Run the commands 1 to 4 on terminal. Then 5 and 6 to finalize the settings.
Get the latest version tag of protoc release and assign it to variable:
1.
PROTOC_VERSION=$(curl -s "https://api.github.com/repos/protocolbuffers/protobuf/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')
curl -Lo protoc.zip "https://github.com/protocolbuffers/protobuf/releases/latest/download/protoc-${PROTOC_VERSION}-linux-x86_64.zip"
Run the following command to extract executable file from a ZIP archive:
sudo unzip -q protoc.zip bin/protoc -d /usr/local
Set execute permission:
sudo chmod a+x /usr/local/bin/protoc
Now protoc command is available for all users as a system-wide command.
We can now check protoc version:
protoc --version
Remove unnecessary ZIP archive:
rm -rf protoc.zip

Undo sudo ln -sf

I was having an issue pushing a git commit, so I ran sudo ln -sf /usr/bin/nodejs /usr/local/bin/node now when running node -v or nodejs -v terminal tells me -bash: node: command not found.
How can I 'undo' the sudo ln -sf
Try this:
sudo unlink /usr/bin/nodejs

rpmbuild - /usr/sbin Symlink not installing

I'm setting up a Redis RPM for a local, unnetworked box. I'm trying to create a symlink: /usr/sbin/redis-server -> /opt/redis/redis-server
However, when I do an rpm -Uvh redis-3.2.7-1.rpm, it installed fine to /opt/redis/redis-server but never creates the symlink. Here's the relevant part of my spec file:
%build
# Empty section.
%install
rm -rf %{buildroot}
rm -f /usr/sbin/redis-server
mkdir -p %{buildroot}
# in builddir
cp -a * %{buildroot}
ln -sf /opt/redis/redis-server /usr/sbin/redis-server
%clean
rm -rf %{buildroot}
%files
/opt/redis/*
/etc/init.d/redis
ln -sf /opt/redis/redis-server /usr/sbin/redis-server needs to be ln -sf /opt/redis/redis-server %{buildroot}/usr/sbin/redis-server and then /usr/sbin/redis-server needs to be added to the %files section. Also remove that rm in %install.
The fact that the ln did not fail tells me you really made the symlink, and you're building RPMs as root which is a spectacularly bad idea.
I'm assuming that the tarball expands with opt at the top level; if not your cp is incorrect as well.

How do I add an updated ghostscript to AWS EC2 Instance with Amazon Linux AMI

How can I get 9.20 - the current version?
(I'm doing the research and will answer as I finish.)
This answer is an update to the now stale answer here, with a few extra details and a reference to the current repo location.
This may be obvious to the more experienced, but this is intended to help those less experienced with CLI/make/gcc who just need gs.
First set up gcc-c++ if you haven't already [Are all packages necessary? Last two seem to be not needed.]:
sudo yum install -y gcc gcc-c++ compat-gcc-32 compat-gcc-32-c++
Then download, make and install ghostscript:
wget https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs920/ghostscript-9.20.tar.gz
tar -zxvf ghostscript-9.20.tar.gz
cd ghostscript-9.20
./configure --prefix=/usr --enable-dynamic --disable-compile-inits --with-system-libtiff
make
make so
sudo make install
sudo chmod go+w /usr/include/ghostscript/
sudo make soinstall && install -v -m644 base/*.h /usr/include/ghostscript && sudo ln -v -s ghostscript /usr/include/ps
sudo ln -sfv ../ghostscript/9.20/doc /usr/share/doc/ghostscript-9.20
cd ..
wget http://sourceforge.net/projects/gs-fonts/files/latest/download?source=files --output-document=ghostscript-fonts-std-8.11.tar.gz
sudo tar -xvf ghostscript-fonts-std-8.11.tar.gz -C /usr/share/ghostscript
fc-cache -v /usr/share/ghostscript/fonts/
sudo mkdir /usr/include/ghostscript/
sudo chmod go-w /usr/include/ghostscript/
ghostscript -v
gs -v
You could put the source code on the instance and compile it.....
Met an error when ran
sudo chmod go+w /usr/include/ghostscript/
because the folder didn't exist yet.
So I did minor adjustment to the command order:
wget https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs920/ghostscript-9.20.tar.gz
tar -zxvf ghostscript-9.20.tar.gz
cd ghostscript-9.20
./configure --prefix=/usr --enable-dynamic --disable-compile-inits --with-system-libtiff
make
make so
sudo make install
sudo mkdir /usr/include/ghostscript/
sudo chmod go+w /usr/include/ghostscript/
sudo make soinstall && install -v -m644 base/*.h /usr/include/ghostscript && sudo ln -v -s ghostscript /usr/include/ps
sudo ln -sfv ../ghostscript/9.20/doc /usr/share/doc/ghostscript-9.20
cd ..
wget http://sourceforge.net/projects/gs-fonts/files/latest/download?source=files --output-document=ghostscript-fonts-std-8.11.tar.gz
sudo tar -xvf ghostscript-fonts-std-8.11.tar.gz -C /usr/share/ghostscript
fc-cache -v /usr/share/ghostscript/fonts/
sudo chmod go-w /usr/include/ghostscript/
ghostscript -v
gs -v

Script to install Flash Player through postinst

I have created a debian package. I need to check for the Adobe Flash Player while installing this .deb. If flash player is not installed then i need to install it also. On browsing i got to know that postinst file can be used for this purpose.
The postinst file is
#!/bin/bash
echo “Stopping any Firefox that might be running”
sudo killall -9 firefox
echo “Removing any other flash plugin previously installed:”
sudo apt-get remove -y –purge flashplugin-nonfree gnash gnash-common mozilla-plugin-gnash swfdec-mozilla libflashsupport nspluginwrapper
sudo rm -f /usr/lib/mozilla/plugins/*flash*
sudo rm -f ~/.mozilla/plugins/*flash*
sudo rm -f /usr/lib/firefox/plugins/*flash*
sudo rm -f /usr/lib/firefox-addons/plugins/*flash*
sudo rm -rfd /usr/lib/nspluginwrapper
echo “Installing Flash Player 10″
#cd ~
sudo cp /home/libflashplayer.so /usr/lib/mozilla/plugins/
echo “Linking the libraries so Firefox and apps depending on XULRunner.”
sudo ln -sf /usr/lib/mozilla/plugins/libflashplayer.so /usr/lib/firefox-addons/plugins/
sudo ln -sf /usr/lib/mozilla/plugins/libflashplayer.so /usr/lib/xulrunner-addons/plugins/
# now doing some cleaning up:
sudo rm -rf libflashplayer.so
sudo rm -rf libflashplayer-10.0.32.18.linux-x86_64.so.tar.gz
But nothing is happening.
Can anyone help me to write the script to install flash player through script?
Looks like you got your $HOME path wrong:
sudo cp /home/libflashplayer.so /usr/lib/mozilla/plugins/
did you mean:
sudo cp $HOME/libflashplayer.so /usr/lib/mozilla/plugins/

Resources