Closed lemtronix closed 6 years ago
Can you write a binary that converts g++ flags to something that your compiler understands and then forward to your real compiler? Then you could just specify that binary as your compiler.
What I'm attempting to do is cross-compile on Windows to an MCU (embedded ARM Cortex-M0+) using the IAR compiler.
As I dig through the source code, the issue goes beyond simply not having certain flags passed in for the compile step, the link step is also incorrect as well as the information that is entered into the argvar files (i.e. ppandcompile.argsfile and linker.argsfile).
To close the loop on this issue, BUCK currently does not currently support other compilers. It appears that only Visual Studio, GCC, and Xcode are supported at this time.
Hi, I'm looking at using buck for sharing c/c++ libraries and providing an easy way to compile projects using embedded toolchains. We use embedded specific compilers--KEIL and IAR (not Visual Studio or GCC)--that build for ARM (and other) microcontrollers.
The issue I'm having is that buck always inserts the compiler flags "-x c++ -gno-record-gcc-switches -c -MD -MF" which iccarm.exe (IAR compiler) doesn't know about. I tried over writing every possible compiler and preprocessor flag in [cxx] for .buckconfig and cxx_binary() in the BUCK file but these flags still show up in the ppandcompile.argsfile. Even when I leave the cppflags, cflags, cxxppflags, etc. empty, the flags mentioned above still show up. Is there a way to turn these flags off?
The -MD and -MF flags are found in CxxInferCapture.java and DefaultCompiler.java and are hardcoded to be added to an ImmutableList. If there isn't an easy way to turn it off I was going to remove the references from these files but this would obviously break compatibility for compilers that need these flags.
In .buckconfig, there's linker_platform and archiver_platform that allows someone to specify LINUX, MACOS, FREEBSD, or WINDOWS. Would it be possible to add something (perhaps EMBEDDED) that would remove these compiler flags by default?
Thoughts or suggestions? Thanks!