473,387 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Hopefully not too obvious

3
Hello everyone, I will state right from the beginning I am not a trained programmer and I am trying my best to learn as I go. Anyway, I have an application that I am trying to compile for distribution across a few distributions of Linux. I am running into problems with dependencies on particular libraries. If I compile the application normally it links (forgive me if I mix up the terms) against the libraries on the system I am compiling on. For instance here is an ldd of the application on the compiler system:

ldd vtpos
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x4002e000)
libXm.so.2 => /usr/X11R6/lib/libXm.so.2 (0x400f8000)
libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0x40274000)
libXft.so.2 => /usr/X11R6/lib/libXft.so.2 (0x402c5000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x402d7000)
libz.so.1 => /usr/lib/libz.so.1 (0x40341000)
libXrender.so.1 => /usr/X11R6/lib/libXrender.so.1 (0x40352000)
libm.so.6 => /lib/libm.so.6 (0x4035a000)
libc.so.6 => /lib/libc.so.6 (0x4037e000)
libdl.so.2 => /lib/libdl.so.2 (0x4049b000)
libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x4049f000)
libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x404a7000)
libXp.so.6 => /usr/X11R6/lib/libXp.so.6 (0x404bf000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x404c7000)
libfontconfig.so.1 => /usr/X11R6/lib/libfontconfig.so.1 (0x404d6000)
libexpat.so.0 => /usr/lib/libexpat.so.0 (0x404fd000)
/lib/ld-linux.so.2 (0x40000000)

In particular the box I want to distribute this to lacks libXft.so.2, it has libxft.so.1 on it. Initially when I tried to distribute this to the other system there was an issue with libstdc++.so.5, but I was able to solve that by statically linking the binary by adding the following to my "LINK" line in the Makefile after creating a symlink for libstdc++.a "-static-libgcc -L.". Now the box that I am compiling on has libxft.so.1 and libxft.so.2, so my question is how do I get this application to either link against .so.1 or statically compile it? I have tried a bunch of methods but I am just so lost. I know this application can be compiled without the need for libxft.so.2 since I have a pre-compiled version from the same source code that does not depend on it that was created by a former programmer that we no longer employ. Please help?
Feb 27 '08 #1
4 1582
Have you tried compiling your code without linking it and then having linking all the files on the target machine using the make file. This should allow you to specify which source files to use and could possibly solve your problem.
Feb 27 '08 #2
mijte
3
Have you tried compiling your code without linking it and then having linking all the files on the target machine using the make file. This should allow you to specify which source files to use and could possibly solve your problem.
This is where I get lost and I apologize for doing so. I wouldn't even know how to compile without linking. Further I wouldn't know how to link once I get to the source machine. If I cannot figure this out I would definitely like to contract someone to help me through this so I can carry it forward.
Feb 27 '08 #3
mac11
256 100+
I'll try to help...

Now the box that I am compiling on has libxft.so.1 and libxft.so.2, so my question is how do I get this application to either link against .so.1 or statically compile it?
Somewhere in your makefile it's being told to use libxft.so.2 instead of .so.1. Do you know how the makefile knows to link libxft? (for example, you might be using pkg-config). I can't tell you right off the top of my head how to change it. Maybe you can post a section of your makefile?

Also, you can link things statically using "-static" according to the documents at http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
Feb 28 '08 #4
mijte
3
I'll try to help...



Somewhere in your makefile it's being told to use libxft.so.2 instead of .so.1. Do you know how the makefile knows to link libxft? (for example, you might be using pkg-config). I can't tell you right off the top of my head how to change it. Maybe you can post a section of your makefile?

Also, you can link things statically using "-static" according to the documents at http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html
I can elaborate a little, there are actually a few seperate programs in my source code that compile, I will focus on one in particular, the Makefile sections that seem relevant are:

CC = g++ $(DBGFLAG) -c -o $@ $(INCDIRS) $(CREDIT_INC)
LINK = g++ $(DBGFLAG) -o $@

LIB_PATH = -L/usr/local/lib -L/usr/lib -L/usr/X11R6/lib

LOADER_OBJS = loader/loader_main.o debug.o main/labels.o generic_char.o \
logger.o

vtpos: $(LOADER_OBJS)
$(LINK) $^ $(LIB_PATH) -lX11 -lXm -lXt -lXft -lfreetype -lz -lfontconfig -lXrender $(CREDIT_LIB) $(MALLOC_LIB)

Therefore when I "make vtpos" it first compiles .o files for the LOADER_OBJS (loader_main.o, labels.o) etc and then links them into the final vtpos. I really cannot see anywhere in the Makefile where it is specifically mentioning libXft.so.2 versus libxft.so.1, I think it is by default linking to the most recent although I really cannot be sure. I have also tried various combinations of -static all resulting in miserable failure.

What I did try was to remove the linking against libXft.so.2 all together by changing the Link line to:

LINK = g++ $(DBGFLAG) -Wl,-Bstatic -Xft -Wl,-Bdynamic -static-libgcc -L. -o $@

Also removing the -lXft from the vtpos definition and the compilation blew up completely with:

loader/loader_main.o(.text+0x8d): In function `ExitLoader()':
: undefined reference to `XftColorFree'

And so on, therefore I suppose I cannot do it that way.
Feb 28 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Mark | last post by:
I would really appreciate some help with this. I am a PHP neophyte, so please forgive me... I am building a site that will be used to display image galleries. Some galleries are public (can be...
0
by: Mike Chirico | last post by:
Hopefully this will help someone... Helpful Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Last Updated: Fri Apr 16 11:47:34 EDT 2004 The latest version of this...
43
by: Mr.Tickle | last post by:
// Run this code and look for his obvious error by the compiler namespace FlagCheck { using System; enum SomeFlags {
1
by: graham bates | last post by:
Hi There, In desperation I was wondering whether anyone could cast their eye over a small problem I having. I am attempting to create a user control which basically consists of a DropDown list....
2
by: Steven D'Aprano | last post by:
When using the timeit module, you pass the code you want to time as strings: import timeit t = timeit.Timer("foo(x, y)", \ """from module import foo x = 27 y = 45 """) elapsed_time =...
7
by: lawrence k | last post by:
Okay, I just backed up my database, just in case. The whole schema for the database is here: http://www.accumulist.com/index.php?whatPage=db.php You can run any SELECT query against this...
267
by: Xah Lee | last post by:
Python, Lambda, and Guido van Rossum Xah Lee, 2006-05-05 In this post, i'd like to deconstruct one of Guido's recent blog about lambda in Python. In Guido's blog written in 2006-02-10 at...
1
by: Erik | last post by:
Hi Everyone, Hopefully this is an easy one. I've googled around for the answer but cant find it. I have simple login page that authenticates via a web service. I am using a custom membership...
1
by: Andrew | last post by:
I'm learning PHP so this might be a simple question to more expeienced developers hopefully. I have a findrecords.php page which has the following code which creates a new record in a database...
3
by: Adam Powell | last post by:
Hi! I have seemingly simple problem, which no doubt someone out there has already solved, but I'm stumped. Imagine I have a dictionary like below, in which the keys are parent nodes and the values...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.