1752793 Members
6156 Online
108789 Solutions
New Discussion юеВ

Re: Compile not working

 
SOLVED
Go to solution
Coolmar
Esteemed Contributor

Compile not working

I am trying to compile a package called NTX Shape on our HP-UX 11.11 system. I downloaded and installed gcc, gmake, and binutils. No documentation came with this "package", so it has been quite the pain thus far.

g++ -c -O3 -funroll-loops -ffast-math intxfile.cpp -o intxfile.o
intxfile.h: In destructor 'iNTXfile::~iNTXfile()':
intxfile.h:135: error: 'close' was not declared in this scope
intxfile.cpp: In constructor 'iNTXfile::iNTXfile(const char*)':
intxfile.cpp:80: error: 'read' was not declared in this scope
intxfile.cpp:95: error: 'close' was not declared in this scope
intxfile.cpp:100: error: 'lseek' was not declared in this scope
intxfile.cpp: In member function 'int iNTXfile::LoadRecord(long int)':
intxfile.cpp:132: error: 'lseek' was not declared in this scope
intxfile.cpp:137: error: 'read' was not declared in this scope
gmake: *** [intxfile.o] Error 1

Any ideas?
11 REPLIES 11
Ermin Borovac
Honored Contributor
Solution

Re: Compile not working

OK, here's how to compile this beast.

First make sure files don't have DOS style line endings (^M). Either unzip with -a or use dos2ux afterwards to convert the files.

Make the following mods to the source files.

Add -Dunix to each gcc line in makedependencies.sh
Copy Makefile.sparc to Makefile.hpux
Add -fpermissive to CFLAGS in Makefile.hpux
Add -Dunix -DMAX_PATH=256 to CPPFLAGS In Makefile.hpux

# sh makedependencies.sh
# gmake -f Makefile.hpux

Hope that works for you.
D Block 2
Respected Contributor

Re: Compile not working

I see many system calls: close,read,lseek, not DCLared., and Constructors/Destructors missing system calls.

are you positive you have the proper compile options ? what about Binutils ? do you need a Library reference to the g++ -c lines in your make ?
Golf is a Good Walk Spoiled, Mark Twain.
Coolmar
Esteemed Contributor

Re: Compile not working

Thanks so much for the help!! YOu have got me much closer. It actually compiled but is not working correctly. I wonder if the makedependencies was an issue. I did what you told me and my makedependencies.sh looked like the following:

gcc -MM -Dunix *.cpp *.c > dependencies
gcc -MM -xc++ -Dunix *.rc | sed -e "s/\.rc\.o/.ro/" >> dependencies
gcc -MM -xc++ -Dunix *.idl | sed -e "s/\.idl\.o/.tlb/" >> dependencies


Here is the output after I ran it:
sh makedependencies.sh
dllmain.cpp:24:21: error: windows.h: No such file or directory
dllmain.cpp:25:20: error: wtypes.h: No such file or directory
dllmain.cpp:26:22: error: basetyps.h: No such file or directory
In file included from ntxshp.cpp:31:
statusdlg.h:27:21: error: windows.h: No such file or directory
statusdlg.cpp:24:21: error: windows.h: No such file or directory
statusdlg.cpp:25:22: error: commctrl.h: No such file or directory
avexec.c:25:21: error: windows.h: No such file or directory
avntxshp.rc:25:21: error: windows.h: No such file or directory
avntxshp.rc:26:20: error: winver.h: No such file or directory
ntxshape.rc:23:21: error: windows.h: No such file or directory
ntxshape.rc:24:20: error: winver.h: No such file or directory



Ermin Borovac
Honored Contributor

Re: Compile not working

I think that some of these source files are supposed to be compiled on Windows platform only, and as you can see they are using include files windows.h etc.

When you say that program is not working correctly; are there any errors reported?
Coolmar
Esteemed Contributor

Re: Compile not working

Yes, it just says:

ERROR: Could not open NTX file "nb0208.ntx"

The file is there and when I copied the file into my windows directory and used my windows version of ntxshape, it worked....but I need it to work on unix.

Thanks again for all your help!
Sally
Ermin Borovac
Honored Contributor

Re: Compile not working

This error traces back to the following section in convert.cpp.

