optlink: file not found _CDMLINE (tango,wine)

Lutger lutger.blijdestijn at gmail.com
Tue Jan 29 16:34:08 PST 2008


Lars Ivar Igesund wrote:

> Lutger wrote:
> 
>> I've setup a windows version of dmd with phobos, tango and dsss on wine
>> (PcLinuxOS i686). dmd+phobos with dsss works fine, but with tango I get
>> this optlink error:
>> 
>> OPTLINK : Error 2: File Not Found _CMDLINE
>> --- errorlevel 1
>> 
>> After some google-fu, I found out that CMDLINE is used to pass long
>> arguments to the linker. After this however, I got stuck. Can anybody
>> help me out? Do I need to provide more information in order to make that
>> possible?
> 
> I saw a similar thing when I tested wine, maybe rebuild is doing the wrong
> thing there?
> 

Apparently it is an environment variable passed to link.exe. I found the
following snippet in link.c in both the rebuild and dmd source code. I'm
still not sure what is going on though:

#if _WIN32
int executecmd(char *cmd, char *args, int useenv)
{
    int status;
    char *buff;
    size_t len;

    if (!global.params.quiet || global.params.verbose)
    {
        printf("%s %s\n", cmd, args);
        fflush(stdout);
    }

    if ((len = strlen(args)) > 255)
    {   char *q;
        static char envname[] = "@_CMDLINE";

        envname[0] = '@';
        switch (useenv)
        {   case 0:     goto L1;
            case 2: envname[0] = '%';   break;
        }
        q = (char *) alloca(sizeof(envname) + len + 1);
        sprintf(q,"%s=%s", envname + 1, args);
        status = putenv(q);
        if (status == 0)
            args = envname;
        else
        {
        L1: 0;
            //error("command line length of %d is too long",len);
        }
    }

    status = executearg0(cmd,args);
#if _WIN32
    if (status == -1)
        status = spawnlp(0,cmd,cmd,args,NULL);
#endif
//    if (global.params.verbose)
//      printf("\n");
    if (status)
    {
        if (status == -1)
            printf("Can't run '%s', check PATH\n", cmd);
        else
            printf("--- errorlevel %d\n", status);
    }
    return status;
}
#endif


More information about the Digitalmars-d-learn mailing list