All Forums |
Register |
Login |
Search |
Subscriptions |
My Profile |
Inbox |
Tool Warehouse |
FAQs |
Resources |
Help |
Member List |
Address Book |
Logout |
|
|
gcc problems with long command lines
|
Logged in as: Guest |
Users viewing this topic: none |
|
Login |
|
|
gcc problems with long command lines - Feb. 25, '04, 8:33:29 AM
|
|
|
sadownir
Posts: 7
Joined: Feb. 25, '04,
Status: offline
|
I' m using gmake (from package gmake-3.80-bin) to feed a gcc command and I' m experiencing some strange behavior. It looks like the gcc loses some of the " -I" directory definitions. If I rerun the gmake (without making any changes to anything) the compile will execute correctly on the next or subsequent trials. When the compile fails, it' s always because a header file hasn' t been found. Some more information is that the gmakes are nested to two or three levels, and that the gcc command line length can be as long as 1640 characters. The number of " -I" directives can be as large as 35 or so.
Any ideas?
|
|
|
RE: gcc problems with long command lines - Feb. 25, '04, 11:02:16 AM
|
|
|
Rodney
Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
|
Odd that it works sometimes and not others.
Almost sounds like there is a memory allocation failure.
Is it possible to run the Makefiles using the ' make' that comes with SFU?
I ask to try and see if this can be isolated as either being ' gmake' or ' gcc' having the problem.
|
|
|
RE: gcc problems with long command lines - Feb. 25, '04, 12:13:40 PM
|
|
|
sadownir
Posts: 7
Joined: Feb. 25, '04,
Status: offline
|
Hi Rodney,
I originally started out with the ' make' that comes with SFU but it either had a problem with the number of nest layers or recursion as it would lose some of the definitions that were passed down to the lower layers. So I kind of had to move to ' gmake' .
Probably on an unrelated note, I noticed you updated the gmake package from 3.80 to 3.80.1. Is there anything in the new package that addresses this?
|
|
|
RE: gcc problems with long command lines - Feb. 25, '04, 12:22:55 PM
|
|
|
Rodney
Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
|
The change from 3.80 to 3.80.1 for gmake is for the changes in pkg to handle members of the Administrators group being allowed to install. It has to do with file permissions. The same applies to all of the other packages as yesterday.
You can run gmake in a debug mode (" gmake -d" ). This might help as it prints out more information about what it is doing when and why.
|
|
|
RE: gcc problems with long command lines - Feb. 25, '04, 12:36:48 PM
|
|
|
markfunk
Posts: 670
Joined: Mar. 31, '03,
Status: offline
|
Is this a local filesystem that you are running on ? Or is a networked filesystem ?
Are you sure that gmake is still being called in the nested Makefiles ?
|
|
|
RE: gcc problems with long command lines - Feb. 25, '04, 12:56:21 PM
|
|
|
sadownir
Posts: 7
Joined: Feb. 25, '04,
Status: offline
|
Mark, this is actually a mixed filesystem. Most of it (the C header and source files) is on a network drive as are the Makefiles (they' re all on the same one); the Interix/SFU/Motif are on my local drive.
gmake IS still being called in the nested Makefiles.
I' ll try Rodney' s ' -d' suggestion a little later and see if I can get any info there.
|
|
|
RE: gcc problems with long command lines - Feb. 25, '04, 1:53:08 PM
|
|
|
markfunk
Posts: 670
Joined: Mar. 31, '03,
Status: offline
|
where are the header files located ? On a Windows or UNIX system ? how is the network filesystem mounted ? NFS, Samba, Microsoft NTFS ?
|
|
|
RE: gcc problems with long command lines - Feb. 25, '04, 2:25:26 PM
|
|
|
sadownir
Posts: 7
Joined: Feb. 25, '04,
Status: offline
|
The header and source files are on a Linux box that' s running Samba.
|
|
|
RE: gcc problems with long command lines - Feb. 25, '04, 5:26:05 PM
|
|
|
markfunk
Posts: 670
Joined: Mar. 31, '03,
Status: offline
|
Samba has always been a problem with Interix. It has alwyas been a hit or miss whether it works right.
The scenario you describe (running gcc twice on the same file where one time it work and the other time it does not is familiar)
What has happened in the past is that the access() system call fails randomly on include files on the network. Thus, gcc can' t find the header file.
Since you have SFU3.5, I' d suggest mounting the UNIX share using NFS instead of CIFS/SMB. See if that makes gcc more reliable.
|
|
|
RE: gcc problems with long command lines - Feb. 26, '04, 6:44:39 PM
|
|
|
sadownir
Posts: 7
Joined: Feb. 25, '04,
Status: offline
|
Rodney and Mark,
I believe we have multiple problems here. The first problem (illustrated via ' gmake -d' ) exposed that my Makefiles are considering the header files as targets
themselves. There should be an option or something
(that I currently don' t remember) that should stop this behavior as our system is set up to have all the " .h" files already checked out of RCS (so the system should NOT follow the implicit rule of doing a " co nnnn.h" if " RCS/nnnn.h,v" is newer. Due to users periodically
clobbering and restoring the RCS files (accidents happen), this condition exists, but is benign in our case. I vaguely recall a " .SCCS_GET:" target that if set as a null target would inhibit all " sccs get" ' s in your make. Anything similar for RCS and gmake to inhibit the " co" ' s?
The second problem is that my Makefiles make heavy usage of the " include filename" directive to include files that contain other important variable settings. gmake is also comparing the modification times of these included files to
" something" and either trying a " co filename" (and punching out for permission problems) or it punches out directly if the file " filename" has no RCS file. Again, I
want gmake to just take the included file as " golden" and
do not do any changes to it.
Mark may have hit on the third problem, namely that Samba is sometimes " hit or miss" . Unfortunately, for a variety
of reasons I can' t use NFS in this situation; so I can' t test if that would " make everything OK" .
|
|
|
RE: gcc problems with long command lines - Feb. 26, '04, 9:12:04 PM
|
|
|
markfunk
Posts: 670
Joined: Mar. 31, '03,
Status: offline
|
What system did your build process (ie Makefiles) live on before coming to Interix ? What make utility was being used before ? Was it gmake ? Or is gmake something new for you build process ?
I' m no gmake expert, but gmake isn' t supposed to do SCCS or RCS " get" s if the target file already exists.
You can always use " gmake -p -f /dev/null" to print out all the default rules so you can see all the pattern rules and the suffix rules. You can always define your own rules to override the defaults.
Also, gmake has the -r option to turn off all the built-in rules.
|
|
|
RE: gcc problems with long command lines - Feb. 27, '04, 8:48:09 AM
|
|
|
sadownir
Posts: 7
Joined: Feb. 25, '04,
Status: offline
|
Mark and Rodney, thanks for your help (I think I' m finally over the hump). Originally, this make system was running under Cygwin (using gmake), but the compiler/linker used was MSVC. This was done because all of our other apps (the ones not using X and Motif) use MSVC. For this app, we were using an old Interix Motif SDK that apparently was ported at Interix 2.0 or earlier (don' t have the box or the documentation). The nature of that port was that it COULD use the MSVC compiler/linker with the SDK to produce working code. With the advent of Interix 3.0, it appears that only gcc can be used with your Motif/OpenGL SDK to produce working binaries. Then I found that the " make" that ships with SFU 3.5 does not handle recursion under all cases, forcing a move to " gmake" .
The " gmake -p -f/dev/null" illustrated that gmake would do a " co" under a number of undesirable conditions. The " gmake -r" really cleaned things up. For now, I' ll live with the occasional missing " .h" file from Samba.
|
|
|
RE: gcc problems with long command lines - Feb. 27, '04, 10:22:49 AM
|
|
|
Rodney
Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
|
A bit of history trivia to fill in people' s understanding of the Life of Interix WRT sandownir' s last posting.
When OpenNT (the original name of Interix) started there was only the MSVC compiler. So the Motif 1.x SDK was created using MSVC. The Motif 1.X SDK was still valid for OpenNT/Interix 2.X (2.0, 2.1, 2.2). With Interix 3.0 (and now 3.5) gcc ships free. Since everyone has a copy of gcc this is the baseline compiler to use. So for Interix 3.X we used gcc for X11 and Motif and OpenGL. All have to be aligned because they build on-top of each other. Critically all use the API alloca() which allocates memory from the process' stack. Alloca() is a per compiler specific implementation because of the stack handling. So this is why sandownir' s comment about " only gcc can be used with Motif/OpenGL" ; it is also true with any X11 program.
If someone really, really needs X11, Motif and/or OpenGL to be compiled with MSVC contact us here at Interop.
Back to the topic:
I' d re-suggest what Mark has suggested: use NFS (which is included with 3.5) instead of SMB. This make clear up file access so that the make shipped with Interix will work fine. Or if you wish to stay with gmake. But in the long term NFS will be better.
|
|
|
RE: gcc problems with long command lines - Feb. 27, '04, 11:44:16 AM
|
|
|
markfunk
Posts: 670
Joined: Mar. 31, '03,
Status: offline
|
There is a way to use cc/c89 to compile X11 apps with X11 libraries.
The problem is that cc/c89 doesn' t add the default gcc compiler support function library to the list of default libraries/object files it should use when linking applications. This library is:
/opt/gcc.3.3/lib/gcc-lib/i586-pc-interix3/3.3/libgcc.a
You could add this library to your cc command line directly, ie:
cc -o xapp xapp.o ... -lXext -lX11 /opt/gcc.3.3/lib/gcc-lib/i586-pc-interix3/3.3/libgcc.a
OR you could put this library in the /bin/cc and /bin/c89 scripts, around lines 1166
quote:
... \
$(unixpath2win /opt/gcc.3.3/lib/gcc-lib/i586-pc-interix3/3.3/libgcc.a) \
$DEF_LIBRARIES ...
and add " -lgcc" on line 1160
quote:
# now add the default libraries
set -A cmd ... " -lgcc" " -lpsxdll"
|
|
|
RE: gcc problems with long command lines - Mar. 2, '04, 11:58:14 AM
|
|
|
sadownir
Posts: 7
Joined: Feb. 25, '04,
Status: offline
|
Thanks Mark for this important information. It was exactly what I was looking for.
A final word. Prior to reading your response, I tried my application code utilizing an NFS mount instead of Samba and I unfortunately got the same bad behavior (i.e. gmake noting random missing files and trying to generate their replacements). I then tried to compile one file by hand with " gcc" (thereby tring to eliminate whether the problem was " gmake" or " gcc" ) and the file did not compile (it couldn' t find a header that was necessary, but it found everything else). I had cut back the number of " -I" ' s to around 17 and the line length was around 720 characters; but there was still a problem. If you' d like, I can try to skinny down a test case for you. For now, I' ve reverted back to using MSVC and have successfully gotten my app to compile and link successfully. Thank you again for all your help.
|
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
|
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts |
|
|
|