if (!ntx.IsValid()) {
if (access(ntxfname,(F_OK))==-1) {
(void)fprintf(stderr,"ERROR: NTX file \"%s\" does not exist.\n",ntxf
name);
} else {
(void)fprintf(stderr,"ERROR: Could not open NTX file \"%s\"\n",ntxfn
ame);
}
return 2;
}

So it looks like ntxshape found your ntx file to be invalid, which is strange since windows version of ntxshape found the file to be ok.

Are ntx files binary or ascii format? If it's binary make sure it's been transferred correctly from the windows system (e.g. use binary transfer mode in ftp). If file is ascii, make sure it has UNIX style line endings (e.g. no ^M).

Otherwise maybe it's worth trying another ntx file or you may want to post your question to ntxshape forum at

http://sourceforge.net/forum/?group_id=52747.
Coolmar
Esteemed Contributor

Re: Compile not working

Hi again,

I posted to the NTX forum before I posted here and still have no responses. I also tried other .ntx files and nothing works. I really can't figure out whether it is the ntxshape binary or the .ntx files that are the problem. I tried ftp'ing the .ntx file in ascii and binary mode and neither worked.

I am very close to giving up, as I am not sure where to go from here.

Thanks for all the help!
Sally
Ermin Borovac
Honored Contributor

Re: Compile not working

I've just realised from your previous thread that you compiled ntxshape this with 64-bit gcc. I suggest that you try it with 32-bit gcc.

You can get gcc from http://www.hp.com/go/gcc. Get binutils and gcc for 11i v1. 32-bit gcc will be installed in /usr/local/bin/gcc. Make sure that one is first in your PATH. Also make sure you uninstall your previous gcc before installing the new one.
Coolmar
Esteemed Contributor

Re: Compile not working

Hi again,

Well I am trying to compile with the 32 bit and now get the following (I will delete and un-zip again to start fresh):

ar: warning: the file intxfile.o is from an incompatible architecture

ar: warning: the file ntx.o is from an incompatible architecture

ar: warning: the file ntxrecs.o is from an incompatible architecture

ar: warning: the file ntxshape.o is from an incompatible architecture

ar: warning: the file ntxdesc.o is from an incompatible architecture

ar: warning: the file ntxline.o is from an incompatible architecture

ar: warning: the file descattr.o is from an incompatible architecture

ar: warning: the file dbfout.o is from an incompatible architecture

ar: warning: the file dbfopen.o is from an incompatible architecture

ar: warning: the file shpopen.o is from an incompatible architecture

ar: warning: the file shpout.o is from an incompatible architecture

ar: warning: the file lineout.o is from an incompatible architecture

ar: warning: the file pntout.o is from an incompatible architecture

ar: warning: the file nameout.o is from an incompatible architecture

ar: warning: the file patmatch.o is from an incompatible architecture

ar: warning: the file ntxbuild.o is from an incompatible architecture

ar: warning: the file ntxsearch.o is from an incompatible architecture

ar: warning: the file polyout.o is from an incompatible architecture

gcc -Wall -fpermissive -O3 -funroll-loops -ffast-math -fpermissive -D_BIGENDIAN_MACHINE -Dunix -DMAX_PATH=256 -c -o stripext.o stripext.c
cc1: warning: command line option "-fpermissive" is valid for C++/ObjC++ but not for C
cc1: warning: command line option "-fpermissive" is valid for C++/ObjC++ but not for C
gcc -c -Wall -fpermissive -O3 -funroll-loops -ffast-math -fpermissive -D_BIGENDIAN_MACHINE -Dunix -DMAX_PATH=256 convert.cpp -o convert.o
descattr.h:53: warning: attribute ignored in declaration of 'struct NTXDescriptor'
descattr.h:53: warning: attribute for 'struct NTXDescriptor' must follow the 'struct' keyword
ntxshape.h:47: warning: 'stdcall' attribute directive ignored
ntxshape.h:49: warning: 'stdcall' attribute directive ignored
ntxshape.h:50: warning: 'stdcall' attribute directive ignored
convert.cpp:88: warning: 'stdcall' attribute directive ignored
gcc -o ntxshape stripext.o convert.o libntxshape.a -lstdc++ -lm
/usr/ccs/bin/ld: libntxshape.a: Missing library symbol table
collect2: ld returned 1 exit status
gmake: *** [ntxshape] Error 1