title: Use emscripten from Clang compiled executable
body: <p>Is it possible to execute emcc (from emscripten) on a clang compiled executable ?</p>
  
  <p>I tried but the result is: </p>
  
  <pre><code>ERROR root: pdfium_test: Input file has an unknown suffix, don't know what to do with it!
  </code></pre>
  
  <p>I try that because I'm not able to find a solution to compile PDFium project with emcc, but with clang everything is fine.</p>
  
  <p>The reason is: </p>
  
  <blockquote>
    <p>Emscripten is a cross-compiler, and therefore the OS-specific macros
    of the host system should all be undefined when building C/C++ code.
    If you look at tools/shared.py, Emscripten gives special attention to
    -U all host-specific flags that Clang may automatically try to add in.</p>
  </blockquote>
  
  <p>But there is lots of Platform specific code in PDFium, so I get:</p>
  
  <pre><code>#error Sorry, can not figure out target OS. Please specify _FX_OS_ macro.
  </code></pre>
  
  <p>This macro is defined if the <strong>__linux__</strong> macro (for example) is defined, here is the code snippet:</p>
  
  <pre><code>#ifndef _FX_OS_
  #if defined(__ANDROID__)
  #define _FX_OS_ _FX_ANDROID_
  #define _FXM_PLATFORM_ _FXM_PLATFORM_ANDROID_
  #elif defined(_WIN32)
  #define _FX_OS_ _FX_WIN32_DESKTOP_
  #define _FXM_PLATFORM_ _FXM_PLATFORM_WINDOWS_
  #elif defined(_WIN64)
  #define _FX_OS_ _FX_WIN64_DESKTOP_
  #define _FXM_PLATFORM_ _FXM_PLATFORM_WINDOWS_
  #elif defined(__linux__)
  #define _FX_OS_ _FX_LINUX_DESKTOP_
  #define _FXM_PLATFORM_ _FXM_PLATFORM_LINUX_
  #elif defined(__APPLE__)
  #define _FX_OS_ _FX_MACOSX_
  #define _FXM_PLATFORM_ _FXM_PLATFORM_APPLE_
  #endif
  #endif  // _FX_OS_ 
  
  #if !defined(_FX_OS_) || _FX_OS_ == 0
  #error Sorry, can not figure out target OS. Please specify _FX_OS_ macro.
  #endif
  </code></pre>
  
  <p>So, I tried to define manually the <strong>__linux__</strong> macro with:</p>
  
  <pre><code>emmake make -j5 BUILDTYPE=Release __linux__=1
  </code></pre>
  
  <p>... but same error. Maybe it's not the good way ?</p>
  
  <p>Thank you in advance.</p>
  
  <p><strong>EDIT:</strong> The answer of JF Bastien helps me a lot. But now I've this build error and I've any idea of what to do. If someone have an idea...</p>
  
  <pre><code>clang-3.7: warning: argument unused during compilation: '-msse2'
  clang-3.7: warning: argument unused during compilation: '-mmmx'
  error: unknown FP unit 'sse'
  </code></pre>
  
  <p><strong>EDIT 2:</strong> Solution for above problem: remove "-msse2, -mmmx and -mfpmath" flags from v8/build/toolchain.gypi</p>