<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56661>56661</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Modules] Unable to create library of pcm files (ar)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          pquiring
      </td>
    </tr>
</table>

<pre>
    Would it be possible to archive pcm modules into a library?

//add.cpp
export module add;
export int add(int x, int y) {return x+y;}

//main.cpp
import add;
int main() { return add(1,2); }

::build add.pcm
clang -std=c++20 -c add.cpp -o add.pcm -Xclang -emit-module-interface

::build main.exe (works)
clang -fprebuilt-module-path=. -std=c++20 main.cpp add.pcm -o main.exe

::build library
ar rc libmods.a add.pcm

::build using library (fails)
clang -fprebuilt-module-path=. -std=c++20 main.cpp libmods.a -o main.exe

The error is:
`
ld.lld: error: undefined symbol: add(int, int)
`

Also, why is the -fprebuilt-module-path option required when the pcm is included in the command line?

Thanks,
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytVMFymzAQ_Rq4aGCwiCEcOMTx-NZbOu1VSItRKyQqiTj--64EtpO4uXVGA2J39d7bXS2dEef2h5mVINKTDshknJOdAuINYZYP8hVtfCSjEbMCR6QODqJkZ5k9J-UhKfZJ8bQ-6QEXEyLn07SY4G0y1q_HCbqScvfBg4DRTB_D7i2hz9F0TmhDknpnwc9WB_vuHI7W-3vCkUl9Y5RjxH1PFQBDEJKssGTFXZg3yErRgwfIZ4YyrG6WWKGQGNZicXDF9JFkziPNnqM8XLQgGSdr_iQzlxMk-7mGwyh9thQjQ1Vge8bhK76YF7wBQYknY3-7IPE9eT9ZCKFXyIn5AeXk97ouNbpJMlf8r_gvTY4OZonlwYRULmcfi3F_dnYSFa4IIYGeSfVfErhJ-CKFlwEIWGsskS5IWlxVsWyUyJVC6KclJmxmLaCXGgRx57EzKtiuV3K9kFflV6Dl-aScCSGn4Yx0xCP3v7MiZvLSaLx4f2Zpkes0gI7xoRsyTBZXs0CHXMzcjCPToQsaPs3Zy8B0uA3PqWhL0ZQNS730Ctpku_u2DGqy3ZPvmq2TzC0wD9d2mD6S9jJMNKbJLKaXzla1g_dTLFocrKP0w9zlqAQ_lHq9vLLJml_AsSgH6dyMbPSwrapqkw4tp2Lbd82D6AUv-6rhlajqEspmw5joWZEq1oFyQWpCqYYTiRC4R8mpbGlBaVHTzaah9bbJOasa9kg3nYBqW_d18lAANl3lQUdu7DG1bZTUzUeHTiWddzcnw7_ZUUOsTMBnsx-MbafQA7ygaeRuo_a_vGaRDQ">