Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

gcc-4.6.1 builds availiable

<< < (5/8) > >>

ollydbg:
1, cb-setup.exe, it was 1G size, I guess no body would like to download this beast :D.
2, Need some detail description about your packages on your C::B advanced / Home / Home
3, about your patch on mingw. I can't test that because I only have 32 bit windows. but reading the patch, I think that you have 32bit compiler installed MinGW32/bin and 64bit compiler installed in MinGW64/bin. then it seems you just hard coded the source to distinguish those two compilers, this is not quite flexible. :D

reckless:
yep its quite a beast but so is msvc 2010 ;) its a complete development environment.

atleast im going to provide plugins and sdk's as standalone zip's :) i made this for ease of use for people who are not used to working with a gcc compiler.

and aye the patch works for mingw32 i havent magically ported C::B to 64 bit (no need either since 64 bit win handles 32 bit quite fine).

as for hardcoded hmm well its allready hardcoded in the standard source to some degree as in if mingw is not installed with C::B then it looks in C:\\MinGW (or it gets the path from mingw's ini file)
and in Dev-Cpp dir it seems but atleast it does that from a registry key so that part is portable.  i could maybe use a similar approach to the ini read but then the installer will have to be modified to write the
correct values to an ini.

im not to satisfied with how i made it but still learning C++ (im used to pure C) so it might take me some time to come up with a better way.

atm i use wx's 64 bit OS check to set the 64 bit mingw compiler (it works) but some might want to use the 32 bit mingw on say win 7 64 and in that case it fails but i suspect i could make an option to select either one.

any help in that regard is most welcome.

xunxun:

--- Quote from: ollydbg on August 15, 2011, 03:45:38 am --- it was 1G size, I guess no body would like to download this

--- End quote ---
I think reckless built the tools using LTO, so the package is very large.
At the another point, we can mix LTO and PGO to build it, according to my test, PGO can reduce the package's size strikingly.
But building with PGO can cost very long time and there are some bugs when mixing LTO and PGO, for avoiding the errors, we must guarantee that the PGO information is gathered only once.

xunxun:

--- Quote from: reckless on August 15, 2011, 04:52:59 am ---atm i use wx's 64 bit OS check to set the 64 bit mingw compiler (it works) but some might want to use the 32 bit mingw on say win 7 64 and in that case it fails but i suspect i could make an option to select either one.

--- End quote ---
You can release the 32bit package and the 64bit package.
I think mixing 32bit and 64bit package is not a good idea.

reckless:
there not mixed in fact that is what im trying to avoid at all cost ;) as that would indeed screw things up badly.


