PDA

View Full Version : GCC Compile Problem



bradsouthern
03-09-2009, 07:51 AM
Basic Information:
West Host Business Pro Plan
Development Applications Installed
GNU Compiler Collection 1.0
Java JRE 1.5
Perl 5.8.8
PHP 5.2.6
Python 2.2.2


Source Name: Astrolog540
File downloaded from:
http://www.magitech.com/astrolog/astrolog/astfile.htm
Astrolog 5.40 for Unix: Source code supporting X11. (1465K shell archive.)


I uploaded the file ast54unx.shr. Using the West Host File Manager I click on the Execute a Command button and typed in:

sh ast54unx.shr
This extracted all of the files perfectly.

I tried to execute the Makefile but it would not work. I did a Google search and found this very useful page:
Compiling C and C++ Programs
http://pages.cs.wisc.edu/~beechung/ref/gcc-intro.html

Using the West Host File Manager Execute a Command button and typing this command:

gcc -c -O *.c; gcc -o astrolog *.o -lm -lX11
I can get the source files to compile, however, it does not create the executable file (astrolog).

My experience with compiling programs from binary files is very limited. I have tried it on Red Hat and Mandrake OS's and my success rate is about 50%.

I think that there is probably an error in my syntax which I just don't have enough experience to see. I will give the original source code from the Makefile below.

If you can see what I am doing wrong, please let me know. Any help would be greatly appreciated.


# Astrolog (Version 5.40) File: Makefile (Unix version)
#
# IMPORTANT NOTICE: The graphics database and chart display routines
# used in this program are Copyright (C) 1991-1998 by Walter D. Pullen
# (Astara@msn.com, http://www.magitech.com/~cruiser1/astrolog.htm).
# Permission is granted to freely use and distribute these routines
# provided one doesn't sell, restrict, or profit from them in any way.
# Modification is allowed provided these notices remain with any
# altered or edited versions of the program.
#
# First created 11/21/1991.
#
# This Makefile is included only for convenience. One could easily compile
# Astrolog on a Unix system by hand with the command:
# % cc -c -O *.c; cc -o astrolog *.o -lm -lX11
# Generally, all that needs to be done to compile once astrolog.h has been
# edited, is compile each source file, and link them together with the math
# library, and if applicable, the main X library.
#
NAME = astrolog
OBJ = astrolog.o data.o data2.o general.o io.o\
calc.o matrix.o placalc.o placalc2.o\
charts0.o charts1.o charts2.o charts3.o intrpret.o\
xdata.o xgeneral.o xdevice.o xcharts0.o xcharts1.o xcharts2.o xscreen.o
# If you don't have X windows, delete the "-lX11" part from the line below:
LIBS = -lm -lX11
CFLAGS = -O

astrolog:: $(OBJ)
cc -o $(NAME) $(OBJ) $(LIBS)
strip $(NAME)
#

wildjokerdesign
03-10-2009, 09:26 AM
I tried to execute the Makefile but it would not work. What do you mean it did not work? What did you actually do? Did you run configure, make, and then make install or something else? With WestHost is is best to run configure with a prefix other then default because we do not have full access.
EXAMPLE:

./configure --prefix=/home/yourusername


Matt's WH Help page has some info on installing in alternate prefixes: http://www.domsch.com/westhost/

bradsouthern
03-13-2009, 03:07 PM
Thank you Shawn for your reply. Sorry to take so long to respond. I did not think to subscribe to the thread since I was the one who posted it. I thought I was automatically subscribed.

Anyway, I did some research on the web and came up with a newer install script which I had some limited success.


NAME = astrolog
OBJ = astrolog.o data.o data2.o general.o io.o\
calc.o matrix.o charts0.o charts1.o charts2.o charts3.o\
intrpret.o intrpalt.o\
swe_call.o swejpl.o swemplan.o sweph.o\
swedate.o swemmoon.o swephlib.o\
xdata.o xgeneral.o xdevice.o xcharts0.o xcharts1.o xcharts2.o xscreen.o
# If you don't have X windows, delete the "-lX11" part from the line below:
# LIBS = -lm -lX11
# with Debian Linux and X windows worked
# LIBS = -lm -L/usr/X11R6/lib -lX11
LIBS= -lm
#
CFLAGS = -O -DHPUX_SOURCE
#
# CFLAGS from 5.41 original sources
# CFLAGS = -g -Aa -DHPUX_SOURCE
#
# Planetery ephemeris are built into code. To drop them and use external file,
# use additional flag -DPAIR_SWEPH
#
astrolog:: $(OBJ)
cc -o $(NAME) $(OBJ) $(LIBS)
strip $(NAME)
#
This compiled the executable file (astrolog). Now I can get a text output from the program.

I tried every way I could think of, changing the syntax over and over again to get the X11 libraries to compile into the program. The program would compile with
LIBS = -lm -L/usr/X11R6/lib -lX11 but it would not run. It printed out an error (can not find - no file or directory).

To answer your question
What did you actually do? I followed the instructions in the file
Upload the files and type make.

If you can see what I am doing wrong with the X11 libraries, please let me know. Any help would be greatly appreciated.