Author Topic: codeblocks/mingw/python and more  (Read 26363 times)

Offline reckless

  • Regular
  • ***
  • Posts: 338
codeblocks/mingw/python and more
« on: May 18, 2010, 10:36:50 am »
ftp://90.184.233.166:21/codeblocks-gcc-4.5.0-fixed-inline.7z

after some brainstorming in the development section here it is.

codeblocks with gcc-4.5.0 (wxwidgets now works)

included are python 2.5 (native) not the python from python.org ;) bit old but it works.

bzlib sqlite (above depends on these).

svn mico::corba (idl compiler) esnacc (asn1 compiler) gdb with python debugger and terminal.

libexpat (needed by gdb).

zlib (needed by allmost everything in this package).

openssl (needed by mico::corba).

gcc uses sysroots so if you wonder why theres an extra folder in the mingw dir thats why (only the crt libraries go here).

runtime is the one from mingw64 and executables compiled on this do not depend on the mingw dll to build completly static you need to pass -static-libstdc++ and -static-libgcc to the preprocessor.

ccache has been added.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: codeblocks/mingw/python and more
« Reply #1 on: May 18, 2010, 01:10:57 pm »
Nice!
Which gdb version did you use? 7.1?

BTW: the author of ccache said in their maillist, you should public the way ( or the patch ) to build ccache, because only the one from you works. the one from their links did not work.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline reckless

  • Regular
  • ***
  • Posts: 338
Re: codeblocks/mingw/python and more
« Reply #2 on: May 18, 2010, 08:46:01 pm »
gdb 7.1 :)

and ok ill see if i can dig up my changes to ccache :)

Offline reckless

  • Regular
  • ***
  • Posts: 338
Re: codeblocks/mingw/python and more
« Reply #3 on: May 18, 2010, 09:59:36 pm »
changes are mostly missing defines to the preprocessor ;)

rest are the official patches from site (i used the win32 createprocess patch and the typecheck for ccache name) needs an exe extension on windows else it goes fubar when invoked from cmd.

and a small patch to check for path delimiters \\ instead of / on win32.

created a small codeblocks project with the fixes included.

ftp://90.184.233.166:21/ccache-src.7z

the preprocessor variables are setup for windows :)

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: codeblocks/mingw/python and more
« Reply #4 on: May 19, 2010, 01:39:37 am »
Thanks, I have forward this post to ccache's mail list.  :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline reckless

  • Regular
  • ***
  • Posts: 338
Re: codeblocks/mingw/python and more
« Reply #5 on: May 19, 2010, 08:31:39 am »
glad to be of help :)

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: codeblocks/mingw/python and more
« Reply #6 on: May 19, 2010, 10:36:19 am »
ftp://90.184.233.166:21/ccache-src.7z
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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline reckless

  • Regular
  • ***
  • Posts: 338
Re: codeblocks/mingw/python and more
« Reply #7 on: May 19, 2010, 12:01:09 pm »
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.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: codeblocks/mingw/python and more
« Reply #8 on: May 19, 2010, 02:53:37 pm »
heh tbh i didnt remember i made that many changes svn dif seems to pull in all changes made since the project started.
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.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline reckless

  • Regular
  • ***
  • Posts: 338
Re: codeblocks/mingw/python and more
« Reply #9 on: May 19, 2010, 07:36:48 pm »
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 :)

Offline reckless

  • Regular
  • ***
  • Posts: 338
Re: codeblocks/mingw/python and more
« Reply #10 on: May 20, 2010, 01:59:28 am »
ftp://90.184.233.166:21/ccache-patches.zip

the patches i used i actually saved them for future work but they where burried on one of my large 1 terabyte drives (allmost impossible to find around in)  :lol:

these and this part -DHAVE_STRING_H -DHAVE_CTYPE_H -DHAVE_STDLIB_H -DHAVE_GETHOSTNAME and then adding ws2_32 lib and it should work right out of the box :)

actually just tried recreating it from scratch and everything seems to be working :).

Offline reckless

  • Regular
  • ***
  • Posts: 338
Re: codeblocks/mingw/python and more
« Reply #11 on: May 21, 2010, 03:22:37 am »
ftp://90.184.233.166:21/gcc-4.5.0-lto.7z

lto version just overwrite the gcc in mingw folder :)


Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline reckless

  • Regular
  • ***
  • Posts: 338
Re: codeblocks/mingw/python and more
« Reply #13 on: May 21, 2010, 09:55:56 pm »
coolio :)

btw i have a win32 version of bash (not from me but fixed a few bugs with newer mingw runtime) floating around for those interrested in using shellscripts with ccache on mingw (might also make it easier to implement).

it does not have full posix support (missing termios and tty) so forget running configure scripts but it works sufficiently with simple shell scripts like

#!/bin/bash

ccache gcc "$@"

yank in the tools from gnuwin32 coreutils and you pretty much have a minimal posix core system for use on windows :)

ftp://90.184.233.166:21/win-bash.7z


Offline reckless

  • Regular
  • ***
  • Posts: 338
Re: codeblocks/mingw/python and more
« Reply #14 on: May 22, 2010, 05:21:02 pm »
morten could you try testing this one ?

built a completly standalone version of codeblocks with no dependencies on mingw dll's (not even libgcc) :)

only dependency is wxwidget dll and standard windows runtimes.

ftp://90.184.233.166:21/codeblocks-svn-6261.7z