Closed Bug 1631399 Opened 5 years ago Closed 5 years ago

clang-plugin cannot be compiled llvm::make_unique → std::make_unique

Categories

(Firefox Build System :: General, defect, P3)

75 Branch
defect

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: dpa-mozilla, Assigned: rstewart)

References

Details

Attachments

(1 obsolete file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0 Safari/605.1.15 Epiphany/605.1.15

Steps to reproduce:

I download https://archive.mozilla.org/pub/firefox/releases/75.0/source/firefox-75.0.source.tar.xz and call

./configure --with-system-bz2 --with-system-nspr --with-system-icu --with-system-libevent --without-system-png --with-system-zlib --enable-hardening --enable-mozsearch-plugin --enable-js-shell --enable-wasm-gc --enable-wasm-codegen-debug --enable-wasm-bulk-memory --enable-wasm-bigint --enable-cdp --enable-default-toolkit=cairo-gtk3-wayland --enable-raw --enable-webrender-debugger --enable-webrtc --with-system-jpeg --with-system-libvpx --with-system-webp --enable-readline --enable-clang-plugin

I have clang 10.0

Actual results:

I see:
make recurse_compile
make[2]: Entering directory '/src/mozilla/firefox-75.0/build_A'
make[3]: Entering directory '/src/mozilla/firefox-75.0/build_A/build/clang-plugin'
build/clang-plugin/host_MozsearchIndexer.o
/usr/local/bin/clang++ -std=gnu++17 -o host_MozsearchIndexer.o -c -I/usr/local/include -std=c++14 -fno-exceptions -fno-rtti -D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti -fno-exceptions -O2 -DNDEBUG=1 -DTRIMMED=1 -fPIC -I/src/mozilla/firefox-75.0/build/clang-plugin -I/src/mozilla/firefox-75.0/build_A/build/clang-plugin -I/src/mozilla/firefox-75.0/build_A/dist/include -MD -MP -MF .deps/host_MozsearchIndexer.o.pp -I/usr/local/include/nspr /src/mozilla/firefox-75.0/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp
/src/mozilla/firefox-75.0/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp:201:40: error: no template named 'make_unique' in namespace 'llvm'; did you mean 'std::make_unique'?
std::unique_ptr<FileInfo> Info = llvm::make_unique<FileInfo>(Absolute);
^~~~~~~~~~~~~~~~~
std::make_unique
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.3.1/../../../../include/c++/9.3.1/bits/unique_ptr.h:856:5: note: 'std::make_unique' declared here
make_unique(_Args&&... __args)
^
/src/mozilla/firefox-75.0/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp:201:40: error: no template named 'make_unique' in namespace 'llvm'; did you mean 'std::make_unique'?
std::unique_ptr<FileInfo> Info = llvm::make_unique<FileInfo>(Absolute);
^~~~~~~~~~~~~~~~~
std::make_unique
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.3.1/../../../../include/c++/9.3.1/bits/unique_ptr.h:856:5: note: 'std::make_unique' declared here
make_unique(_Args&&... __args)
^
/src/mozilla/firefox-75.0/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp:455:9: error: no template named 'make_unique' in namespace 'llvm'; did you mean 'std::make_unique'?
llvm::make_unique<PreprocessorHook>(this));
^~~~~~~~~~~~~~~~~
std::make_unique
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.3.1/../../../../include/c++/9.3.1/bits/unique_ptr.h:856:5: note: 'std::make_unique' declared here
make_unique(_Args&&... __args)
^
/src/mozilla/firefox-75.0/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp:455:9: error: no template named 'make_unique' in namespace 'llvm'; did you mean 'std::make_unique'?
llvm::make_unique<PreprocessorHook>(this));
^~~~~~~~~~~~~~~~~
std::make_unique
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.3.1/../../../../include/c++/9.3.1/bits/unique_ptr.h:856:5: note: 'std::make_unique' declared here
make_unique(_Args&&... __args)
^
/src/mozilla/firefox-75.0/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp:1633:12: error: no template named 'make_unique' in namespace 'llvm'; did you mean 'std::make_unique'?
return llvm::make_unique<IndexConsumer>(CI);
^~~~~~~~~~~~~~~~~
std::make_unique
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.3.1/../../../../include/c++/9.3.1/bits/unique_ptr.h:856:5: note: 'std::make_unique' declared here
make_unique(_Args&&... __args)
^
/src/mozilla/firefox-75.0/build/clang-plugin/mozsearch-plugin/MozsearchIndexer.cpp:1633:12: error: no template named 'make_unique' in namespace 'llvm'; did you mean 'std::make_unique'?
return llvm::make_unique<IndexConsumer>(CI);
^~~~~~~~~~~~~~~~~
std::make_unique
/usr/local/bin/../lib/gcc/x86_64-pc-linux-gnu/9.3.1/../../../../include/c++/9.3.1/bits/unique_ptr.h:856:5: note: 'std::make_unique' declared here
make_unique(_Args&&... __args)
^
6 errors generated.
make[3]: *** [/src/mozilla/firefox-75.0/config/rules.mk:661: host_MozsearchIndexer.o] Error 1
make[3]: Leaving directory '/src/mozilla/firefox-75.0/build_A/build/clang-plugin'
make[2]: *** [/src/mozilla/firefox-75.0/config/recurse.mk:74: build/clang-plugin/host-objects] Error 2
make[2]: Leaving directory '/src/mozilla/firefox-75.0/build_A'
make[1]: *** [/src/mozilla/firefox-75.0/config/recurse.mk:34: compile] Error 2
make[1]: Leaving directory '/src/mozilla/firefox-75.0/build_A'
make: *** [/src/mozilla/firefox-75.0/config/rules.mk:394: default] Error 2

