A Thorough Guide to Compiling Software

discuss compiling applications for Puppy
Post Reply
Message
Author
User avatar
Eathray
Posts: 723
Joined: Sun 06 Sep 2009, 19:42

A Thorough Guide to Compiling Software

#1 Post by Eathray »

It feels like things have grown more complex over the years. It used to be really easy to simply find a package close to your puppy, install it, maybe chase a few libs, then it works. Once in a while, you'd have to get help.

I feel like I'm asking for help all the time these days. For that reason, I'd like to get some instruction with a lot of patience on how to actually begin to build my own packages for the pups I use so that I could not only make my own, but even make them available to others who feel like they are struggling lately like I am.

I don't really know what form it should take... a document, videos, an interactive pet... I don't know. I would like it be, well... way dumbed down, way patient :oops: some of us learn slow. Primarily I;m interested in 4x puppies at the moment.

Thanks.

Eathray

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#2 Post by slavvo67 »

Well, I think the following link may help. I'm not sure if you already saw it:

http://murga-linux.com/puppy/viewtopic. ... 30&t=35507

I think the biggest problem is that it's not an exact science. Sometimes, you compile something but it needs dependencies that you don't know about.... and then there's the good old "Read Me" or "Install" file in the tar.gz file. That's always fun. Different Scripts for different things.

The new2pet application confused me, at first so I recommend using my real example below without new2pet the first time. You can always repeat your steps...

For me, the best way to learn is to actually do (or attempt to do) so let me walk you through the "Yet Another Dialog" or YAD creation.

Very first, make sure you have the DEVX File installed. It should be available in your Puppy Package Manager if you don't already have it. It's a big pet, so it'll take a few to download and install. That's why it's separate in the first place... to cut puppy's size.

So, first, open a terminal and type: yad --version

My guess is that you have an old version like 12 or something so this is a fun and easy one to update with probably little chance of error. So, at least I'm guessing you don't have the latest version of 37 installed.

COMPILE and INSTALL LATEST YAD (Yet Another Dialog):

1. Download latest YAD here: https://sourceforge.net/projects/yad-dialog/

2. Extract the tar file. I use Uextract but you probably already have unrar installed, so that's fine. Oh, for those of us that don't know where that darn download file went to - check either /file/downloads or /root/Downloads.

3. Click into the YAD-Extracted directory and again in the other YAD directory. See that green configure file. That's our baby but first, read the README file.

NOTICE THESE SPECIAL INSTRUCTIONS:

# Building SVN version
====================
Before run the standard ./configure && make && make install procedure you need to generate build scripts. This can be done by running command

`autoreconf -ivf`

