GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 27-Sep-2004, 03:53
wavez wavez is offline
New Member
 
Join Date: Sep 2004
Posts: 4
wavez is on a distinguished road

PATH points to nonexistent dir


Hi, I'm using SCons and MS's free compiler. I've followed someones instructions for acquiring all the needed resources. SCons invokes lib.exe, which is getting false path info. Below I'm going to list lib.exe's code, what it prints when it fails (showing the path it sees), and what my PATH is set to (when I say 'path' at the prompt).

(this is someone elses code, I did not write it)
CPP / C++ / C Code:
/*
 * lib.c
 *
 * simulate missing lib.exe by calling link.exe /lib
 */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

static int
findInPath (
    char * fullpath,
    const char * executable)
{
    const char * pathvar = getenv ("PATH");
    const char * dirstart = pathvar;
    const char * dirend;
    int          dirlen;
    FILE       * dummy;

    if (pathvar == NULL) {
        return 0;
    }
    while (dirstart [0] != '\0') {
        dirend = strchr (dirstart, ';');
        if (dirend == NULL) {
            dirlen = strlen (dirstart);
        }
        else {
            dirlen = dirend - dirstart;
        }
        sprintf (fullpath, "%.*s\\%s", dirlen, dirstart, executable);
        dummy = fopen (fullpath, "rb");
        if (dummy != NULL) {
            fclose (dummy);
            return 1;
        }
        if (dirend == NULL) {
            return 0;
        }
        dirstart = dirend + 1;
    }
    return 0;
}

int main (
    int argc,
    const char ** argv)
{
    char fullpath [255];
    char ** newargs;
    if (!findInPath (fullpath, "link.exe")) {
        fprintf (stderr, "\nlib.exe: link.exe not found in:\n\n %s\n\n", getenv ("PATH") );
        exit (2);
    }
    newargs = calloc (argc + 2, sizeof (char*));
    if (newargs == NULL) {
        fprintf (stderr, "lib.exe: allocation of arguments failed\n");
        exit (2);
    }
    memcpy (newargs + 2, argv + 1, (argc - 1) * sizeof (char *));
    newargs [0] = "link.exe";
    newargs [1] = "/lib";
    execv (fullpath, newargs);
}

lib.exe outputs:
Quote:
C:\Program Files\Microsoft Visual Studio\Common\tools\WINNT;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\bin;C:\Program Files\Microsoft Visual Studio\Common\tools;C:\Program Files\Microsoft Visual Studio\VC98\bin
What makes this so interesting is that I don't have a "C:\Program Files\Microsoft Visual Studio\". However, I do have "\Microsoft Visual Studio 8\", and "\Microsoft Visual Studio .NET 2003\".

My PATH is set to:
Quote:
C:\Program Files\BlenderCVS\blender>path
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Sys tem32\Wbem;C:\Program Files\Common Files\GTK\2.0\bin\.;C:\Program Files\MSVC++TK\bin\.;C:\Program Files\MS-PSDK-XP-SP2\Bin\.;C:\Program Files\MS-PSDK-XP-SP2\Bin\WinNT\.;C:\Python23;C:\Program Files\MS-PSDK-XP-SP2\Bin\.;C:\Program Files\MS-PSDK-XP-SP2\Bin\WinNT\.;C:\Program Files\MSVC++TK\bin\.
You might notice that a lot of those paths end with a "\.". A lot of the paths--that were already there before I had ever added anything--had that, and I don't know what it does. I've tried removing it and putting it back so many times that I can't remember which paths had it in the first place. What does the "\." do?

Most important question I have is this: What is going on here??? As you can see from my path quote, I have my paths set correctly in the 'Environment Variables' section of 'My Computer's' advanced properties. I've learned from messing with this that I DO have to log out and log back in to get the System Variables to update after making changes, so that's not an issue. It seems pretty clear to me; lib.exe is getting it's path info from some source other than the so-called "Environment Variables".

Thanks
  #2  
Old 27-Sep-2004, 05:14
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 1,032
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
I think the MSVC 6.0 paths are used by default if no version of MSVC is detected (but Microsoft's "tool" is specified). I can't figure out however why it doesn't detect it, if you say the .NET version is installed

Maybe you should check you have the latest version of SCons... I think I read somewhere (don't remember where - I don't have any SCons experience, I was just curious about it....) that an older version of SCons used the env. values in the registry *only* if include, lib and path were all set in the registry.

Hope this helps a little bit...

Kind regards,
Luci
__________________
Please read these Guidelines before posting on the forum

"A person who never made a mistake never tried anything new."
Einstein
  #3  
Old 27-Sep-2004, 05:56
wavez wavez is offline
New Member
 
Join Date: Sep 2004
Posts: 4
wavez is on a distinguished road
Good idea, but lib.exe isn't a part of scons. I don't know, maybe scons passes the data to lib.exe? Actually, you could be right, because I've had trouble getting scons to find exectuables that are in the path. A friend of mine came up with a work around involving bat files. I'd still like to find and elimanate whatever is creating that false path.
  #4  
Old 27-Sep-2004, 09:04
wavez wavez is offline
New Member
 
Join Date: Sep 2004
Posts: 4
wavez is on a distinguished road
Well after some more exhaustive testing with irc friend, he thinks it's all scons fault. I'm inclined to agree with him, but the guy that turned me on to MS's free compiler has scons working on his XP machine, but he has SP1

He says he doesn't do updates.
  #5  
Old 27-Sep-2004, 09:12
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 5,217
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold
Quote:
Originally Posted by wavez
Good idea, but lib.exe isn't a part of scons. I don't know, maybe scons passes the data to lib.exe? Actually, you could be right, because I've had trouble getting scons to find exectuables that are in the path. A friend of mine came up with a work around involving bat files. I'd still like to find and elimanate whatever is creating that false path.


A mystery!

Put a couple of printf() statements in findInPath. Something like
CPP / C++ / C Code:
   printf("Debug: pathvar = <%s>\n", pathvar);
    printf("Debug: dirstart = <%s>\n", dirstart);
    while (dirstart [0] != '\0') {
        printf("dirstart[0] = %c <0x%02x>\n", dirstart [0], dirstart[0]);
        dirend = strchr (dirstart, ';');

This will tell you what path it is actually searching, I think.

Regards,

Dave
  #6  
Old 06-Oct-2004, 04:04
wavez wavez is offline
New Member
 
Join Date: Sep 2004
Posts: 4
wavez is on a distinguished road
sorry about this. It's some kind of error with scons on windows XP when MSVS is detected. I found a bug report about it, and there's no workaround. I tried an older version, but the problem persisted, so I'm probably going to try pre 9.5 next. I've just been too lazy to mess with it lately.
 
 

Recent GIDBlogAccepted for Ph.D. program by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
shortest path algorithm and file saving Pandiani C++ Forum 10 17-Jul-2006 11:46
[PROGRAM] Windows Search Program machinated C++ Forum 10 21-Jun-2004 16:21
displaying array of points Nelly C++ Forum 0 26-May-2004 06:29
FAQ - Challenger Forum JdS Learning Journal by J de Silva 0 11-May-2002 03:28

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 04:21.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.