title: Linking C++ modules TS using clang
body: <p>I'm trying to use C++ modules TS with clang. </p>
  
  <p>I've created two files:</p>
  
  <pre><code>// foo.cppm
  export module foo;
  
  export void test() {
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>// bar.cpp
  import foo;
  
  int main() {
    test();
    return 0;
  }
  </code></pre>
  
  <p>I compile <code>foo.cppm</code> with this command</p>
  
  <pre><code>clang++ --std=c++17 -fmodules-ts --precompile foo.cppm -o foo.pcm
  </code></pre>
  
  <p>It compiles without an error and creates a <code>foo.pcm</code> file, but when i try to compile a binary with this command:</p>
  
  <pre><code>clang++ --std=c++17 -fmodules-ts -fprebuilt-module-path=. -fmodule-file=foo.pcm bar.cpp
  </code></pre>
  
  <p>it prints an error:</p>
  
  <pre><code>/tmp/bar-f69a1f.o: In function `main':
  bar.cpp:(.text+0x10): undefined reference to `test()'
  </code></pre>
  
  <p>I tried it with clang 7 trunk and clang 6.
  Also i tried different <code>std</code> options and this command:</p>
  
  <pre><code>clang++ --std=c++17 -fmodules-ts -fmodule-file=foo.pcm bar.cpp -o bar
  </code></pre>
  
  <p>And nothing helps. </p>
  
  <p>Interesting enough that if one module uses symbols from other, clang compiles these modules. So as i understand the problem is in linking stage.</p>
  
  <p>What can be a problem? </p>