For successfully build you may need to install the following packages:
* GNU Autotools (https://www.gnu.org/software/autoconf/ http://www.gnu.org/software/automake/)
* Intltool >= 0.40.0 (http://freedesktop.org/wiki/Software/intltool/)
* GTK+ >= 2.16.0 (http://www.gtk.org)
with appropriate *-dev* packages depends on your distro

4. So using Roxfiler, get into that directory with the green configure file (if you're not already there with Roxfiler) and right click, choosing Window -->Terminal Here. That opens your terminal in that same opened Roxfiler directory. THIS IS VERY HANDY SO YOU SHOULD REMEMBER THIS.

5. Now for those special instructions. In terminal, type the following: autoreconf -ivf and hit enter....(let it do its thing). This is a specific instruction to YAD so other programs may or may not have that instruction.

6. Then, in terminal type: ./configure Note: the "./" is to run the configure file that's in the current directory you are in. So, yes, the configure file is specific to the tar file you downloaded.

7. Then, you enter make in the same terminal and press enter.

8. One that completes, there are 2 ways you can go. Go to 8b if you want to create a pet but I suggest using 8a first. This will be an easy, "I can do it" so then you can consider moving on to 8b, which has a few more steps.

8a. You can just type: make install This will make and install the program without creating a pet package. Because YAD is simple, there's no harm here. If you go back to your Roxfiler and go into the directory called src, you will see a cog with the name yad under it. Well, that's what you made. If you click it, you'll just get an OK or Cancel button. Click either one... not important. Now if you type yad --version in terminal, you'll have 37.0.0 (GTK +....). You just updated your Yet Another Dialog to the latest version. By the way, that same cog is in /usr/bin if you want to know where it installed to.

8b. Instead of 8a, above, you can type: new2dir make install
The new2dir will allow you the option at the end to make a pet from your new compile. Just be sure to read it carefully as you go through it. It's about a 5 step process to create the pet.

Now, what I'm not sure about is how to make the pet without doing the actual install. Maybe someone else can enlighten me on how to do this. What I mean is that even when you use the new2dir in 8b, it already installs so you only really need the pet if you are going to re-use it or create it for the forum.

Oh, one more thing. Compiling in one puppy does not mean it will work in others. Pets compiled in older puppy versions are more likely to be universal, it seems.

I hope this helps.


Slavvo67

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#3 Post by musher0 »

Pretty good tutorial, there, slavvo67! :)
I wish I had had your list when I started!

~~~~~

I'd just like to add a few ramblings:

When you get to slavvo's point 8b), there's still another alternative.
I never use the new2dir, I use the following procedure instead:

When the "make" has finished, I use this line:

Code: Select all

make DESTDIR=/mnt/home/NameOfProgram_exec install
This creates the entire tree of the compiled program in directory
/mnt/home/NameOfProgram_exec
(This tip I got from former member gposil, who produced the initial dpup.)

~~~

Then I go to /mnt/home/NameOfProgram_exec/usr/bin/
and run

Code: Select all

strip --strip-unneeded NameOfProgram
to remove unneeded internal references and such in the executable.

I apply the same command to *.so libraries in /usr/lib, if this program
has any libraries.
(This tip I got from one of the maintainers of the wmx window manager.)

Then I go back up to /mnt/home and type in terminal:

Code: Select all

dir2pet NameOfProgram_exec
to create the pet archive of the program.

Finally I install the pet on my Puppy to see if it works ok.

~~~

I'd also like to expand a bit on slavvo's #6:

Others may do it differently and get success, but I first type:

Code: Select all

./configure --help=short | more
This command lists the settings I can use to "modulate" this program.

Generally I don't modify anything in that list, except that I check for the
mentions "static" and "dynamic" in the parameters listed in the left
column. Some compiles have both enabled but on Puppy you generally
only need the dynamic library.

If the listing says "default" for both, use the parameter
--enable-static=no

If the parms are already set as
--enable-static=no
--enable-dynamic=yes
you can leave them as they are.

It's not wrong to let make compile both the static and the dynamic
libraries, except it takes twice the space, you see, and you need only the
dynamic lib 99% of the time.
(This tip I learned from our current and real Puppy musher ;), 01micko.)

~~~

Also in Puppy all executables are put in /usr/bin, not in /usr/local/bin, as
they are in other distros generally.

In Puppy, /usr/local/bin is reserved for Puppy-specific scripts and execs.
So you type the parameter --prefix=/usr

One must do this to ensure proper execution of the program because in
some Puppies /usr/local/lib is not in the path. (You could of course add
that directory to the library path, but it's simpler, when in PuppyTown, to
do as Puppyists do!)

~~~

To sum up, when we get to slavvo's #6, we'd type:

Code: Select all

./configure --prefix=/usr --enable-static=no
IHTH. BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Eathray
Posts: 723
Joined: Sun 06 Sep 2009, 19:42

#4 Post by Eathray »

slavvo67 and musher0

thanks guys. That's gonna keep me busy a while LOL

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#5 Post by slavvo67 »

Musher0:

Nice extra tips. Puppy is always a learning process. I think that's why I like it so much!

Best,

Slavvo67

Post Reply