Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LLD] C++20 Modules - unclosed quote #61198

Closed
kassane opened this issue Mar 5, 2023 · 4 comments
Closed

[LLD] C++20 Modules - unclosed quote #61198

kassane opened this issue Mar 5, 2023 · 4 comments
Labels
clang:modules C++20 modules and Clang Header Modules invalid Resolved as invalid, i.e. not a bug lld

Comments

@kassane
Copy link

kassane commented Mar 5, 2023

As described in the title, it would be the error referring to trying to link using ld.lld, unlike other platforms.

This was a test with Zig (LLVM 15.0.7) toolchain.
https://gist.github.com/kassane/7e9a2da137e13eb6e1dbab726693bdb7

$ zig c++ -std=c++20 -fmodules -fbuiltin-module-map -fmodules-ts -Xclang -emit-module-interface -c moduleTest.cpp -o moduleTest.pcm
LLD Link... ld.lld: error: /home/kassane/.cache/zig/o/ec639bf9d5e7c589c4e222dd65d28017/moduleTest.o:995: unclosed quote

Fix:

$ cp $(zig c++ -std=c++20 -fmodules -fbuiltin-module-map -fmodules-ts -Xclang -emit-module-interface -c moduleTest.cpp -o moduleTest.pcm 2>&1 | grep "ld.lld: error" | sed 's/.*error: \(.*\):[0-9]\+.*/\1/g') moduleTest.pcm
@EugeneZelenko EugeneZelenko added clang:modules C++20 modules and Clang Header Modules and removed new issue labels Mar 6, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Mar 6, 2023

@llvm/issue-subscribers-clang-modules

@ChuanqiXu9 ChuanqiXu9 added the lld label Mar 6, 2023
@ChuanqiXu9
Copy link
Member

I don't understand the problem fully. But -fmodules -fbuiltin-module-map -fmodules-ts is not needed for modules. Also it will be better to use --precompile than -Xclang -emit-module-interface.

@kassane
Copy link
Author

kassane commented Mar 6, 2023

I don't understand the problem fully. But -fmodules -fbuiltin-module-map -fmodules-ts is not needed for modules. Also it will be better to use --precompile than -Xclang -emit-module-interface.

Based on: https://releases.llvm.org/15.0.0/tools/clang/docs/StandardCPlusPlusModules.html#quick-start

# LLVM 15.0.6 (ubuntu 22.04)
$> clang++ -std=c++20 Hello.cppm --precompile -o Hello.pcm

Hello.cppm:2:10: fatal error: 'iostream' file not found
#include <iostream>
         ^~~~~~~~~~
1 error generated.

$> clang++ -std=c++20 Hello.cppm --precompile -o Hello.pcm -stdlib=libc++ # no issue

# zig v0.10.1 - LLVM 15.0.7
$> zig c++ -std=c++20 Hello.cppm --precompile -o Hello.pcm

LLD Link... ld.lld: error: Hello.cppm:1: unknown directive: module
>>> module;
>>> ^

@MaskRay
Copy link
Member

MaskRay commented Mar 30, 2023

This is an issue in Zig or the user. ld.lld recognizes several object file formats and treats others as linker scripts.

@MaskRay MaskRay closed this as not planned Won't fix, can't repro, duplicate, stale Mar 30, 2023
@EugeneZelenko EugeneZelenko added the invalid Resolved as invalid, i.e. not a bug label Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:modules C++20 modules and Clang Header Modules invalid Resolved as invalid, i.e. not a bug lld
Projects
None yet
Development

No branches or pull requests

5 participants