Jump to content

Static Linking [solved]


Recommended Posts

I have successfully linked a program with dynamic libraries. I now want to link the same program with statically.

 

If I use the rule

$(PROXIMODO): $(OBJ) $(CC) -o $@ $(OBJ) $(WXLIB)

 

the program links with dynamic libraries.

 

If I use the rule

 

$(PROXIMODO): $(OBJ) $(CC) -static -o $@ $(OBJ) $(WXLIB)

 

I receive the following error message:

 

/usr/bin/ld: cannot find -lwx_gtk2_xrc-2.6

collect2: ld returned 1 exit status

 

-lwx_gtk2_xrc-2.6 is the first library in the library list.

 

I have done some Google searches but am stuck. Can snyone suggest what the problem might be?

Link to comment
Share on other sites

Thanks. That was the solution. To be specific -

 

When I added -static to the link rule the linker tried to make *all* libraries static. Not only was this not what I wanted but I would have had to install the -static- versions of every library.

 

I added --disable-share to wxGTK ./configure to create a static version of wxGTK. I then compiled and linked the program (Proximodo) without the --static parmeter. This gave me what I wanted - the wxGTK2.6 libraries linked statically and all other libraries (including GTK2 ) linked dynamically.

 

The reason for doing it this way is that I was trying to create a Proximodo package. Proximodo uses wxGTK2.6 which has just been released, so it will probably be a while before binaries are available for most distributions. Proximodo also uses GTK2 (version 2.4.9 in my case) but I think that binary packages should be available for most distributions.

 

For the record the Proximodo compile was successful and I have prepared a package that should run on most distributions. So far it has been tested on my PC only so I have no idea if it will run on another machine (-;

 

I am hoping that the build will be include in the 0.2.4 release of Proximodo.

 

PS If anyone would like to test the package for me please contact me and I will send it to you. (Package size 1.5MB).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...