[LLVMdev] -version displays DEBUG on Visual C++ release build

Russell Wallace russell.wallace at gmail.com
Sun Feb 14 01:28:39 PST 2010


Got it. You can define the relevant symbol at cmake stage, using a
command like this:

\cmake-2.8.0-win32-x86\bin\cmake.exe -DCMAKE_BUILD_TYPE=Release
"-DCMAKE_CXX_FLAGS_RELEASE=/MD /O2 /Ob2 /D NDEBUG /D __OPTIMIZE__"
c:\llvm-2.6

On Sun, Feb 14, 2010 at 5:41 AM, Russell Wallace
<russell.wallace at gmail.com> wrote:
> C:\llvm\bin>llc -version
> Low Level Virtual Machine (http://llvm.org/):
>  llvm version 2.6svn
>  DEBUG build.
>  Built Jan 31 2010(20:46:01).
>
>  Registered Targets:
>    x86    - 32-bit X86: Pentium-Pro and above
>    x86-64 - 64-bit X86: EM64T and AMD64
>
> I did specify the release build with cmake; the lack of crashing on
> exit of programs compiled therewith confirms that :-) As far as I can
> see, the reason for the incorrect reporting is in CommandLine.cpp:
>
> #ifndef __OPTIMIZE__
>        cout << "DEBUG build";
> #else
>        cout << "Optimized build";
> #endif
>
> According to a Google search, gcc sets __OPTIMIZE__ when -O2 or better
> is used, so presumably that's the intent of the above and the reason
> it doesn't work with Visual C++.
>
> I'd ideally like my compiler to report the version of llvm it was
> linked with (as well as its own version), so output of incorrect
> information is a problem. Does anyone know of a solution to this?
>




More information about the llvm-dev mailing list