<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/131490>131490</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Problems build partition module using command lines from Clang 21 Standard C++ Modules page
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
rmerriam
</td>
</tr>
</table>
<pre>
I am encountering a problem building a partition module based on these [command lines]( https://clang.llvm.org/docs/StandardCPlusPlusModules.html#id15) on the page **Clang 21 Standard C++ Modules**. The system is Ubuntu 24.04 and Clang 19 and 20. I’m working a talk and book about modules so want to present all the options.
My actual command lines and the errors are:
```c++
+ clang++ -std=c++23 Balinese.cppm --precompile -o bin/Javanese-Balinese.pcm
+ clang++ -std=c++23 balinesex.cppm --precompile -fprebuilt-module-path=bin -o bin/Javanese-balinese.pcm
+ clang++ -std=c++23 Javanese.cppm --precompile -fprebuilt-module-path=bin -o bin/Javanese.pcm
+ clang++ -std=c++23 javanesex.cppm -fprebuilt-module-path=bin -c -o bin/javanese.o
+ clang++ -std=c++23 bin/Javanese-Balinese.pcm -fprebuilt-module-path=bin -c -o bin/Javanese-Balinese.o
+ clang++ -std=c++23 bin/Javanese-balinese.pcm -fprebuilt-module-path=bin -c -o bin/Javanese-balinese.o
+ clang++ -std=c++23 bin/Javanese.pcm -fprebuilt-module-path=bin -c -o bin/Javanese.o
+ clang++ -std=c++23 main.cpp -fprebuilt-module-path=bin -c -o bin/main.o
+ clang++ bin/main.o bin/Javanese-Balinese.o bin/Javanese-balinese.o bin/Javanese.o bin/javanese.o -o bin/main
/usr/bin/ld: bin/Javanese-balinese.o: in function `initializer for module Javanese:Balinese':
Javanese-balinese.pcm:(.text.startup+0x0): multiple definition of `initializer for module Javanese:Balinese'; bin/Javanese-Balinese.o:Javanese-Balinese.pcm:(.text.startup+0x0): first defined here
/usr/bin/ld: bin/javanese.o: in function `initializer for module Javanese':
javanesex-ab7ff5.pcm:(.text.startup+0x0): multiple definition of `initializer for module Javanese'; bin/Javanese.o:Javanese.pcm:(.text.startup+0x0): first defined here
```
Why is line 2 required since the partition implementation file isn’t an MIU?
Also, I needed to add `export` to the `module Javanese;` line in `javanesex.cppm` file that isn’t needed in the build shown below. With that added the file compiled but then there were errors:
`````
/usr/bin/ld: bin/Javanese-balinese.o: in function `initializer for module Javanese:Balinese':
Javanese-balinese.pcm:(.text.startup+0x0): multiple definition of `initializer for module Javanese:Balinese'; bin/Javanese-Balinese.o:Javanese-Balinese.pcm:(.text.startup+0x0): first defined here
/usr/bin/ld: bin/javanese.o: in function `initializer for module Javanese':
javanesex-9003c5.pcm:(.text.startup+0x0): multiple definition of `initializer for module Javanese'; bin/Javanese.o:Javanese.pcm:(.text.startup+0x0): first defined here
`````
Why are `balinesex.cppm` and `javanesex.cppm` built as MIU since they are Module Implementation Files?
The translation units build fine with GCC-14 and these command lines with Clang. This is not a problem with the code but the command lines.
```
+ clang++ -std=c++23 --precompile Balinese.cppm -o bin/Javanese-Balinese.pcm
+ clang++ -std=c++23 --precompile -fprebuilt-module-path=bin Javanese.cppm -o bin/Javanese.pcm
+ clang++ -std=c++23 -c -fprebuilt-module-path=bin Javanese.cppm -o bin/Javanese.o
+ clang++ -std=c++23 -c -fprebuilt-module-path=bin javanese.cpp -o bin/javanese.o
+ clang++ -std=c++23 -c -fprebuilt-module-path=bin balinese.cpp -o bin/balinese.o
+ clang++ -std=c++23 -r bin/Javanese.o bin/javanese.o bin/balinese.o -o bin/Javanese.Module.o
+ clang++ -std=c++23 -c -fprebuilt-module-path=bin main.cpp -o bin/main.o
+ clang++ -std=c++23 bin/Javanese.Module.o bin/main.o -o bin/main
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzsWE1v4zYQ_TX0ZWCBomzHOvhgJ3WRAgss0C72TIljixuKVEkqTvrrC1JS4q_E3gQ9tCiQD4iamTd80sw8kTsntxpxQaYrMr0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