--- Code: ---void CompilerMINGW::Reset()
{
/* yep its windose */
    if (platform::windows)
    {
/* checking OS is it 64 bit ? */
        if (wxIsPlatform64Bit())
        {
/* we got a 64 bit OS set the MinGW 64 compiler */
            m_Programs.C         = _T("x86_64-w64-mingw32-gcc.exe");
            m_Programs.CPP       = _T("x86_64-w64-mingw32-g++.exe");
            m_Programs.LD        = _T("x86_64-w64-mingw32-g++.exe");
            m_Programs.DBG       = _T("gdb.exe");
            m_Programs.LIB       = _T("ar.exe");
            m_Programs.WINDRES   = _T("windres.exe");
            m_Programs.MAKE      = _T("winmake.exe");
        }
        else
        {
/* 32 bit OS set the MinGW32 compiler */
            m_Programs.C         = _T("i686-w64-mingw32-gcc.exe");
            m_Programs.CPP       = _T("i686-w64-mingw32-g++.exe");
            m_Programs.LD        = _T("i686-w64-mingw32-g++.exe");
            m_Programs.DBG       = _T("gdb.exe");
            m_Programs.LIB       = _T("ar.exe");
            m_Programs.WINDRES   = _T("windres.exe");
            m_Programs.MAKE      = _T("winmake.exe");
        }
/* heh and now it gets hairy cause i just destroyed the check for the standard MinGW compiler :( */
    }
    else
    {
        m_Programs.C         = _T("gcc");
        m_Programs.CPP       = _T("g++");
        m_Programs.LD        = _T("g++");
        m_Programs.DBG       = _T("gdb");
        m_Programs.LIB       = _T("ar");
        m_Programs.WINDRES   = _T("");
        m_Programs.MAKE      = _T("make");
    }
    m_Switches.includeDirs             = _T("-I");
    m_Switches.libDirs                 = _T("-L");
    m_Switches.linkLibs                = _T("-l");
    m_Switches.defines                 = _T("-D");
    m_Switches.genericSwitch           = _T("-");
    m_Switches.objectExtension         = _T("o");
    m_Switches.needDependencies        = true;
    m_Switches.forceCompilerUseQuotes  = false;
    m_Switches.forceLinkerUseQuotes    = false;
    m_Switches.logging                 = clogSimple;
    m_Switches.libPrefix               = _T("lib");
    m_Switches.libExtension            = _T("a");
    m_Switches.linkerNeedsLibPrefix    = false;
    m_Switches.linkerNeedsLibExtension = false;
    m_Switches.supportsPCH             = true;
    m_Switches.PCHExtension            = _T("h.gch");
    m_Switches.UseFullSourcePaths      = true; // use the GDB workaround !!!!!!!!

    // Summary of GCC options: http://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html

    m_Options.ClearOptions();
    m_Options.AddOption(_("Produce debugging symbols"),
                _T("-g"),
                _("Debugging"),
                _T(""),
                true,
                _T("-O -O1 -O2 -O3 -Os"),
                _("You have optimizations enabled. This is Not A Good Thing(tm) when producing debugging symbols..."));
    wxString gprof_link = _T("-pg");
    if (platform::windows)
        gprof_link = _T("-pg -lgmon");
    m_Options.AddOption(_("Profile code when executed"), _T("-pg"), _("Profiling"), gprof_link);

    wxString category = _("Warnings");

    // warnings
    m_Options.AddOption(_("In C mode, support all ISO C90 programs. In C++ mode, remove GNU extensions that conflict with ISO C++"), _T("-ansi"), category);
    m_Options.AddOption(_("Enable all compiler warnings (overrides many other settings)"), _T("-Wall"), category);
    m_Options.AddOption(_("Enable extra compiler warnings"), _T("-Wextra"), category);
    m_Options.AddOption(_("Stop compiling after first error"), _T("-Wfatal-errors"), category);
    m_Options.AddOption(_("Inhibit all warning messages"), _T("-w"), category);
    m_Options.AddOption(_("Have g++ follow the 1998 ISO C++ language standard"), _T("-std=c++98"), category);
    m_Options.AddOption(_("Have g++ follow the coming C++0x ISO C++ language standard"), _T("-std=c++0x"), category);
    m_Options.AddOption(_("Enable warnings demanded by strict ISO C and ISO C++"), _T("-pedantic"), category);
    m_Options.AddOption(_("Treat as errors the warnings demanded by strict ISO C and ISO C++"), _T("-pedantic-errors"), category);
    m_Options.AddOption(_("Warn if main() is not conformant"), _T("-Wmain"), category);
    m_Options.AddOption(_("Enable Effective-C++ warnings (thanks Scott Meyers)"), _T("-Weffc++"), category);
    m_Options.AddOption(_("Warn whenever a switch statement does not have a default case"), _T("-Wswitch-default"), category);
    m_Options.AddOption(_("Warn whenever a switch statement has an index of enumerated type and lacks a case for one or more of the named codes of that enumeration"), _T("-Wswitch-enum"), category);
    m_Options.AddOption(_("Warn if a user supplied include directory does not exist"), _T("-Wmissing-include-dirs"), category);
    m_Options.AddOption(_("Warn if a global function is defined without a previous declaration"), _T("-Wmissing-declarations"), category);
    m_Options.AddOption(_("Warn if the compiler detects that code will never be executed"), _T("-Wunreachable-code"), category);
    m_Options.AddOption(_("Warn if a function can not be inlined and it was declared as inline"), _T("-Winline"), category);
    m_Options.AddOption(_("Warn if floating point values are used in equality comparisons"), _T("-Wfloat-equal"), category);
    m_Options.AddOption(_("Warn if an undefined identifier is evaluated in an '#if' directive"), _T("-Wundef"), category);
    m_Options.AddOption(_("Warn whenever a pointer is cast such that the required alignment of the target is increased"), _T("-Wcast-align"), category);
    m_Options.AddOption(_("Warn if anything is declared more than once in the same scope"), _T("-Wredundant-decls"), category);
    m_Options.AddOption(_("Warn about unitialized variables which are initialized with themselves"), _T("-Winit-self"), category);
    m_Options.AddOption(_("Warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed"), _T("-Wshadow"), category);

    // optimization
    category = _("Optimization");
    m_Options.AddOption(_("Strip all symbols from binary (minimizes size)"), _T(""), category, _T("-s"), true, _T("-g -ggdb"), _("Stripping the binary will strip debugging symbols as well!"));
    m_Options.AddOption(_("Optimize generated code (for speed)"), _T("-O"), category);
    m_Options.AddOption(_("Optimize more (for speed)"), _T("-O1"), category);
    m_Options.AddOption(_("Optimize even more (for speed)"), _T("-O2"), category);
    m_Options.AddOption(_("Optimize fully (for speed)"), _T("-O3"), category);
    m_Options.AddOption(_("Optimize generated code (for size)"), _T("-Os"), category);
    m_Options.AddOption(_("Expensive optimizations"), _T("-fexpensive-optimizations"), category);
    m_Options.AddOption(_("Don't keep the frame pointer in a register for functions that don't need one"), _T("-fomit-frame-pointer"), category);
    // machine dependent options - cpu arch
    category = _("CPU architecture tuning (choose none, or only one of these)");
    m_Options.AddOption(_("i386"), _T("-march=i386"), category);
    m_Options.AddOption(_("i486"), _T("-march=i486"), category);
    m_Options.AddOption(_("Intel Pentium"), _T("-march=i586"), category);
    m_Options.AddOption(_("Intel Pentium (MMX)"), _T("-march=pentium-mmx"), category);
    m_Options.AddOption(_("Intel Pentium PRO"), _T("-march=i686"), category);
    m_Options.AddOption(_("Intel Pentium 2 (MMX)"), _T("-march=pentium2"), category);
    m_Options.AddOption(_("Intel Pentium 3 (MMX, SSE)"), _T("-march=pentium3"), category);
    m_Options.AddOption(_("Intel Pentium 4 (MMX, SSE, SSE2)"), _T("-march=pentium4"), category);
    m_Options.AddOption(_("Intel Pentium 4 Prescott (MMX, SSE, SSE2, SSE3)"), _T("-march=prescott"), category);
    m_Options.AddOption(_("Intel Pentium 4 Nocona (MMX, SSE, SSE2, SSE3, 64bit extensions)"), _T("-march=nocona"), category);
    m_Options.AddOption(_("Intel Pentium M (MMX, SSE, SSE2)"), _T("-march=pentium-m"), category);
    m_Options.AddOption(_("Intel Core2 (MMX, SSE, SSE2, SSE3, SSSE3, 64bit extensions)"), _T("-march=core2"), category);
m_Options.AddOption(_("Intel Corei7 (MMX, SSE, SSE2, SSE3, SSSE3, 64bit extensions)"), _T("-march=corei7"), category);
    m_Options.AddOption(_("AMD K6 (MMX)"), _T("-march=k6"), category);
    m_Options.AddOption(_("AMD K6-2 (MMX, 3DNow!)"), _T("-march=k6-2"), category);
    m_Options.AddOption(_("AMD K6-3 (MMX, 3DNow!)"), _T("-march=k6-3"), category);
    m_Options.AddOption(_("AMD Athlon (MMX, 3DNow!, enhanced 3DNow!, SSE prefetch)"), _T("-march=athlon"), category);
    m_Options.AddOption(_("AMD Athlon Thunderbird (MMX, 3DNow!, enhanced 3DNow!, SSE prefetch)"), _T("-march=athlon-tbird"), category);
    m_Options.AddOption(_("AMD Athlon 4 (MMX, 3DNow!, enhanced 3DNow!, full SSE)"), _T("-march=athlon-4"), category);
    m_Options.AddOption(_("AMD Athlon XP (MMX, 3DNow!, enhanced 3DNow!, full SSE)"), _T("-march=athlon-xp"), category);
    m_Options.AddOption(_("AMD Athlon MP (MMX, 3DNow!, enhanced 3DNow!, full SSE)"), _T("-march=athlon-mp"), category);
    m_Options.AddOption(_("AMD K8 core (x86-64 instruction set)"), _T("-march=k8"), category);
    m_Options.AddOption(_("AMD Opteron (x86-64 instruction set)"), _T("-march=opteron"), category);
    m_Options.AddOption(_("AMD Athlon64 (x86-64 instruction set)"), _T("-march=athlon64"), category);
    m_Options.AddOption(_("AMD Athlon-FX (x86-64 instruction set)"), _T("-march=athlon-fx"), category);

    m_Commands[(int)ctCompileObjectCmd].push_back(CompilerTool(_T("$compiler $options $includes -c $file -o $object")));
    m_Commands[(int)ctGenDependenciesCmd].push_back(CompilerTool(_T("$compiler -MM $options -MF $dep_object -MT $object $includes $file")));
    m_Commands[(int)ctCompileResourceCmd].push_back(CompilerTool(_T("$rescomp $res_includes -J rc -O coff -i $file -o $resource_output")));
    m_Commands[(int)ctLinkConsoleExeCmd].push_back(CompilerTool(_T("$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs")));
    if (platform::windows)
    {
        m_Commands[(int)ctLinkNativeCmd].push_back(CompilerTool(_T("$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs --subsystem,native")));
        m_Commands[(int)ctLinkExeCmd].push_back(CompilerTool(_T("$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs -mwindows")));
        m_Commands[(int)ctLinkDynamicCmd].push_back(CompilerTool(_T("$linker -shared -Wl,--output-def=$def_output -Wl,--out-implib=$static_output -Wl,--dll $libdirs $link_objects $link_resobjects -o $exe_output $link_options $libs")));
    }
    else
    {
        m_Commands[(int)ctLinkExeCmd] = m_Commands[(int)ctLinkConsoleExeCmd]; // no -mwindows
        m_Commands[(int)ctLinkNativeCmd] = m_Commands[(int)ctLinkConsoleExeCmd]; // no -mwindows
        m_Commands[(int)ctLinkDynamicCmd].push_back(CompilerTool(_T("$linker -shared $libdirs $link_objects $link_resobjects -o $exe_output $link_options $libs")));
    }
    m_Commands[(int)ctLinkStaticCmd].push_back(CompilerTool(_T("$lib_linker -r -s $static_output $link_objects")));

    LoadDefaultRegExArray();

    m_CompilerOptions.Clear();
    m_LinkerOptions.Clear();
    m_LinkLibs.Clear();
    m_CmdsBefore.Clear();
    m_CmdsAfter.Clear();
    SetVersionString();
}
--- End code ---

as you can see it kept it seperate but in doing it like this i broke the standard MinGW compiler detection.


--- Code: ---AutoDetectResult CompilerMINGW::AutoDetectInstallationDir()
{
    // try to find MinGW in environment variable PATH first
    wxString pathValues;
    wxGetEnv(_T("PATH"), &pathValues);
    if (!pathValues.IsEmpty())
    {
        wxString sep = platform::windows ? _T(";") : _T(":");
        wxChar pathSep = platform::windows ? _T('\\') : _T('/');
        wxArrayString pathArray = GetArrayFromString(pathValues, sep);
        for (size_t i = 0; i < pathArray.GetCount(); ++i)
        {
            if (wxFileExists(pathArray[i] + pathSep + m_Programs.C))
            {
                if (pathArray[i].AfterLast(pathSep).IsSameAs(_T("bin")))
                {
                    m_MasterPath = pathArray[i].BeforeLast(pathSep);
                    return adrDetected;
                }
            }
        }
    }

    wxString sep = wxFileName::GetPathSeparator();
    if (platform::windows)
    {
        // look first if MinGW was installed with Code::Blocks (new in beta6)
        m_MasterPath = ConfigManager::GetExecutableFolder();
        if (!wxFileExists(m_MasterPath + sep + _T("bin") + sep + m_Programs.C))
{
            // if that didn't do it, look under C::B\MinGW32 or C::B\MinGW64, too (new in 08.02)
            m_MasterPath += wxIsPlatform64Bit() ? sep + _T("MinGW64") : sep + _T("MinGW32");

            if (!wxFileExists(m_MasterPath + sep + _T("bin") + sep + m_Programs.C))
            {
#ifdef __WXMSW__ // for wxRegKey
                // not found...
                // look for dev-cpp installation
                wxRegKey key; // defaults to HKCR
                key.SetName(_T("HKEY_LOCAL_MACHINE\\Software\\Dev-C++"));
                if (key.Exists() && key.Open(wxRegKey::Read))
                {
                    // found; read it
                    key.QueryValue(_T("Install_Dir"), m_MasterPath);
                }
                else
                {
                    // installed by inno-setup
                    // HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Minimalist GNU for Windows 4.1_is1
                    wxString name;
                    long index;
                    key.SetName(_T("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"));
                    //key.SetName("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion");
                    bool ok = key.GetFirstKey(name, index);
                    while (ok && !name.StartsWith(_T("Minimalist GNU for Windows")))
                    {
                        ok = key.GetNextKey(name, index);
                    }
                    if (ok)
                    {
                        name = key.GetName() + _T("\\") + name;
                        key.SetName(name);
                        if (key.Exists() && key.Open(wxRegKey::Read))
                            key.QueryValue(_T("InstallLocation"), m_MasterPath);
                    }
                }
#endif
            }
        }
        else
            m_Programs.MAKE = _T("make.exe"); // we distribute "make" not "mingw32-make"
    }
    else
        m_MasterPath = _T("/usr");

    AutoDetectResult ret = wxFileExists(m_MasterPath + sep + _T("bin") + sep + m_Programs.C) ? adrDetected : adrGuessed;
    // don't add lib/include dirs. GCC knows where its files are located

    SetVersionString();
    return ret;
}


--- End code ---

and this is the same problem.


--- Code: ---    if (master_path.IsEmpty())
    {
        /* Notice: In general this is bad luck as e.g. all copies of a
         * compiler have a different path, most likely.
         * Thus the following might even return a wrong command!
         */

/* revelator aye this is not portable as is */
        if (platform::windows)
    m_MasterPath += wxIsPlatform64Bit() ? _T("C:\\CodeBlocks\\MinGW64") : _T("C:\\CodeBlocks\\MinGW32");
        else
            master_path = _T("/usr");
    }
--- End code ---

and the hardcoded option which normally just looks in C:\\MinGW

the big size of the package is because theres a whole plethora of tools and libraries included not so much LTO related actually i compiled this with -fno-lto.

the list of whats in it is rather large still working on it. but to name a few theres my mingw python (old version but it works) with a whole slew of plugins and tools like wxpython and PyQt which are large by themself and several tools that use these.

then theres ruby with tools.

and offcourse all the dependant libraries. keept size down a bit by only using shared libraries eg. dll's.

could cut sizes further by removing the includes and import libraries but then noone could do any plugins of their own to say python without rebuilding those.

so its the usual choice between apples and rotten tomatoes.


Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version