Issue |
131490
|
Summary |
Problems build partition module using command lines from Clang 21 Standard C++ Modules page
|
Labels |
clang
|
Assignees |
|
Reporter |
rmerriam
|
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
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs