Skip to content

qt: patch missing includes for 5.14#19948

Merged
sethrj merged 1 commit intospack:developfrom
angel-devicente:qt5-14.archlinux
Nov 29, 2020
Merged

qt: patch missing includes for 5.14#19948
sethrj merged 1 commit intospack:developfrom
angel-devicente:qt5-14.archlinux

Conversation

@angel-devicente
Copy link
Copy Markdown
Contributor

Not sure if this happens with other distributions. In ArchLinux, Qt does not compile cleanly. Applying the changes in the included patch fixes it.

@angel-devicente angel-devicente force-pushed the qt5-14.archlinux branch 2 times, most recently from de41d70 to 318162a Compare November 16, 2020 23:13
@adamjstewart adamjstewart requested a review from sethrj November 17, 2020 03:27
Copy link
Copy Markdown
Contributor

@sethrj sethrj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The includes of <{lib}.h> in C++ code are nonstandard, but I'm assuming they're needed instead of <c{lib}> because the function calls aren't scoped with std::?

Have these changes been pushed upstream to qt for integration in 5.15?

@sethrj sethrj changed the title Fix to allow compilation of Qt in ArchLinux qt: patch missing includes Nov 18, 2020
@sethrj sethrj changed the title qt: patch missing includes qt: patch missing includes for 5.14 Nov 18, 2020
@sethrj
Copy link
Copy Markdown
Contributor

sethrj commented Nov 18, 2020

@angel-devicente Can you provide more information on your build configuration? Were you (like #19963) using GCC 10, and have you tried building with Qt 5.15?

@angel-devicente
Copy link
Copy Markdown
Contributor Author

angel-devicente commented Nov 20, 2020

Hi, the stock compiler in this machine is gcc 10.2.0, but I was doing the compilation as part of the VisIt package, and using [email protected].

Right now I tried to replicate this patch by compiling qt (5.14.2) with:
spack install qt %[email protected]

but it didn't succeed. It looks like it was sufficient with the constraints added by the VisIt compilation, but not otherwise. I will try to figure out why.

(The error I get now, when not installing VisIt as well, is:
/usr/bin/ld: /lib/../lib64/../lib/libLLVM-10.so: undefined reference to std::__cxx11::basic_stringstream<char,std::char_traits<char>, std::allocator<char> >::basic_stringstream()@GLIBCXX_3.4.26'

@angel-devicente
Copy link
Copy Markdown
Contributor Author

As it turns out, in order to successfully compile qt on its own with ArchLinux I have to do:

spack install [email protected]%[email protected]+opengl ldflags="-ltinfo"

If I don't punt the -ltinfo flag, mesa will not compile.
Without the +opengl, qt will complain with the message above about basic_stringstream

@sethrj
Copy link
Copy Markdown
Contributor

sethrj commented Nov 21, 2020

@angel-devicente The failure with tinfo is most likely a missing ncurses+termlib dependency inside mesa -- pinging maintainers @chuckatkins and @v-dobrev to see if they know whether that should explicitly be included with mesa.

The stringstream error is very odd. I think it might be that qt has a missing dependency on llvm and is picking up something from the system (which is linked against different GCC libraries). I'm going to installing qt 5.14 on my (rhel7) system to see if it checks for clang/llvm. The Qt documentation hints at some use of Clang for QDoc...

@sethrj
Copy link
Copy Markdown
Contributor

sethrj commented Nov 21, 2020

@angel-devicente According to the QDoc page:

From Qt 5.11, QDoc requires Clang for parsing C++ header and source files

Can you post the full log/error file from your strstring error? We may just want to add a new doc variant that disables qdoc (and requires llvm+clang when enabled).

@angel-devicente
Copy link
Copy Markdown
Contributor Author

Hello,

here you have the full logs when I try to install qt without opengl, just like:

angelv@sieladon:~/spack$ spack install [email protected]%[email protected] ldflags="-ltinfo"

spack-build-out.txt
spack-build-env.txt

@sethrj
Copy link
Copy Markdown
Contributor

sethrj commented Nov 22, 2020

@angel-devicente This confirms my suspicions -- on your build QDoc is enabled, whereas on mine (pretty vanilla rhel7) I get a message

WARNING: QDoc will not be compiled, probably because libclang could not be located. This means that you cannot build the Qt documentation.

So your build is picking up the system installation of LLVM, and it's trying to link an incompatible GCC library against it (note in your build log how the error is at bin/qdoc).

I'll add (and default to OFF) a doc variant that fixes that error at least -- and it might fix your ltinfo error as well.

The reason your build probably works with +opengl is that mesa defaults to using LLVM, which pulls it in to the environment so that qt picks up a consistently linked spack version of llvm rather than the system version.

@sethrj
Copy link
Copy Markdown
Contributor

sethrj commented Nov 22, 2020

@v-dobrev
Copy link
Copy Markdown
Member

The failure with tinfo is most likely a missing ncurses+termlib dependency inside mesa -- pinging maintainers @chuckatkins and @v-dobrev to see if they know whether that should explicitly be included with mesa.

Looking at the mesa dependencies in the Spack package, it seems ncurses is a build-only dependency, e.g. through binutils. If you can post the spack build log for this failure (just building mesa), it will be helpful to track down the issue.

@angel-devicente
Copy link
Copy Markdown
Contributor Author

Hi @v-dobrev,

OK, so here it is. The command I issued was:
spack install [email protected]%[email protected]+opengl to make sure I didn't have the other problem related to strstring. When doing this, it fails at the "mesa" installation, and these are the log files for it, where you can see the errors about "undefined references" to setupterm, etc.

Cheers,

spack-build-out.txt
spack-build-env.txt

@v-dobrev
Copy link
Copy Markdown
Member

Regarding the mesa build issue: I see the following warnings from Meson:

...
WARNING: CMake: Dependency z for LLVM target LLVMSupport was not found
WARNING: CMake: Dependency rt for LLVM target LLVMSupport was not found
WARNING: CMake: Dependency dl for LLVM target LLVMSupport was not found
WARNING: CMake: Dependency tinfo for LLVM target LLVMSupport was not found
WARNING: CMake: Dependency m for LLVM target LLVMSupport was not found
...

The tinfo warning seems to be the problem. I'm not sure why it was not found: Meson seems to search CMAKE_PREFIX_PATH which contains the path to the Spack-built ncurses-6.2.

According to https://docs.mesa3d.org/meson.html#llvm: "Due to the way LLVM implements its CMake finder it will only find static libraries, it will never find libllvm.so." Maybe this is the issue.

As a workaround, we can probably tell Spack to inject the flag -ltinfo specifically when building/linking mesa+llvl.

@angel-devicente
Copy link
Copy Markdown
Contributor Author

Hello,

so I understand that now you can modify the packages for mesa and qt to workaround these issues.

Is there any other test that you would like me to do?

Many thanks,

@sethrj
Copy link
Copy Markdown
Contributor

sethrj commented Nov 25, 2020

@angel-devicente Thanks for your patience with this MR. Can you rebase off master now that #19963 has been merged? I think instead of doing an always-on patch you can incorporate your change into the (newly created) qt5-15-gcc-10.patch file, which has better constraints on when it's applied.

If you want, you can also test #20078 to see if that fixes the no-opengl build on your system. I've tried to get it to skip the qtdoc which was giving you problems based on the mis-linked llvm.

@angel-devicente
Copy link
Copy Markdown
Contributor Author

Hello,

I tried with the latest version in develop (which includes #19963) and applied you commit for #20078.

But no luck when I try to install spack install [email protected]%[email protected]

The patch in 19963 only applies to gcc@10: and I'm having the problem with [email protected], so I'm trying to see what part of my original patch is still needed (definitely I need to patch qjp2handler.cpp but not sure about the others yet, since compilation stopped with the strstring error. Not sure what is going on, because I can see that doc was not included:

angelv@sieladon:~$ spack spec  [email protected]%[email protected] | grep qt
==> Warning: [email protected] cannot build optimized binaries for "cascadelake". Using best target possible: "skylake_avx512"
[email protected]%[email protected]
[email protected]%[email protected]~dbus~debug~doc~examples~framework~gtk+gui~opengl~phonon+shared+sql+ssl+tools~webkit patches=7f34d48d2faaa108dc3fcc47187af1ccd1d37ee0f931b42597b820f03a99864c,8449b9fba2e0a771a9f6b43f9aedcfb8c256e9945b86b54c2ac0484c352230bc arch=linux-arch-skylake_avx512

but it still seems to be needing llvm:

             j/previewmanager.o shared/previewmanager.cpp                                                                                                                                                            
  >> 9133    /usr/bin/ld: /lib/../lib64/../lib/libLLVM-10.so: undefined reference to `std::_                                                                                                                         
             _cxx11::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >                                                                                                                         
             ::basic_stringstream()@@GLIBCXX_3.4.26'                                                                                                                                                                 
  >> 9134    collect2: error: ld returned 1 exit status                                                                                                                                                              
     9135    make[3]: *** [Makefile:232: ../../bin/qdoc] Error 1 

I will keep trying, but compiling Qt takes a lot of time...

@sethrj
Copy link
Copy Markdown
Contributor

sethrj commented Nov 26, 2020

Arg, thanks @angel-devicente . Can you post the whole configure output so maybe I can try again to fix? I can't really replicate your error since I don't have any platform with a system-level LLVM installation.

I forgot that your errors were with gcc 8, not 10 -- so we probably want to adjust the patch applicability back that far. Or just patch regardless since there might be other compilers that need the include.

@angel-devicente
Copy link
Copy Markdown
Contributor Author

Hello,
so here are the files for this latest attempt. As mentioned in my previous message this is the latest (as of yesterday) version in develop (which includes #19963), applying your commit for #20078, and patching qjp2handler.cpp.

The installation command was:

spack install [email protected]%[email protected]

And I attach the two log files.

Cheers,

spack-build-env.txt
spack-build-out.txt

@sethrj
Copy link
Copy Markdown
Contributor

sethrj commented Nov 28, 2020

All right @angel-devicente , I think I've fixed the llvm/qtdoc issue for real now: I tested by manually inserting llvm into my system path and making sure the qt configure ignores it now. I also bumped the patch from #19963 to apply from gcc 8 onward.

@angel-devicente
Copy link
Copy Markdown
Contributor Author

Hi,
I just tested with your latest changes. qt5.15.2 with gcc8.3.0 builds nicely now. As for qt5.14.2, I still need to apply part of my original patch.

I have force-pushed to my forked branch (https://github.com/angel-devicente/spack/tree/qt5-14.archlinux) to reflect the necessary changes.

@sethrj
Copy link
Copy Markdown
Contributor

sethrj commented Nov 29, 2020

@angel-devicente excellent! Since your patch won’t break anything for other compilers, and other compiler versions might fail without it, can you remove the compiler restriction? That should be the last change 😄

tested only for gcc8.3.0 but should be safe for other compilers
@angel-devicente
Copy link
Copy Markdown
Contributor Author

angel-devicente commented Nov 29, 2020 via email

@sethrj sethrj merged commit 08c9a6e into spack:develop Nov 29, 2020
bollig pushed a commit to bollig/spack that referenced this pull request Jan 12, 2021
tested only for gcc8.3.0 but should be safe for other compilers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants