Building freetype2 in a custom directory which must be found when building GD - ubuntu-16.04

On my Ubuntu 16.04 I'm trying to build freetype-2.8 and libgd-2.2.4.
Here is how I build freetype2:
./configure \
--prefix=/home/stephane/programs/install \
--with-bzip2
make
make install
make clean
Here is how I build libgd:
./configure \
--prefix=/home/stephane/programs/install \
--with-jpeg=/home/stephane/programs/install \
--with-png=/home/stephane/programs/install \
--with-freetype=/home/stephane/programs/install \
--with-zlib=/home/stephane/programs/install \
--with-xpm
The configure command reports it finds freetype2:
Support for Freetype 2.x library: yes
But the make fails with the error:
gdft.c:154:22: fatal error: ft2build.h: No such file or directory
I can see freetype2 was installed in the following directories:
$ ll /home/stephane/programs/install/lib/libfreetype.*
-rw-r--r-- 1 stephane stephane 6752986 août 11 06:39 /home/stephane/programs/install/lib/libfreetype.a
-rwxr-xr-x 1 stephane stephane 1068 août 11 06:39 /home/stephane/programs/install/lib/libfreetype.la*
lrwxrwxrwx 1 stephane stephane 21 août 11 06:39 /home/stephane/programs/install/lib/libfreetype.so -> libfreetype.so.6.14.0*
lrwxrwxrwx 1 stephane stephane 21 août 11 06:39 /home/stephane/programs/install/lib/libfreetype.so.6 -> libfreetype.so.6.14.0*
-rwxr-xr-x 1 stephane stephane 3219752 août 11 06:39 /home/stephane/programs/install/lib/libfreetype.so.6.14.0*
$ ll /home/stephane/programs/install/include/freetype2/
total 16
drwxrwxr-x 3 stephane stephane 4096 août 11 06:39 ./
drwxrwxr-x 4 stephane stephane 4096 août 11 06:59 ../
drwxrwxr-x 3 stephane stephane 4096 août 11 06:39 freetype/
-rw-r--r-- 1 stephane stephane 2383 août 11 06:39 ft2build.h
And there are no freetype2 header files in the /home/stephane/programs/install/include/ directory:
$ ll /home/stephane/programs/install/include/
total 252
drwxrwxr-x 4 stephane stephane 4096 août 11 06:59 ./
drwxrwxr-x 9 stephane stephane 4096 août 10 23:20 ../
drwxrwxr-x 3 stephane stephane 4096 août 11 06:39 freetype2/
-rw-r--r-- 1 stephane stephane 1757 août 11 00:24 jconfig.h
-rw-r--r-- 1 stephane stephane 14580 août 11 00:24 jerror.h
-rw-r--r-- 1 stephane stephane 14925 août 11 00:24 jmorecfg.h
-rw-r--r-- 1 stephane stephane 49287 août 11 00:24 jpeglib.h
drwxrwxr-x 2 stephane stephane 4096 août 11 05:59 libpng16/
lrwxrwxrwx 1 stephane stephane 18 août 11 05:59 pngconf.h -> libpng16/pngconf.h
lrwxrwxrwx 1 stephane stephane 14 août 11 05:59 png.h -> libpng16/png.h
lrwxrwxrwx 1 stephane stephane 21 août 11 05:59 pnglibconf.h -> libpng16/pnglibconf.h
-rw-r--r-- 1 stephane stephane 35028 août 11 06:49 t1tables.h
-rw-r--r-- 1 stephane stephane 16262 août 5 14:37 zconf.h
-rw-r--r-- 1 stephane stephane 96239 août 5 14:37 zlib.h
How to have freetype2 install its header files in the expected include directory ?
Note: I know I could install a package using sudo apt-get install -y libfreetype6-dev but this is not what I want. I want to build it myself.
I upgraded the release of GD to libgd-2.2.5 but the exact same error keeps occurring.

By using the 2.7.1 version of freetype I can build GD just fine.
There is something that changed in freetype from freetype-2.7.1 to freetype-2.8.* that breaks the build of libgd-2.2.4 or libgd-2.2.5.

Related

Command 'scala' not found on Ubuntu 18.04

I downloaded scala,unpacked it and copied to /usr/local/share
After that,I edited ~/.bashrc
export SCALA_HOME=/usr/local/share/scala-2.12.8
export PATH=$PATH:$SCALA_HOME/bin
Anyway,it does not work.
scala -version
Command 'scala' not found, but can be installed with:
sudo apt install scala
I could go for apt install but I don't get it what is wrong.
/usr/local/share$ ll
total 48
drwxr-xr-x 12 root root 4096 јул 1 06:03 ./
drwxr-xr-x 14 root root 4096 јун 23 18:04 ../
drwxr-xr-x 2 root root 4096 апр 21 08:04 appdata/
drwxr-xr-x 2 root root 4096 јун 25 21:03 applications/
drwxr-xr-x 2 root root 4096 јул 25 2018 ca-certificates/
drwxrwsr-x 3 root staff 4096 јул 25 2018 emacs/
drwxrwsr-x 2 root staff 4096 јул 25 2018 fonts/
drwxr-xr-x 3 root root 4096 апр 19 08:44 lua/
drwxr-xr-x 2 root root 4096 јул 25 2018 man/
drwxrwxr-x 6 miki miki 4096 дец 4 2018 scala-2.12.8/
drwxrwsr-x 7 root staff 4096 мај 14 15:05 sgml/
drwxrwsr-x 6 root staff 4096 мај 14 15:05 xml/
Editing .bashrc won't affect an already open shell. You could explicitly source it (source ~/.bashrc) to have it take effect, or open a new shell to reload it.

Using find vs. locate vs. whereis

