User forums > General (but related to Code::Blocks)

codeblocks/mingw/python and more

<< < (2/7) > >>

reckless:
glad to be of help :)

MortenMacFly:

--- Quote from: reckless on May 18, 2010, 09:59:36 pm ---ftp://90.184.233.166:21/ccache-src.7z

--- End quote ---
Could you also provide a patch to the SVN revision of ccache you've used  so that one can capture what you changed exactly, please?

simply do a:
svn diff > ccache.patch
...in the ccache (src) folder.

reckless:
ftp://90.184.233.166:21/ccache.diff

heh tbh i didnt remember i made that many changes svn dif seems to pull in all changes made since the project started.

MortenMacFly:

--- Quote from: reckless on May 19, 2010, 12:01:09 pm ---heh tbh i didnt remember i made that many changes svn dif seems to pull in all changes made since the project started.

--- End quote ---
Nope - what happened is that you changed the directory structure. It's no longer the one from SVN so basically your patch is invalid. :-(

You should do a clean checkout of cccache and re-apply your changes carefully. Then create a patch and keep it as record. Otherwise you've created a fork which will be impossible to merge back sooner or later.

reckless:
ah :(

well the patches are from here and mostly unmodified http://code.google.com/p/ccache-win32/issues/list

this is actually a win32 ccache but a few of the preprocessor variables where missing in the makefile so easy to fix ;)

basically it just adding -DHAVE_STRING_H -DHAVE_CTYPE_H -DHAVE_STDLIB_H -DHAVE_GETHOSTNAME and then adding ws2_32 to the libraries to link with :)

theres two versions of the patch to this function (static void failed(void))

the working one is this one

#ifdef _WIN32
    {
        PROCESS_INFORMATION pinfo;
        STARTUPINFO sinfo;
        BOOL ret;
        DWORD exitcode;
        char *args;
        extern char *argvtos(char **argv);

        ZeroMemory(&pinfo, sizeof(PROCESS_INFORMATION));
        ZeroMemory(&sinfo, sizeof(STARTUPINFO));
        sinfo.cb = sizeof(STARTUPINFO);
        sinfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
        sinfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
        sinfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
        sinfo.dwFlags |= STARTF_USESTDHANDLES;
        args = argvtos(orig_args->argv);
        ret = CreateProcessA(orig_args->argv[0], args, NULL, NULL, TRUE, 0, NULL, NULL, &sinfo, &pinfo);
        free(args);
        if (ret == 0)
        {
            cc_log("CreateProcessA failed\n");
            exit(1);
        }
        WaitForSingleObject(pinfo.hProcess, INFINITE);
        GetExitCodeProcess(pinfo.hProcess, &exitcode);
        CloseHandle(pinfo.hProcess);
        CloseHandle(pinfo.hThread);
        exit(exitcode);
    }
#else
    execv(orig_args->argv[0], orig_args->argv);
    cc_log("execv returned (%s)!\n", strerror(errno));
    perror(orig_args->argv[0]);
    exit(1);
#endif

the other uses a hacky mingw implementation that doesnt quite work.

full function below for visibility.

/*
  something went badly wrong - just execute the real compiler
*/
static void failed(void)
{
    char *e;

    /* delete intermediate pre-processor file if needed */
    if (i_tmpfile)
    {
        if (!direct_i_file)
        {
            unlink(i_tmpfile);
        }
        free(i_tmpfile);
        i_tmpfile = NULL;
    }

    /* delete the cpp stderr file if necessary */
    if (cpp_stderr)
    {
        unlink(cpp_stderr);
        free(cpp_stderr);
        cpp_stderr = NULL;
    }

    /* strip any local args */
    args_strip(orig_args, "--ccache-");

    if ((e=getenv("CCACHE_PREFIX")))
    {
        char *p = find_executable(e, MYNAME);
        if (!p && !(p = find_executable(e, MYNAME2)))
        {
            perror(e);
            exit(1);
        }
        args_add_prefix(orig_args, p);
    }
#ifdef _WIN32
    {
        PROCESS_INFORMATION pinfo;
        STARTUPINFO sinfo;
        BOOL ret;
        DWORD exitcode;
        char *args;
        extern char *argvtos(char **argv);

        ZeroMemory(&pinfo, sizeof(PROCESS_INFORMATION));
        ZeroMemory(&sinfo, sizeof(STARTUPINFO));
        sinfo.cb = sizeof(STARTUPINFO);
        sinfo.hStdError = GetStdHandle(STD_ERROR_HANDLE);
        sinfo.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
        sinfo.hStdInput = GetStdHandle(STD_INPUT_HANDLE);
        sinfo.dwFlags |= STARTF_USESTDHANDLES;
        args = argvtos(orig_args->argv);
        ret = CreateProcessA(orig_args->argv[0], args, NULL, NULL, TRUE, 0, NULL, NULL, &sinfo, &pinfo);
        free(args);
        if (ret == 0)
        {
            cc_log("CreateProcessA failed\n");
            exit(1);
        }
        WaitForSingleObject(pinfo.hProcess, INFINITE);
        GetExitCodeProcess(pinfo.hProcess, &exitcode);
        CloseHandle(pinfo.hProcess);
        CloseHandle(pinfo.hThread);
        exit(exitcode);
    }
#else
    execv(orig_args->argv[0], orig_args->argv);
    cc_log("execv returned (%s)!\n", strerror(errno));
    perror(orig_args->argv[0]);
    exit(1);
#endif
}

hope it helps :)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version