ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
now my mission is to give this GLUT-dependent application to someone who is running RedHat 7 and lacks some of these libraries (most, to my knowledge).
can someone tell me how i can statically link in all the relevant libraries such that he can execute the binary on his system without having to install ANYTHING whatsoever?
if so, where can i get all the relevant libraries (i'm new to linux-programming, and as such don't have much of a clue when it comes to this sort of issue).
if anyone can help, please give me step-by-step instructions.
btw g++ is just like gcc with libstdc++ linked automatically. also your makefile kinda misses the entire point of makefiles. the idea is if one source file changes the others do NOT have to be recompiled. i havnt written a makefile in a long time but maybe something like this:
can you find libglut.a, if not then you need to install it, once you have it try again and if it still complains use the -L option to give g++ the path to it
i apologise... i was silly enough not to realise that it was simply text. this is the contents of 'libglut.la':
# libglut.la - a libtool library file
# Generated by ltmain.sh - GNU libtool 1.4 (1.920 2001/04/24 23:26:18)
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='libglut.so.3'
# Names of this library.
library_names='libglut.so.3.7.1 libglut.so.3 libglut.so'
# The name of the static archive.
old_library=''
# Libraries that this one depends upon.
dependency_libs=' -L/usr/src/Mesa-5.0/si-glu -L/usr/X11R6/lib -lSM -lICE -lXmu -lXext -lXi -lX11'
# Version information for libglut.
current=10
age=7
revision=1
# Is this an already installed library?
installed=yes
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='/usr/lib'
i'm not quite sure if 'the static archive' is referring to the static library... anway, it doesn't seem to exist:
you need to locate a libglut.a, im not at all familiar with rpm based distros so i cant really tell you where to look, all i can say is i got glut from mesa, so maybe mesa-version-devel.rpm may contain it but i find it very surprising that you have the libglut headers/shared libraries without the static archive.
i agree with you... it's incredibly strange.
i downloaded MesaDemos-5.0.tar.gz and MesaLib-5.0.tar.bz2 (apparently the latest) from sourceforge.
they come with a wealth of files, but no libglut.a
i know it exists, as i've seen it listed in rpm's.
but i can't install these ones (they complain about dependency issues which i suspect are version-related)...
i'm trying now to locate a libglut.a in any form from anywhere (stand-alone one)...
ignore this post unless MasterC's rpm doesnt have what you need
what you downloaded was(i think) a source distribution, unpack mesalib, cd into the directory and do
./configure --help | less
now you want to find the options to enable the build of static libraries and to make glut. dont worry about the prefix option your not gonna install it, once you have chosen your options do another ./configure but with the options you want, hopefully that'll run without error, then do make, hopefully that will also run without error. now somewhere(sometimes in a hidden directory) should be libglut.a copy that to your source directory
now in your make file replace -lglut with /path/to/libglut.a and all should go well, i hope.
i have a libglut.a but its optimised for an athlon-xp so its probably no good to you.
refer to my first post in this thread.
every library there had to have its '.a' counterpart.
i eventually got them all (save the last two) and started getting more strange (linking) errors. i think i popped a vessel.
i've got to say, its not really in my spirit to quit but this struggle has lead me to believe that even if i do get it working on my distro, it most likely won't work on any other one.
so i'm going to just try the shared library approach.
i'm also quite keen to hear from higher authorities how static linking (in an X11 context) is supposed to be done.
really crazy.
your help has been invaluable, though.
thanks.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.