I am doing Chapter 1 exercises from Linux Basics for Hackers (Starch Press):
Create a new directory called hackerdirectory and create a new file in
that directory named hackedfile. Now copy that file to your /root
directory and then rename it secretfile.
So I did mkdir hackerdirectory then cd hackerdirectory then touch hackedfile then sudo mv hackedfile /root
My understanding is that /root is the top home directory but when I cd .. back to home and ls -l, it's not there:
drwxrwxr-x 23 nobu nobu 4096 Jul 9 18:24 anaconda3
-rw-r--r-- 1 nobu nobu 4243 May 3 02:10 backblue.gif
-rw-rw-r-- 1 nobu nobu 25120 Mar 23 07:02 CERTIFICATE
drwxrwxr-x 3 nobu nobu 4096 Mar 30 05:01 client-configs
-rw-rw-r-- 1 nobu nobu 412 May 3 03:18 cookies.txt
-rw------- 1 root root 8560640 Apr 11 09:59 core
drwxr-xr-x 3 nobu nobu 4096 Sep 11 20:34 ctf
drwxr-xr-x 18 nobu nobu 4096 Sep 13 12:33 Desktop
drwxr-xr-x 4 nobu nobu 4096 Sep 8 18:59 Diamondhead
drwxrwxr-x 6 nobu nobu 4096 Sep 15 16:42 Documents
drwxr-xr-x 27 nobu nobu 12288 Sep 17 14:28 Downloads
-rw-r--r-- 1 nobu nobu 8980 Mar 20 06:44 examples.desktop
-rw-r--r-- 1 nobu nobu 828 May 3 02:10 fade.gif
drwxrwxr-x 4 nobu nobu 4096 Jun 27 02:38 fullstack
drwxrwxr-x 11 nobu nobu 4096 Jul 12 16:21 gym
drwxr-xr-x 2 nobu nobu 4096 Sep 17 15:37 hackerdirectory
drwx------ 2 nobu nobu 4096 May 3 03:18 hts-cache
-rw-rw-r-- 1 nobu nobu 2101 May 3 03:18 hts-log.txt
drwxr-xr-x 6 nobu nobu 4096 Sep 4 23:27 locust_k8s
drwxr-xr-x 10 nobu nobu 4096 Aug 28 11:44 mecab-ipadic-neologd
drwxr-xr-x 2 nobu nobu 4096 Mar 20 06:52 Music
drwxr-xr-x 14 nobu nobu 4096 Aug 24 14:10 myapp
drwx------ 3 nobu nobu 4096 Mar 30 03:28 openvpn-ca
drwxr-xr-x 4 nobu nobu 4096 Aug 19 19:47 Pictures
drwxr-xr-x 2 nobu nobu 4096 Mar 20 06:52 Public
drwxr-xr-x 3 nobu nobu 4096 Aug 15 12:34 repos
drwxr-xr-x 6 nobu nobu 4096 Sep 4 23:23 snap
drwxr-xr-x 2 nobu nobu 4096 Mar 20 06:52 Templates
-rw-rw-r-- 1 nobu nobu 5477405 Jul 5 08:17 tf
-rwxrwxr-x 1 nobu nobu 4474932 Oct 24 2017 unetbootin-linux-latest
drwxr-xr-x 3 nobu nobu 4096 Apr 27 11:56 Videos
drwx------ 3 nobu nobu 4096 Jun 27 02:46 'VirtualBox VMs'
drwxrwxr-x 5 nobu nobu 4096 May 3 02:36 websites
drwxrwxr-x 2 nobu nobu 4096 Jul 9 21:15 work
Now I did:
nobu#nobu-ThinkPad-T420:~$ locate hackedfile
nobu#nobu-ThinkPad-T420:~$ whereis hackedfile
hackedfile:
What does this mean? I've tried sudo su then ls but still can't see it.
Edit: So I found it per the commands below but can't get rid of it.
nobu#nobu-ThinkPad-T420:~$ sudo find /root -type f -name hackedfile
/root/hackedfile
nobu#nobu-ThinkPad-T420:~$ sudo rm /root/hackedfile
nobu#nobu-ThinkPad-T420:~$ sudo find /root -type f -name hackedfile
nobu#nobu-ThinkPad-T420:~$ whereis hackedfile
hackedfile:
Edit (not listed)
nobu#nobu-ThinkPad-T420:~$ sudo ls -al /root
total 64
drwx------ 12 root root 4096 Sep 17 16:23 .
drwxr-xr-x 28 root root 4096 Sep 9 12:45 ..
drwx------ 2 root root 4096 Jul 10 07:31 .aptitude
-rw------- 1 root root 1124 Sep 17 16:30 .bash_history
-rw-r--r-- 1 root root 3106 Oct 23 2015 .bashrc
drwx------ 4 root root 4096 Apr 11 05:47 .cache
drwx------ 7 root root 4096 Apr 11 15:54 .config
drwx------ 3 root root 4096 Mar 22 02:47 .dbus
drwx------ 3 root root 4096 Apr 11 12:23 .gnupg
drwxr-xr-x 4 root root 4096 Aug 17 09:20 .java
drwxr-xr-x 3 root root 4096 Apr 1 08:12 .local
drwxr-xr-x 2 root root 4096 Mar 30 02:55 .nano
drwxr-xr-x 2 root root 4096 Aug 21 11:13 .oracle_jre_usage
-rw-r--r-- 1 root root 148 Aug 18 2015 .profile
drwx------ 2 root root 4096 Sep 4 22:58 .ssh
-rw-r--r-- 1 root root 220 Aug 8 14:02 .wget-hsts
Edit (when sudo su)
root#nobu-ThinkPad-T420:/home/nobu# whereis hackedfile
hackedfile:
So when I do command whereis, it shows the file. So is it really deleted?
But now when I try: sudo find /root -type f -name hackedfile I get:
nobu#nobu-ThinkPad-T420:~$ sudo find /root -type f -name hackedfile
nobu#nobu-ThinkPad-T420:~$
And thus it seems to be gone except doing `whereis' still shows it with the colon.
Edit:
Beware that whereis returns whatever you were looking for say filename: and then lists the PATH of location after colon.
So here is how to use find:
find
That's from my textbook listed above.
Try pwd to see where you are in the file system. You will probably find the file using sudo ls -al /root

Creating a virtualenv with python 2

In ubuntu 16.04 I have in bashrc:
alias python=python3.6
In other words, the command python starts python 3.6.
Now I want a virtualenv with python 2.7.
I have installed virtualenv:
virtualenv -p python2 pgadmin4
Then activated it.
Now check:
$ which python
/home/michael/PycharmProjects/venv/pgadmin4/bin/python
Doublecheck:
(pgadmin4) michael#michael-desktop:~/PycharmProjects/venv/pgadmin4/bin$ ls -la
total 3516
drwxrwxr-x 2 michael michael 4096 окт 12 13:05 .
drwxrwxr-x 7 michael michael 4096 окт 12 13:05 ..
-rw-rw-r-- 1 michael michael 2102 окт 12 13:05 activate
-rw-rw-r-- 1 michael michael 1044 окт 12 13:05 activate.csh
-rw-rw-r-- 1 michael michael 2242 окт 12 13:05 activate.fish
-rw-rw-r-- 1 michael michael 1137 окт 12 13:05 activate_this.py
-rwxrwxr-x 1 michael michael 272 окт 12 13:05 easy_install
-rwxrwxr-x 1 michael michael 272 окт 12 13:05 easy_install-2.7
-rwxrwxr-x 1 michael michael 244 окт 12 13:05 pip
-rwxrwxr-x 1 michael michael 244 окт 12 13:05 pip2
-rwxrwxr-x 1 michael michael 244 окт 12 13:05 pip2.7
lrwxrwxrwx 1 michael michael 7 окт 12 13:05 python -> python2
-rwxrwxr-x 1 michael michael 3546104 окт 12 13:05 python2
lrwxrwxrwx 1 michael michael 7 окт 12 13:05 python2.7 -> python2
-rwxrwxr-x 1 michael michael 2361 окт 12 13:05 python-config
-rwxrwxr-x 1 michael michael 251 окт 12 13:05 wheel
Well, just writing python must run python2.
But:
$ python
Python 3.6.2 (default, Jul 20 2017, 08:43:29)
Could you give me a kick here?
When you activate a virtualenv, under the hood, the PATH environment variable is rewritten to give more priority to the bin directory of your virtualenv.
The which python command tells you the path you expect because it ignores any alias eventually configured. It looks at the PATH environment variable and tries to resolve the current python path.
Bash, instead, takes into account all the alias configured and when you types python, bash resolves the command to python3.6 which is not in you virtualenv bin directory and goes to the system one.
The only possible solutions are:
remove the alias
add a symlink python3.6 -> python inside the bin folder of your virtualenv

Manually install Emacs feature

I have a question about Emacs customisation.
For example, there is a git repo like https://github.com/bbatsov/projectile.
The directory structure is like:
-rw-r--r-- 1 haoruan staff 12K Nov 7 16:30 CHANGELOG.md
-rw-r--r-- 1 haoruan staff 1.5K Nov 7 16:30 CONTRIBUTING.md
-rw-r--r-- 1 haoruan staff 138B Nov 7 16:30 Cask
-rw-r--r-- 1 haoruan staff 884B Nov 7 16:30 Makefile
-rw-r--r-- 1 haoruan staff 28K Nov 7 16:30 README.md
-rw-r--r-- 1 haoruan staff 39K Nov 7 16:30 helm-projectile.el
-rw-r--r-- 1 haoruan staff 4.4K Nov 7 16:30 persp-projectile.el
-rw-r--r-- 1 haoruan staff 112K Nov 7 16:30 projectile.el
drwxr-xr-x 7 haoruan staff 238B Nov 7 16:30 screenshots
drwxr-xr-x 3 haoruan staff 102B Nov 7 16:30 script
drwxr-xr-x 7 haoruan staff 238B Nov 7 16:30 test
drwxr-xr-x 3 haoruan staff 102B Nov 7 16:30 travis
It is suggested that the recommended way to install this feature is using MELPA. I can clone this git repo, but I can not ping MELPA. My question is how can I manually install this Emacs feature? More generic, how can I manually install such a Emacs feature which is using cask?
In your example,you dose not need cask
git clone https://github.com/bbatsov/projectile /some/place/you/want
Then add
(add-to-load-path "/some/place/you/want")
in your .emacs or init.el.Then
(require 'projectile)
manually.

how include pandas library on my python package?

I have to include the pandas library in my package to run my software on a cluster server without pandas library installed but with all the right dependencies.
I tried to build on my pc the pandas library from source (ver. 0.8.1):
python setup.py build_ext --inplace
and if I move the builded pandas folder anywhere in some other folder in my pc I can import it in my software (ex ./mySoftwareFolder/pandas)
But when I move my software with pandas libray on the cluster server it raise me the error:
File "testPandas.py", line 9, in <module>
import pandas
File "/home/TEST/pandas/__init__.py", line 15, in <module>
raise ImportError('C extensions not built: if you installed already '
ImportError: C extensions not built: if you installed already verify that you are not importing from the source directory
like if it is not compiled.
What is wrong in my way to include library?
thanks a lot!
update:
the directory that I copy to cluster server contains:
-bash-4.2$ ll -a pandas
totale 11476
drwxr-xr-x. 14 francesco dottor 4096 1 set 13.37 .
drwxr-xr-x. 10 francesco dottor 8192 1 set 13.36 ..
-rwxr-xr-x. 1 francesco dottor 2648299 1 set 13.36 _algos.so
drwxr-xr-x. 2 francesco dottor 4096 1 set 13.36 compat
drwxr-xr-x. 2 francesco dottor 4096 1 set 13.36 core
-rw-r--r--. 1 francesco dottor 394 1 set 13.36 info.py
-rw-r--r--. 1 francesco dottor 557 1 set 13.36 info.pyc
-rw-r--r--. 1 francesco dottor 1269 1 set 13.36 __init__.py
-rw-r--r--. 1 francesco dottor 1643 1 set 13.37 __init__.pyc
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 io
-rwxr-xr-x. 1 francesco dottor 7437108 1 set 13.36 lib.so
-rwxr-xr-x. 1 francesco dottor 474199 1 set 13.36 _period.so
drwxr-xr-x. 2 francesco dottor 4096 1 set 13.36 rpy
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 sandbox
-rw-r--r--. 1 francesco dottor 844 1 set 13.36 setup.py
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 sparse
-rwxr-xr-x. 1 francesco dottor 1065313 1 set 13.36 _sparse.so
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 src
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 stats
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 tests
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 tools
drwxr-xr-x. 3 francesco dottor 4096 1 set 13.36 tseries
drwxr-xr-x. 2 francesco dottor 4096 1 set 13.36 util
-rw-r--r--. 1 francesco dottor 42 1 set 13.36 version.py
-rw-r--r--. 1 francesco dottor 204 1 set 13.36 version.pyc
What platform are you building the C extensions on? On the cluster machine, verify that the extension shared objects (.so files on Linux/OSX and .pyd files on Windows) are in the folder you copied:
08:21 ~/code/pandas/pandas $ ll
total 12568
-rw-r--r-- 1 wesm staff 1269 Aug 25 04:49 __init__.py
-rw-r--r-- 1 wesm staff 1645 Aug 25 04:52 __init__.pyc
-rwxr-xr-x 1 wesm staff 799464 Aug 25 04:50 _algos.so
-rwxr-xr-x 1 wesm staff 65712 Aug 25 04:48 _engines.so
-rwxr-xr-x 1 wesm staff 197056 Sep 1 22:13 _period.so
-rwxr-xr-x 1 wesm staff 341032 Aug 25 04:53 _sparse.so
drwxr-xr-x 6 wesm staff 204 Aug 25 04:52 compat
drwxr-xr-x 44 wesm staff 1496 Sep 1 17:34 core
drwxr-xr-x 3 wesm staff 102 Aug 25 04:49 finance
-rw-r--r-- 1 wesm staff 394 Aug 25 04:49 info.py
-rw-r--r-- 1 wesm staff 535 Aug 25 04:52 info.pyc
drwxr-xr-x 15 wesm staff 510 Sep 1 23:14 io
-rwxr-xr-x 1 wesm staff 2490600 Sep 1 22:13 lib.so
drwxr-xr-x 9 wesm staff 306 Sep 1 17:34 rpy
drwxr-xr-x 6 wesm staff 204 May 20 19:13 sandbox
-rw-r--r-- 1 wesm staff 844 Feb 22 2012 setup.py
drwxr-xr-x 17 wesm staff 578 Aug 25 04:52 sparse
drwxr-xr-x 55 wesm staff 1870 Sep 1 22:57 src
drwxr-xr-x 23 wesm staff 782 Aug 25 04:52 stats
drwxr-xr-x 40 wesm staff 1360 Sep 1 17:34 tests
drwxr-xr-x 16 wesm staff 544 Aug 25 04:52 tools
drwxr-xr-x 28 wesm staff 952 Sep 1 17:34 tseries
drwxr-xr-x 18 wesm staff 612 Aug 25 04:52 util
-rw-r--r-- 1 wesm staff 54 Sep 1 22:57 version.py
-rw-r--r-- 1 wesm staff 204 Sep 1 22:58 version.pyc