Repository navigation
Cleaning up the build system - #169
jd-gascuel wants to merge 4 commits into
Conversation
|
Why did you have to rename Otherwise the upgrade of autotools and OBJEXT/LIBEXT looked reasonable, but not Basically this will be impossible to test, with everything |
|
But I can give it a try with |
|
Hello Anders,
|
|
@jd-gascuel : seems you have a typo in "psapi" (spelled as "Psapi"), which fails the build...
|
| case $host in | ||
| *mingw32* | *mingw64* | *cygwin* | *wince* | *mingwce*) | ||
| windows_os=yes | ||
| ccache_os=mingw |
There was a problem hiding this comment.
What is the difference between MinGW and Windows ?
There was a problem hiding this comment.
The good question is: what is the difference between MinGW and MSYS2 ?
I found at least one:
- MSYS2: You should link with
Psapi.lib - MINGW: You should link with
-lpsapi(sorry for the mixed case typo)
|
|
||
| *msys*) | ||
| ccache_os=msys | ||
| AC_DEFINE(CCACHE_MSYS, 1, Compiling on a MSYS2 platform) |
There was a problem hiding this comment.
What is the difference between MSYS and Windows ?
|
|
||
| *apple*) | ||
| ccache_os=mac | ||
| AC_DEFINE(CCACHE_MAC, 1, Compiling on an Apple platform) |
There was a problem hiding this comment.
This platform is normally called Darwin, after the uname
|
Ah, I see. Maybe test/util.c should be called test/test_util.c or something. |
|
... or something. Because there is already a |
|
Test results on MinGW-w64/Wine (i686) doesn't look all bad, actually! |
|
I have that in my branch: It just drops color under mingw or msys: static bool
color_output_possible(void)
{
#ifdef _WIN32
return false;
#else
const char *term_env = getenv("TERM");
return isatty(STDERR_FILENO) && term_env && strcasecmp(term_env, "DUMB") != 0;
#endif
} |
|
Well, the problem was the --- a/ccache.c
+++ b/ccache.c
@@ -1710,7 +1710,7 @@ calculate_common_hash(struct args *args, struct mdfour *hash)
// Possibly hash GCC_COLORS (for color diagnostics).
if (compiler_is_gcc(args)) {
const char *gcc_colors = getenv("GCC_COLORS");
- if (gcc_colors) {
+ if (gcc_colors && gcc_colors[0] != '\0') {
hash_delimiter(hash, "gcccolors");
hash_string(hash, gcc_colors);
}
|
|
... // This is like unsetenv.
void x_unsetenv(const char *name)
{
#ifdef HAVE_UNSETENV
unsetenv(name);
#elif defined(_WIN32)
char *str = format("%s=", name);
putenv(str);
free(str);
#else
putenv(x_strdup(name)); // Leak to environment.
#endif
} |
|
Yeah, it seemed to choke on the suffix not fitting into the DOS conventions; Probably |
|
What is your settings for |
|
Basically: |
|
And apparently MinGW has some own "mkstemp", that configure finds - but doesn't work. That was the last two fails (switching to the "cheap and nasty" replacement works better). |
|
@jd-gascuel : Were you able to use the
Should be easy to extend to "clang" and "mingw", too... |
|
Uploaded the passing code as 00633e3...36c54c7, if it helps you somehow ? - os: linux
compiler: i686-w64-mingw32-gcc
sudo: required
dist: trusty
env: HOST="--host=i686-w64-mingw32" TEST="test/main.exe" |
|
Oups... I am lost here: how do I fetch and merge your uploaded patch into my PR ? ... Ok I made a wget URL.patch + git apply: it squashed everything in one step. |
|
Oups. I got
Reverting. |
|
I suppose mentioning the branch name ( |
|
And yeah, adding the requirements would be needed too. |
|
That "mkstemp" stuff was from 18c7730, by the way. |
|
Apparently one can use
|
|
Updated the branch for #119, would be nice to combine forces for Appveyor with #69 ? I wonder where that "usleep" went, maybe I left it in Windows or something ? ( Will leave this PR as the request for supporting Visual Studio / Windows as a development platform ? As @jrosdahl said (#162 (comment)), not so sure... The other two relied heavily on just using MinGW, so wasn't too concerned with supporting Windows. Seems to be working with Wine, haven't tried on Win. I'm OK with supporting Mac using Also OK with supporting Win - by using But am not so sure about supporting Xcode / Visual Studio ? That would require me actually running tests on the real thing. |
|
Hi @afbjorklund , This PR is not about supporting Windows. It is just about having a common ground to make it easier to share code with a branch/fork/XXX that do support windows. This is why I did not include any change specific for MSYS2 or MinGW. About your (not for the PR usleep() question), I can propose the simple answer I used in my branch:
The good point is tha #ifdef _WIN32
// We are lucky: Windows have ms resolution, which is enough here.
Sleep(to_sleep/1000);
#else
usleep(to_sleep);
#endifRegards, |
|
Thanks for clarifying, but still the changes proposed only affects Windows as a platform... Your change with |
|
I am quiet new to ccache development, but I found AppVeyor really useful and efficient. My current AppVeyor YML compiles on gcc 32 and 64 bits, Visual 2013 32 and 64 bits, and Visual 2015 32 and 64 bits. And for each of them, runs the full test suite with gcc, g++ and cc. Most probably overkill in the long run, but interesting and useful during the hard-coding time. |
|
Yeah, it's definitely useful (with Travis or Appveyor). But some things needs direct access to the actual platform in order to do development, and when running locally it is easier to set up Docker or Vagrant ? Anyway, the new MSYS2 system is kinda neat (I like Apparently there's some things to be done with symlinks: MSYS2-dont-use-symlinks.patch So in order to work on Windows, those should be addressed (with tests) and the rest fixed ? |
|
Apparently MSYS2 does not compile for Windows (_WIN32) by default (have to use Like you reported earlier, the And we need a better way to detect compiler, than looking at the name of binary (as it fails) So need to go beyond the first line of the version string, since that doesn't have any real info:
Probably look for the macros instead. #define __GNUC__ 5
#define __clang__ 1
#define __llvm__ 1
#define __MINGW32__ 1
#define __MINGW64__ 1
#define __MSYS__ 1 |
|
@jd-gascuel : Oh, and I found the old nanosleep code (44fbd43) We only sleep for 1 millisecond (and longer) anyway, so it doesn't really matter which resolution is used :-) |
|
I had misunderstood a couple of things. First that the "MSYS" prompt is now a Cygwin environment! i.e. if you don't populate Seems to be a lot left to do with portability: https://github.com/TeaCI/tea-ci/wiki/Msys2-on-Wine But it should be doable (just a couple of bugfixes and bit-rot), to support both MinGW and Cygwin... The "issue" would be trying to support a more native Windows, with only Visual Studio or something ? Running configure with bash and make with gmake sounds like a reasonable workaround meanwhile. |
|
@afbjorklund this is precisely the point of this pull request. With it, we do have a common ground on which I can propose more stuff and convergence. I do currently have an AppVeyor image that:
I am working on having the long test.sh suite work also for Visual compilers (whatever the compiler used to compile ccache). Once done I will be able to propose:
I do not think that using CMake will be an improvement here: I agree with @jrosdahl that having both system is a loss of energy. And as you said, it will be a deep change and have impacts on a lots of people compiling ccache in many environment. Please fill free to ask any changes you thing necessary to process further ! |
|
There's still some things that could be done about readability, like fix your Git settings* (core.autocrlf) to not add those carriage returns ( But like I said, MinGW/Cygwin should be fixed already and adding Appveyor/Windows is up to @jrosdahl. Doesn't hurt if the changes are kept minimal anyway, even if it is on a separate branch or a separate fork ? I do prefer things portable, and thank you for your interest in ccache. Just not sure if using "real" Windows (without Bash) is ever worth it. :-P |
|
Just to add a little +1 for this; I was unable to compile |
|
Note: I've updated config.guess and config.sub to modern versions on master now. |
|
@jd-gascuel: Closing this now due to inactivity. Please resubmit any proposed fixes as new pull requests if you like. |
Hi Joel, Hi Anders,
I spend the day squashing and re-basing my fork (sorry, dropping the previous PR also drop all the discussions we had there... Sorry for that!).
Here is a first cleaned PR that I can propose you. The idea is just to have a common ground when building various branches/forks/mirror/whatsoever versions of ccache...
But this PR does not change anything at the behavior of the actual code.
Summary:
HAVE_XXX_Hbefore including various files detected by configure.compiler_is_XXX()predicates at the beginning ofccache.cinput_file,output_objectandmake_relative_path()so we can unit test them.--> Please let me know if you are happy with that.
All the best,