GCC modules branch CMI mapping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, this is the link to this exact question on Reddit
<https://www.reddit.com/r/gcc/comments/ftm75d/gcc_modules_branch_cmi_mapping/>(in
the GCC subreddit). They told me to ask to this email, so I'll try:


--------------------------------------------------------------------------------------------------------


Hello, I've built the module branch of GCC from source. I got the source
via: git clone --branch devel/c++-modules git://gcc.gnu.org/git/gcc.git
 SRCDIR

All seems to work, but I cannot use the feature that was the reason why I
opted for this experimental version: C++20 modules.

I created a very simple project, where I have a module interface (module1
 in module1.cc) and a main (in Main.cpp). I'm able to compile the module
alone with the line: g++ -fmodules-ts module1.cc -c. It creates a
module1.o file
and a gcm.cache folder, and inside it a module1.gcm file.

When I try to compile the Main.cpp with g++ -fmodules-ts Main.cpp things
stop working, and I get these errors:

module: error: failed to read compiled module: No such file or directory
module: note: compiled module file is 'gcm.cache/module.gcm'
module: note: imports must be built before being imported
module: fatal error: returning to the gate for a mechanical issue

Now, the errors are quite explicit, but I cannot figure out what they're
trying to tell me. The first line says that there isn't any compiled module
file, but the second line tells me the compiled module file is in
gcm.cache/module.gcm . And the third line tells me to build modules before
importing them, but this is exaclty what I've done!

I read about module mappers
<http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1184r1.pdf>, so I
tried to write a file (mapper) working as a mapper. I wrote inside only one
line: *module1 gcm.cache/module1.gcm* . But now, if I compile with: g++
-fmodules-ts -fmodule-mapper=mapper Main.cpp I get:

module: error: failed to read compiled module: Unknown CMI mapping
module: note: imports must be built before being imported
module: fatal error: returning to the gate for a mechanical issue

And again this means very little to me.

Last I tried to compile the module and the main at the same time with: g++
-fmodules-ts -fmodule-mapper=mapper module1.cc Main.cpp and g++
-fmodules-ts module1.cc Main.cpp but I get the exact same errors I got
before (both with and without the module mapper file).

I really don't know what to do, I know it is an experimental feature, but
in the GCC web page they say it is a usable feature
<https://gcc.gnu.org/wiki/cxx-modules>, so I'm making some mistakes I
cannot identify.

If you need more information I'll provide it as soon as possible!

---
*Lapo Falcone *



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux