The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   OS X Developer (http://hintsforums.macworld.com/forumdisplay.php?f=27)
-   -   Project Builder path problem (http://hintsforums.macworld.com/showthread.php?t=12414)

tar heel 06-05-2003 09:34 PM

Project Builder path problem
 
I'm having trouble getting started developing software with Project Builder on the Mac and sure could use some help! In particular, when trying to build even the simplest app (just an empty window), the build fails because it can't even find "/bin/rm" or "/bin/mktemp".

I am able to compile the project from a terminal window (tcsh shell) with the "pbxbuild" command, and afterwards I can run from Project Builder. It looks to me like some of the system variables are hosed; ~10 yrs. programming under SunOS and linux, but a complete newbie in Mac's OS-X and at a loss of how to troubleshoot.

Any help greatly appreciated!

Thanks,
Jon


_____________________

/Developer/Private/jam -d1 -j2 JAMBASE=/Developer/Makefiles/pbx_jamfiles/ProjectBuilderJambase JAMFILE=- build ACTION=build _DEFAULT_GCC_VERSION=3.1 BUILD_STYLE=Development CPP_HEADERMAP_FILE=/Users/owenj/Nothing/build/Nothing.build/Nothing.build/Nothing.hmap SRCROOT=/Users/owenj/Nothing OBJROOT=/Users/owenj/Nothing/build SYMROOT=/Users/owenj/Nothing/build DSTROOT=/tmp/Nothing.dst

Mkdir /Users/owenj/Nothing/build/Nothing.app
/bin/mkdir -p /Users/owenj/Nothing/build/Nothing.app

Mkdir /Users/owenj/Nothing/build/Nothing.build/Nothing.build/PrefixHeaders
/bin/mkdir -p /Users/owenj/Nothing/build/Nothing.build/Nothing.build/PrefixHeaders

Mkdir /Users/owenj/Nothing/build/Nothing.app/Contents/Resources
/bin/mkdir -p /Users/owenj/Nothing/build/Nothing.app/Contents/Resources

MakePFEFile /Users/owenj/Nothing/build/Nothing.build/Nothing.build/PrefixHeaders/Nothing_Prefix-ppc.pfe
for _c_dialect in objective-c ; do if [ ${_c_dialect} == c -o ${_c_dialect} == objective-c ] ; then dummy_file=`mktemp /tmp/.null-XXXXXXXX`; /usr/bin/gcc3 -c -x ${_c_dialect} -F/Users/owenj/Nothing/build -I/Users/owenj/Nothing/build/include -arch ppc -fno-common -fpascal-strings -O0 -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -mdynamic-no-pic -pipe "-fmessage-length=0" -g -Wp,-header-mapfile,/Users/owenj/Nothing/build/Nothing.build/Nothing.build/Nothing.hmap -I/Users/owenj/Nothing /Users/owenj/Nothing/Nothing_Prefix.h -o ${dummy_file} --dump-pch /Users/owenj/Nothing/build/Nothing.build/Nothing.build/PrefixHeaders/Nothing_Prefix-ppc.pfe ; exit_code=$? ; rm ${dummy_file} ; if [ ${exit_code} != 0 ] ; then rm -r /Users/owenj/Nothing/build/Nothing.build/Nothing.build/PrefixHeaders/Nothing_Prefix-ppc.pfe ; exit ${exit_code} ; fi ; fi ; done
/bin/sh: mktemp: command not found
gcc3: cannot specify -o with -c or -S and multiple compilations
/bin/sh: rm: command not found
/bin/sh: rm: command not found

Mkdir /Users/owenj/Nothing/build/Nothing.app/Contents/Resources/English.lproj
/bin/mkdir -p /Users/owenj/Nothing/build/Nothing.app/Contents/Resources/English.lproj

PBXCp /Users/owenj/Nothing/build/Nothing.app/Contents/Resources/English.lproj/MainMenu.nib
/Developer/Tools/pbxcp -exclude .DS_Store -exclude CVS -resolve-src-symlinks English.lproj/MainMenu.nib /Users/owenj/Nothing/build/Nothing.app/Contents/Resources/English.lproj

PBXCp /Users/owenj/Nothing/build/Nothing.app/Contents/Resources/English.lproj/InfoPlist.strings
/Developer/Tools/pbxcp -exclude .DS_Store -exclude CVS -resolve-src-symlinks English.lproj/InfoPlist.strings /Users/owenj/Nothing/build/Nothing.app/Contents/Resources/English.lproj
...failed MakePFEFile /Users/owenj/Nothing/build/Nothing.build/Nothing.build/PrefixHeaders/Nothing_Prefix-ppc.pfe ...

blb 06-05-2003 11:36 PM

That's odd...first things first, which version of the OS and which version of PB?

sao 06-06-2003 03:21 AM

tar heel,

Are you sure you installed the BSD Subsystem when installing OSX?

Code:

Sao  @ ~  $ grepbom mktemp
........../usr/bin/mktemp      14,268  Sun Jul 28 10:57:41 2002
./usr/share/man/man1/mktemp.1  5,700  Sun Jul 14 18:55:19 2002
  ====> /Library/Receipts/BSD.pkg/Contents/Archive.bom


../usr/share/man/man3/mktemp.3  6,360  Tue Nov  5 13:27:30 2002
  ====> /Library/Receipts/BSDSDK.pkg/Contents/Archive.bom


...../usr/share/man/man3/mktemp.3      6,360  Tue Nov  5 13:27:30 2002
  ====> /Library/Receipts/DevDocumentation.pkg/Contents/Archive.bom


.............................................................

If you did, probably something went wrong, maybe you try reinstalling the BSD package from the Installer CD?

blb 06-06-2003 03:47 PM

sao, that's what I thought at first, but the error about rm (which is in Base) is what confused me...

tar heel 06-07-2003 06:47 AM

sao and bib,

I'm not familiar wit the "grepbom" command, and it doesn't seem to be installed (or in my path)... Should this be installed by default?

The target machine is a dual 1Ghz G4 tower (Jan 03), currently running 10.2.6 with Project Builder version 2.1.

From the terminal command line, there is no problem finding rm or mktemp from either the tcsh (my default shell) or from the sh shell:

tcsh% which rm
/bin/rm
tcsh% which mktemp
/usr/bin/mktemp
tcsh% printenv PATH
/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/teTeX/bin/powerpc-apple-darwin-current:/usr/local/bin
tcsh% sh
sh-2.05a$ which rm
/bin/rm
sh-2.05a$ which mktemp
/usr/bin/mktemp
sh-2.05a$ printenv PATH
/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/teTeX/bin/powerpc-apple-darwin-current:/usr/local/bin

My only guess is that the PATH environment variable being used by Project Builder doesn't include /usr/bin, but I don't know how to check that (or where to fix if neeed).

Thanks,
Jon

hayne 06-07-2003 01:01 PM

ProjectBuilderJambase file
 
The file that governs the build process is ProjectBuilderJambase in the directory /Developer/Makefiles/pbx_jamfiles

I would try editing that file to add some debugging commands (e.g. echo $PATH) at the start of the "actions MakePFEFile".

Of course, save a copy of this file before editing it.

blb 06-07-2003 04:28 PM

Also, are you setting PATH in ~/.MacOSX/environment.plist ?

tar heel 06-07-2003 04:51 PM

Following hayne's suggestion, I echoed the PATH from "actions MakePFEFile", and it looks like the only directory in the path is /usr/local/bin.

Q: When the sh shell is launched from a GUI app, how does it build it's path? The path in /etc/profile is more complete but doesn't include /usr/local/bin:

> PATH="/bin:/sbin:/usr/bin:/usr/sbin"

Also, I don't have a .MacOSX subdirectory in my homedir; should this have been automatically created? (I'm fumbling my way around OS X, and haven't figured out all of the differences with other UNIX environments).

Thanks,
Jon

hayne 06-07-2003 05:40 PM

shell startup files
 
Quote:

Originally posted by tar heel
Q: When the sh shell is launched from a GUI app, how does it build it's path? The path in /etc/profile is more complete but doesn't include /usr/local/bin:
> PATH="/bin:/sbin:/usr/bin:/usr/sbin"
The shells (tcsh, sh, etc) do not automatically set up their PATH at all. What they do is read and execute certain startup files. In the case of /bin/sh, it reads /etc/profile and then (if it exists) ~/.profile and executes the commands in those files. In the case of /bin/tcsh, it is /etc/csh.cshrc and /etc/csh.login and then (if it exists) ~/.tcshrc or ~/.cshrc
But what I have said above only applies to "login shells" - a shell started up outside the context of another shell. (e.g. the shell started by Project Builder).

For shells started by invoking their name inside an already running shell (e.g. in Terminal when you type 'sh'), the environment is inherited from the parent shell. The tcsh shell reads /etc/csh.cshrc and ~/.tcshrc or ~/.cshrc
But the Bourne shell (sh) does not read any files in this case unless you have the variable ENV set - in which case it reads from the file pointed to by that variable.
Note: for debugging purposes, I recommend inserting an 'echo' command in each of the above named startup files so you can see when they get executed and in what order. E.g. "echo now executing /etc/profile"

All of which leads to the question:
Do you have a file ~/.profile and what is in it? I suspect there is a line setting the PATH to /usr/local/bin

Quote:

Also, I don't have a .MacOSX subdirectory in my homedir; should this have been automatically created?
No - it is something that you need to create if you want it. It is not necessary unless you need to set some environment variables to be used in the GUI apps that are started by loginwindow (e.g. Finder and anything you start via Finder) It is not really necessary for you.

tar heel 06-07-2003 05:50 PM

No ".profile" in my home directory, just a .cshrc (which diesn't set the path, only my prompt and a few aliases).

Any other ideas?

Thanks,
Jon

yellow 06-07-2003 06:01 PM

Create yourself a .login in your home directory. You can specify what you want your paths to be whenever a new xterm (not in Apple's X11 beta oddly)/Terminal is opened. I'd comment out your fink sourcing in your .tcshrc/.cshrc if you follow what I've got.

Mine looks like this:
Code:

setenv PATH "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin"
source /sw/bin/init.csh


mervTormel 06-07-2003 06:07 PM

Re: shell startup files
 
Quote:

Originally posted by hayne
...But the Bourne shell (sh) does not read any files in this case unless you have the variable ENV set - in which case it reads from the file pointed to by that variable.
Note: for debugging purposes, I recommend inserting an 'echo' command in each of the above named startup files so you can see when they get executed and in what order. E.g. "echo now executing /etc/profile"...
au contraire! and what yellow said.

Code:

$ echo $ENV


$ bash -xv
# file: ~/.bashrc

#source /usr/share/init/bash/rc

umask 077  # file creation mask; created files are -rw-------
+ umask 077

trap "source ~/.bash_logout" 0
+ trap 'source ~/.bash_logout' 0

# bash completion thingys

COMP_CONFIGURE_HINTS=true
+ COMP_CONFIGURE_HINTS=true
...


hayne 06-07-2003 06:07 PM

which sh ?
 
Well, I don't know how your 'sh' in PB is getting its bad path.

One more thing you could do is to put in more debugging statements in the PB jam file to echo things like 'which sh' to tell you what shell you are using. But if PATH is /usr/local/bin as you have said, then presumably it is finding a 'sh' in that directory. ??
Is there a /usr/local/bin/sh ?
There shouldn't be.

hayne 06-07-2003 06:10 PM

ktrace
 
If you have exhausted all easier suggestions, here is one more idea. It is rather heavyweight, but you could try using 'ktrace' to look at exactly what PB is doing, especially what files it is reading.

You run 'ktrace' from the command-line, giving it the name of the executable you want to run - in this case: /Developer/Applications/Project\ Builder.app/Contents/MacOS/Project\ Builder
It writes a file "ktrace.out" in the current directory. You read this file using 'kdump' - e.g. 'kdump | more' or 'kdump > some_file'

Look for the files that are opened by PB - their contents will be listed as part of the output. But I don't know if ktrace will trace what is done by sub-processes like the 'sh' in this case. Maybe have a look at 'man ktrace' to see.

tar heel 06-07-2003 06:11 PM

Re: Project Builder path problem
 
Quote:

Originally posted by tar heel
/bin/sh: mktemp: command not found
gcc3: cannot specify -o with -c or -S and multiple compilations
/bin/sh: rm: command not found
/bin/sh: rm: command not found
It's finding the shell since the complete path is given.

tar heel 06-07-2003 06:22 PM

ktrace doesn't seem to be much help, as it seems to be inheriting my PATH from the terminal.

Launching Project Builder via GUI yields

> ======================================================================
> [JHO] echo PATH:
> /usr/local/bin
> ======================================================================
> /bin/sh: mktemp: command not found
> gcc3: cannot specify -o with -c or -S and multiple compilations
> /bin/sh: rm: command not found
> /bin/sh: rm: command not found

while launching via a terminal window (w/ or w/out ktrace) works fine:

> ======================================================================
> [JHO] echo PATH:
> /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/teTeX/bin/powerpc-apple-darwin-current:/usr/local/bin:/usr/local/bin
> ======================================================================

hayne 06-07-2003 06:24 PM

Re: Re: Project Builder path problem
 
Quote:

Originally posted by tar heel
It's finding the shell since the complete path is given.
I see - you mean that the error message is seemingly coming from /bin/sh so that means that the backticks (`mktemp /tmp/.null-XXXXXXXX`) must be running /bin/sh.
But that doesn't say anything about the PATH - I think backticks may be hardcoded to run /bin/sh. And mktemp is in /usr/bin

hayne 06-07-2003 06:33 PM

bash versus sh
 
Quote:

Originally posted by mervTormel
au contraire!
I was talking about what startup files are executed by /bin/sh. My statements were derived from the 'sh' man page and from an examination of the output from 'ktrace /bin/sh' in the Terminal. /bin/sh does not look at ~/.profile or ~/.bashrc when invoked from the Terminal.

Evidently /bin/bash runs a different set of startup files (even though the executables /bin/sh & /bin/bash are identical - it looks at what name it is invoked with). Indeed 'ktrace /bin/bash' shows it trying to open the file ~/.bashrc.

mervTormel 06-07-2003 06:42 PM

Re: bash versus sh
 
Quote:

Originally posted by hayne
I was talking about what startup files are executed by /bin/sh...
ah, i see.

yellow 06-07-2003 08:00 PM

[yellow != coder/scripter]

Err... I think I have a (the?) solution to this.. what don't you have the absolute paths in the code? You're getting errors on mktemp and rm because the command isn't found, but in the code it's not /usr/bin/mktemp and /bin/rm, it's just mktemp and rm. Wouldn't putting absolute paths take care of this? I know I always do in any shell scripts I am forced (at gun point) to write.


All times are GMT -5. The time now is 05:47 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.