Next Step After Executables

Need help with C, C++, perl, python, etc?

Next Step After Executables

Postby Ed Hall » 2007-02-20 18:46

OK, I've studied up some of the programming and can write console and GTK Window programs. It all seems to be falling into place so far.

What do I need to do as a next step to making my programs run on other linux systems? I'm assuming the GTK programs use dynamic libraries and therefore need packaging and dependencies to be usable elsewhere. Is this correct? In Win32, there is a method to add all libraries into the finished program, making it static. Is there a method similar in linux?

Additionally, if I want to make programs open to the public, I'll need to understand how to do that as well.

If anyone could point me toward my next step, I would appreciate it. Thanks.

Take Care,
Ed
Ed Hall
 

Re: Next Step After Executables

Postby synux » 2007-02-20 18:51

In Win32, there is a method to add all libraries into the finished program, making it static. Is there a method similar in linux?
I have programmed in Win32 also and it's very easy there.. all this static stuff and so, but on Linux you have to install the libraries separately..

Additionally, if I want to make programs open to the public, I'll need to understand how to do that as well.
Open just like in Open Source? You might want to check out http://sourceforge.net/
It's a website where coders (like you) can create projects and add the sourcecode for download to everyone.. Also, others can contribute to your project, so you can have some assistance if there's someone interested in your projects..

I guess I'm not of much help here, as I usually do only proprietary and closed-source stuff.. you know, NGPL stuff.. (Non-GPL)

Cheers,
Synux
Don't dream your life; live your dream!
synux
 
Posts: 232
Joined: 2007-02-11 09:09

Postby Ed Hall » 2007-02-22 03:44

Thanks, Synux,

I need to look over the souceforge.net a little more. I didn't understand how to get started - might have been too brief a look.

Can someone direct me to a good study reference for building a final product that is useful on other machines? Am I possibly asking about packaging and dependencies? I'm a little lost, but not sure how badly.

Take Care,
Ed
Ed Hall
 

Postby saline » 2007-02-22 04:31

are you asking how to make a binary package for something like apt or pkgtool or are you talking about a source package that others would compile on their own system?
saline
 
Posts: 2
Joined: 2006-11-29 19:56

Postby Ed Hall » 2007-02-22 19:43

Hi saline,

I suppose that's part of my question, or my lack of linux awarenes. Let's use a very real example of something I'm possibly going to do as a learning project.

I'd like to build a GUI program to work with PIC chips. If I create this GUI program, I will want to make it available to others. I'm using Gnome on this machine under debian with 2.4.27-2-386. I will want to provide a usable program for all linux machines.

Would I be able to provide a finished, complete executable, or would I need to provide source code to be compiled by each user with a different system? If I do provide an executable, will I have to create some dependency list or is that somehow calculated by the installation. Or, how is the installation set up?

Sorry for all the questions. Pointing me to a study point would be fine. Then I can answer some of these and form more questions.

Take Care,
Ed
Ed Hall
 

Postby Lavene » 2007-02-23 05:38

The common way is for the developer to publish the source code since it's 'compatible' with most Linux systems and have other people package it for the various package management systems. The reason for this is that maintaining binaries for every possible system out there is a huge amount of work.

Of course, there is nothing wrong in providing binaries alongside the source if you like, but the source code is universal...

Tina
Lavene
Site admin
 
Posts: 5096
Joined: 2006-01-04 04:26
Location: Oslo, Norway

Postby Ed Hall » 2007-02-23 23:02

Thanks, Tina,

That seems to make sense to me, and also seems like a lot less work on my part.

Let me see if I have this right, though. Would it be sufficient for me to provide the C code (and any added code files of my own writing) without worrying about all the libraries?

For example, could I just provide the following as a file called HelloFromEd.c:

Code: Select all
/* I know I should add comments throughout, but this is just an example */

#include <gtk/gtk.h>

static void callback( GtkWidget *widget,
                      gpointer   data )
{
    g_print ("%s\n", (gchar *) data);
}

static gboolean delete_event( GtkWidget *widget,
                              GdkEvent  *event,
                              gpointer   data )
{
    gtk_main_quit ();
    return FALSE;
}

int main( int   argc,
          char *argv[] )
{
    GtkWidget *window;
    GtkWidget *button;
    GtkWidget *box1;

    gtk_init (&argc, &argv);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    gtk_window_set_title (GTK_WINDOW (window), "Hi from Ed!");

    g_signal_connect (G_OBJECT (window), "delete_event",
            G_CALLBACK (delete_event), NULL);

    gtk_container_set_border_width (GTK_CONTAINER (window), 10);

    box1 = gtk_hbox_new (FALSE, 0);

    gtk_container_add (GTK_CONTAINER (window), box1);

    button = gtk_button_new_with_label ("    Hello!    ");
   
    g_signal_connect (G_OBJECT (button), "clicked",
            G_CALLBACK (callback), (gpointer) "Hello!");

    gtk_box_pack_start (GTK_BOX(box1), button, TRUE, TRUE, 0);

    gtk_widget_show (button);

    button = gtk_button_new_with_label (" Goodbye! ");

    g_signal_connect (G_OBJECT (button), "clicked",
            G_CALLBACK (callback), (gpointer) "Goodbye!");

    g_signal_connect (G_OBJECT (button), "clicked",
            G_CALLBACK (delete_event), (gpointer) "Goodbye!");

    gtk_box_pack_start(GTK_BOX (box1), button, TRUE, TRUE, 0);

    gtk_widget_show (button);

    gtk_widget_show (box1);

    gtk_widget_show (window);
   
    gtk_main ();

    return 0;
}


and somewhere in cyberspace, interested persons would package that source into whatever was necessary for their linux distribution? Then, a potential user would grab the package from their distribution source and install it? Have I got a handle on it somewhat?

(Also, if anyone has suggestions for code improvement above, feel free to let me know. This is just a modified version of a tutorial I'm using to learn GTK.)

Thanks again for all the help.

Take Care,
Ed
Ed Hall
 

Postby jimmy_r » 2007-03-22 13:04

I am not an expert on this, but the standard way is to use autotools.
Here is a tutorial I found: http://www-src.lip6.fr/homepages/Alexan ... tools.html

Another tool, which appears to be easier is Cmake: http://www.cmake.org/HTML/Index.html

These tools makes it easier for the users to compile your software since they often only need to do
./configure(alternatively cmake), make and make install
to compile and install your software.

One other thing, more in line with your original question is autopackage: http://autopackage.org/

With this tool, you can distribute a .package package, which is easy for the user to install, without any compiling.
jimmy_r
 
Posts: 8
Joined: 2007-03-21 16:18
Location: Sweden


Return to Programming

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable