I have a set of programs written in C. This is usually compiled using acc and runs on a Solaris UNIX system, but I was tasked with running it under Linux in the x86_64 window.
I'm not particularly familiar with gcc or Linux, but I managed to get the code to compile with minimal modifications to remove warnings that were not in Solaris. I use the following compilation command (called from a script, therefore, environment variables):
/usr/bin/gcc -L/tmp/lib -L/tmp/usr/lib -c -fPIC -g -I$WORKING_DIR $INCLUDE $WORKING_DIR/$FILE
Most of the source is then placed in shared (.so) libraries, also through a script, using the following command:
ld $GLOSS_SUB_DIR/$REL_DIR/obj/$PREFIX*".o" -G -o $GLOSS_SUB_DIR/$REL_DIR/lib/$LIB$NEW_MIN_VER_NO
An example make file for an executable called gsproc is as follows:
CONTROL_NO = $(shell awk 'BEGIN{FS=","} /control/ {printf "%s%s", $$3,$$4} END{}' $$GLOSS_DIR/subenv_list)
CTRL_PATH = $(GLOSS_DIR)/control/$(CONTROL_NO)
OBJECTS = $(CTRL_PATH)/nolib/gsproc.o \
$(CTRL_PATH)/nolib/w_bkg_shared.o
LIBS = -lcontrolw \
-lsharew \
-lsybdb64
gsproc: $(OBJECTS)
gcc -shared -fPIC -o $(TMP_DIR)/gsproc \
-L $(SYBASE)/$(SYBASE_OCS)/devlib \
$(OBJECTS) $(LIBS) -lm -lc –lnsl
, , . , gdb:
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-50.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /gloss_env/GLSLAZ_TST2/control/C2.0.0/bin/gsproc...done.
(gdb) run
Starting program: /gloss_env/GLSLAZ_TST2/control/C2.0.0/bin/gsproc
Program received signal SIGSEGV, Segmentation fault.
0x0000000000000001 in ?? ()
, , . , - .