Expected results:

Likely llvm::make_unique was abandoned in favour of std::make_unique, so FIrefox shall move to the latter.

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → General
Product: Firefox → Firefox Build System
Priority: -- → P3
Assignee: nobody → rstewart

llvm::make_unique is a drop-in alternative for std::make_unique that isn't useful in post-C++14 world, so it was deleted. This is the only file that calls llvm::make_unique as opposed to the std function.

Pushed by rstewart@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3078e3882816 Use `std::make_unique` rather than `llvm::make_unique` in `MozsearchIndexer.cpp` r=emilio
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
Regressions: 1634345
Status: RESOLVED → REOPENED
Ever confirmed: true
Resolution: FIXED → ---
Target Milestone: mozilla77 → ---

Not sure what's going on with the searchfox build or why it would be building with this old C++ standard. I won't re-submit until that problem is solved. kats seems to be working on it. Let me know when that blocking issue is resolved and I can land this again.

Flags: needinfo?(kats)

I should also point out that the MozsearchIndexer.cpp file is built in a different configuration on the searchfox indexer instance, with these compiler flags, and that also includes -std=c++11.

Ricky, you linked to https://reviews.llvm.org/D66259 in an earlier comment, do you know which version of clang that ended up in? In particular it looks like we use versions of clang 9 in mozilla-central and on the searchfox indexer, and both of those emit -std=c++11 as part of llvm-config --cxxflags. The reporter of this bug is using clang 10, maybe that is different.

But regardless, in general it's not supported to build the mozsearch plugin with a different version of clang than the official build, so what the reporter is trying to do is basically invalid. They should be able to build just fine by dropping the --enable-mozsearch-plugin flag from their build command line. Therefore I'm inclined to close this as INVALID and leave things the way they are.

Flags: needinfo?(kats)
Attachment #9144172 - Attachment is obsolete: true
Status: REOPENED → RESOLVED
Closed: 5 years ago5 years ago
Resolution: --- → INVALID

https://developer.mozilla.org/en-US/docs/Mozilla/Using_CXX_in_Mozilla_code say: As of Mozilla 59 C++14 Mode is required.

C++14 defines std::make_unique.

If Firefox 75 can be build with C++11 compiler please update the Using CXX page.

Firefox itself requires C++14. The build options you are providing also attempt to build the mozsearch clang plugin which is not part of Firefox, and are causing the problem you are seeing. Why are you trying to build the mozsearch clang plugin? Or maybe a better question, where did you get the set of configure options you're trying to use?

I did ./configure --help and then chose the options.

Ok, well I suggest removing the --enable-mozsearch-plugin option.

Also for the record, I'm pretty sure firefox doesn't build using the usual ./configure && make && make install method that most linux software uses, so you might run into other problems later. You should set your options in a .mozconfig file and use ./mach build instead.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: