Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual C/C++ compatibility #162

Closed
wants to merge 161 commits into from
Closed

Visual C/C++ compatibility #162

wants to merge 161 commits into from

Conversation

@jd-gascuel
Copy link

jd-gascuel commented Mar 11, 2017

Hi Joel,

I started a fork to try to make changes to ccache, so we can compile and use it for windows.
In the following you will see:

  • A bunch of small cleanups to make Visual compiler happy. Mostly bad includes and missing definition on windows. All them should be completly transparent, and I think will improve the main branch quality.
  • There is a few 32/64 bits issues that might deserve a better correction. I just casted them down to 32 bits...
  • I added a compiler_is_msvc() at the top of ccache.c, and started a table of options specific to the Visual compilers.
  • Plus a few management of specific options.

So it starts to work, and knows how to compile itself.

Known issues:

  • cl compiler do write part of the error messages into stdout, and other parts to stderr. This cannot be avoided... So I just made a concatenation of stdour+stderr->stderr. Not very clean, and a better approach might be: 1) to change the execute() function to have only one file, or 2) have ccache to can both stdout and stderr outputs. Note both solution won't keep sync between lines send to stdout and stderr, which might be confusing... but is truly microsoft's fault.
  • cl options can be /option or -option : I did not deal with that properly yet. But this should not be too hard.
  • I should investigate on @file support.
  • I have not a very clear view of what option shall be and shall not be in the compopts_msvc table.

Futur ?
The main question here is: how to contribute that to ccache ?

  • Are you happy to have a windows branch in the official ccache repo ? and to merge it to the default trunk once it works great ?
  • Is there a way to can other annex files (cl generates .sbr files with complete symbolic information) into the cache, so we can restore them too ?

Best regards,

Note: I used Visual 2015 to compile, because earlier version will shock on variable definition inside for().

jd-gascuel added 29 commits Mar 8, 2017
Add Windows specific includes
…sis.

FIX: option /FoDebug/x64/ can be just a directory: concatenate the object name.
@jd-gascuel jd-gascuel changed the title Windows Visual C/C++ compatibility Mar 11, 2017
@jd-gascuel

This comment has been minimized.

Copy link
Author

jd-gascuel commented Mar 27, 2017

Status

Now global tests do pass with Visual compiled version of ccache. This means that:

  • ccache still do not support fully the cl compiler, as we need support of specific options for this compiler, which will be the next step.
  • but ccache, once compiled with Visual compilers, pass the internal and global tests (when test.sh is given the CC=gcc argument). This may seems weird, but it proves that ccache is correctly handling windows path, process management and shell launch.
  • The AppVeyor build system can be used to automatically run the same toolchain and directly see the red/green status of any commit or pull request.

Futur

  • I totally agree with @jrosdahl and @afbjorklund : this PR is a total mess and cannot be integrated like this. I definitely need an active squash/rebase/rework/uncrustify/eol process before anyone can do anything...
  • but it allowed me to make a forecast of what might be needed to have a workable solution, and to launch this discussion.
  • I am very interested by your proposal to integrate the stuff that are of general interest for linux and windows, and/or that makes life easier for possible futur of a windows version.
    In particular the current situation seems a bit confusing, because you currently have partial support here and there...
    To have a better view of how to process, I need to know wether you like to merge
    • changes to configure.ac to detect the platform we are compiled on (linux/MinGW/MSYS/...) ?
    • changes to Makefile.in and dev.mk.in to use the defined flags and compile/link .obj and .exe ?
    • changes to util.c, test_util.c and various make_relative_path() functions so they really support various stupidities of path on Windows (ie. improving your #ifdef _WIN32 stuff already there) ?
    • bugs I found in the #ifdef _WIN32 parts ?
    • the AppVeyor engine to compile just your MinGW support ?

What would you like to have first ? Any advice here ?
All the best,

@jd-gascuel jd-gascuel closed this Mar 28, 2017
@jd-gascuel jd-gascuel deleted the jd-gascuel:windows branch Mar 28, 2017
cristianadam added a commit to cristianadam/ccache that referenced this pull request Jan 10, 2020
I picked only the compiler commits from:
ccache#162

The following commits I've adapted to the latest ccache C++ code:

375fe24: Add compiler_is_msvc() and MSVC specific option table.
7e01763: Add handling of /Fo option (replaces -o, but shall have no
space)
0c5cd25: Manage /E, /c equivalence. -g is gcc only. -O or /O is msvc
only.
4f61b59: MSVC send part of the error/warning messages to STDOUT, so
concat wit…
b634c34: Skip \r in preprocess output
cristianadam added a commit to cristianadam/ccache that referenced this pull request Jan 10, 2020
I picked only the compiler commits from:
ccache#162

The following commits I've adapted to the latest ccache C++ code:

375fe24: Add compiler_is_msvc() and MSVC specific option table.
7e01763: Add handling of /Fo option (replaces -o, but shall have no
space)
0c5cd25: Manage /E, /c equivalence. -g is gcc only. -O or /O is msvc
only.
4f61b59: MSVC send part of the error/warning messages to STDOUT, so
concat wit…
b634c34: Skip \r in preprocess output
cristianadam added a commit to cristianadam/ccache that referenced this pull request Jan 10, 2020
I picked only the compiler commits from:
ccache#162

The following commits I've adapted to the latest ccache C++ code:

375fe24: Add compiler_is_msvc() and MSVC specific option table.
7e01763: Add handling of /Fo option (replaces -o, but shall have no
space)
0c5cd25: Manage /E, /c equivalence. -g is gcc only. -O or /O is msvc
only.
4f61b59: MSVC send part of the error/warning messages to STDOUT, so
concat wit…
b634c34: Skip \r in preprocess output
cristianadam added a commit to cristianadam/ccache that referenced this pull request Jan 12, 2020
I picked only the compiler commits from:
ccache#162

The following commits I've adapted to the latest ccache C++ code:

375fe24: Add compiler_is_msvc() and MSVC specific option table.
7e01763: Add handling of /Fo option (replaces -o, but shall have no
space)
0c5cd25: Manage /E, /c equivalence. -g is gcc only. -O or /O is msvc
only.
4f61b59: MSVC send part of the error/warning messages to STDOUT, so
concat wit…
cristianadam added a commit to cristianadam/ccache that referenced this pull request Jan 14, 2020
I picked only the compiler commits from:
ccache#162

The following commits I've adapted to the latest ccache C++ code:

375fe24: Add compiler_is_msvc() and MSVC specific option table.
7e01763: Add handling of /Fo option (replaces -o, but shall have no
space)
0c5cd25: Manage /E, /c equivalence. -g is gcc only. -O or /O is msvc
only.
4f61b59: MSVC send part of the error/warning messages to STDOUT, so
concat wit…
@cristianadam cristianadam mentioned this pull request Jan 14, 2020
1 of 5 tasks complete
cristianadam added a commit to cristianadam/ccache that referenced this pull request Jan 18, 2020
I picked only the compiler commits from:
ccache#162

The following commits I've adapted to the latest ccache C++ code:

375fe24: Add compiler_is_msvc() and MSVC specific option table.
7e01763: Add handling of /Fo option (replaces -o, but shall have no
space)
0c5cd25: Manage /E, /c equivalence. -g is gcc only. -O or /O is msvc
only.
4f61b59: MSVC send part of the error/warning messages to STDOUT, so
concat wit…
cristianadam added a commit to cristianadam/ccache that referenced this pull request Jan 18, 2020
I picked only the compiler commits from:
ccache#162

The following commits I've adapted to the latest ccache C++ code:

375fe24: Add compiler_is_msvc() and MSVC specific option table.
7e01763: Add handling of /Fo option (replaces -o, but shall have no
space)
0c5cd25: Manage /E, /c equivalence. -g is gcc only. -O or /O is msvc
only.
4f61b59: MSVC send part of the error/warning messages to STDOUT, so
concat wit…
cristianadam added a commit to cristianadam/ccache that referenced this pull request Jan 23, 2020
I picked only the compiler commits from:
ccache#162

The following commits I've adapted to the latest ccache C++ code:

375fe24: Add compiler_is_msvc() and MSVC specific option table.
7e01763: Add handling of /Fo option (replaces -o, but shall have no
space)
0c5cd25: Manage /E, /c equivalence. -g is gcc only. -O or /O is msvc
only.
4f61b59: MSVC send part of the error/warning messages to STDOUT, so
concat wit…
cristianadam added a commit to cristianadam/ccache that referenced this pull request Jan 23, 2020
I picked only the compiler commits from:
ccache#162

The following commits I've adapted to the latest ccache C++ code:

375fe24: Add compiler_is_msvc() and MSVC specific option table.
7e01763: Add handling of /Fo option (replaces -o, but shall have no
space)
0c5cd25: Manage /E, /c equivalence. -g is gcc only. -O or /O is msvc
only.
4f61b59: MSVC send part of the error/warning messages to STDOUT, so
concat wit…
cristianadam added a commit to cristianadam/ccache that referenced this pull request Feb 1, 2020
I picked only the compiler commits from:
ccache#162

The following commits I've adapted to the latest ccache C++ code:

375fe24: Add compiler_is_msvc() and MSVC specific option table.
7e01763: Add handling of /Fo option (replaces -o, but shall have no
space)
0c5cd25: Manage /E, /c equivalence. -g is gcc only. -O or /O is msvc
only.
4f61b59: MSVC send part of the error/warning messages to STDOUT, so
concat wit…
cristianadam added a commit to cristianadam/ccache that referenced this pull request Feb 1, 2020
I picked only the compiler commits from:
ccache#162

The following commits I've adapted to the latest ccache C++ code:

375fe24: Add compiler_is_msvc() and MSVC specific option table.
7e01763: Add handling of /Fo option (replaces -o, but shall have no
space)
0c5cd25: Manage /E, /c equivalence. -g is gcc only. -O or /O is msvc
only.
4f61b59: MSVC send part of the error/warning messages to STDOUT, so
concat wit…
cristianadam added a commit to cristianadam/ccache that referenced this pull request Feb 1, 2020
I picked only the compiler commits from:
ccache#162

The following commits I've adapted to the latest ccache C++ code:

375fe24: Add compiler_is_msvc() and MSVC specific option table.
7e01763: Add handling of /Fo option (replaces -o, but shall have no
space)
0c5cd25: Manage /E, /c equivalence. -g is gcc only. -O or /O is msvc
only.
4f61b59: MSVC send part of the error/warning messages to STDOUT, so
concat wit…
cristianadam added a commit to cristianadam/ccache that referenced this pull request Feb 3, 2020
I picked only the compiler commits from:
ccache#162

The following commits I've adapted to the latest ccache C++ code:

375fe24: Add compiler_is_msvc() and MSVC specific option table.
7e01763: Add handling of /Fo option (replaces -o, but shall have no
space)
0c5cd25: Manage /E, /c equivalence. -g is gcc only. -O or /O is msvc
only.
4f61b59: MSVC send part of the error/warning messages to STDOUT, so
concat wit…
cristianadam added a commit to cristianadam/ccache that referenced this pull request Feb 6, 2020
I picked only the compiler commits from:
ccache#162

The following commits I've adapted to the latest ccache C++ code:

375fe24: Add compiler_is_msvc() and MSVC specific option table.
7e01763: Add handling of /Fo option (replaces -o, but shall have no
space)
0c5cd25: Manage /E, /c equivalence. -g is gcc only. -O or /O is msvc
only.
4f61b59: MSVC send part of the error/warning messages to STDOUT, so
concat wit…
cristianadam added a commit to cristianadam/ccache that referenced this pull request Feb 6, 2020
I picked only the compiler commits from:
ccache#162

The following commits I've adapted to the latest ccache C++ code:

375fe24: Add compiler_is_msvc() and MSVC specific option table.
7e01763: Add handling of /Fo option (replaces -o, but shall have no
space)
0c5cd25: Manage /E, /c equivalence. -g is gcc only. -O or /O is msvc
only.
4f61b59: MSVC send part of the error/warning messages to STDOUT, so
concat wit…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.