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

Gentoo fix #3560

Merged
merged 2 commits into from
Oct 9, 2017
Merged

Gentoo fix #3560

merged 2 commits into from
Oct 9, 2017

Conversation

hcorion
Copy link
Member

@hcorion hcorion commented Oct 9, 2017

Fixes #3166 (hopefully doesn't break anything else)
EDIT: Please wait until the Gentoo user facing the issue has reported it's fixed before merging.

@soredake
Copy link

soredake commented Oct 9, 2017

Compiled and launched without problems (not tested any games), thanks!

@v-fox
Copy link

v-fox commented Oct 24, 2017

Unfortunately, it broke openSUSE right after it was introduced into OBS :( Reverting with USE_SHARED_LLVM_LIBS fixes it.

And is it really a good idea for an app to keep its own version of giant compiler on Linux of all things ? Whatever is "interferes" with Mesa should be fixed there, as is this "primitive restart" problem.
Maybe it has something to do with this Mesa/Vulkan/LLVM issue ?

@v-fox
Copy link

v-fox commented Oct 24, 2017

Aaaand then it links with its own copy of "libhidapi-hidraw.so" (which it doesn't install) while system is having "libhidapi-hidraw.so.0", so it can't be installed.

@hcorion
Copy link
Member Author

hcorion commented Oct 24, 2017

Yes, it is still very much necessary to link statically against LLVM. It's not a mesa bug, it's an issue with the way LLVM works. This has nothing to do with the "primitive restart" you mentioned.

Looking at the OpenSUSE build, it has this CMake flag, -DCMAKE_EXE_LINKER_FLAGS="$(llvm-config --libs mcjit vectorize ipo x86codegen x86disassembler)", have you tried removing that?

What exactly does it fail with?

I'm pretty sure hidapi links statically against RPCS3.

@v-fox
Copy link

v-fox commented Oct 24, 2017

Yes, it is still very much necessary to link statically against LLVM. It's not a mesa bug, it's an issue with the way LLVM works. This has nothing to do with the "primitive restart" you mentioned.

I didn't say that it has something to do with "primitive restart", I've linked Mesa/DRI driver loading bug in FreeDesktop. "primitive restart" part was about how instead of making assumptions and permanent workarounds it would be better to ask driver developers directly if you have to. Let them fix these things for everyone. In fact, it's their job, there is paid AMD, Intel, Red Hat, HP, etc. staff in there.

Looking at the OpenSUSE build, it has this CMake flag, -DCMAKE_EXE_LINKER_FLAGS="$(llvm-config --libs mcjit vectorize ipo x86codegen x86disassembler)", have you tried removing that?

That's the first thing I did. It's just adds '-lLLVM', I think. But all those "LLVMCore, etc." files simply don't exist in openSUSE. Nothing short of removing ''llvm_map_components_to_libnames" helped. Strangely, these files were mentioned in my 'locate' database, meaning that may have been removed on LLVM update to 4.0.1. In fact, in update changelog I see this:
"Tue Oct 10 12:14:31 UTC 2017 - msrb@suse.com

  • Drop llvm4-devel-static. llvm4-devel contains shared library with the same content."

But they also fixed that loading bug which I linked earlier. So maybe that resolved your issue with linking or something similar could be done. Otherwise someone will have to convince openSUSE maintainers revert their change just to keep things weird like that which is almost impossible since they are the stubbornest.

I'm pretty sure hidapi links statically against RPCS3.

I would think so and there are line in build log like '… -lGL ../3rdparty/hidapi/linux/libhidapi-hidraw.so -ludev -ldl -lpthread -lz -lrt -lX11 -lasound -lpulse-simple -lpulse -levdev -lvulkan -lavformat -lavcodec -lavutil -lswresample -lswscale -lpng -lz /usr/lib64/libLLVM.so.4.0.1 …' but OBS seems to be insistent on adding 'libhidapi-hidraw.so()(64bit)' as requirement that can't be installed. Which is weird, since such file exist, but as a link to 'libhidapi-hidraw.so.0.0.0' (actual binary from 'libhidapi-hidraw0') in package 'libhidapi-devel'. Maybe it's better to remove system libhidapi from my build and see if it helps it to not be confused.

@v-fox
Copy link

v-fox commented Oct 27, 2017

What exactly does it fail with?
I'm pretty sure hidapi links statically against RPCS3.

I've managed to remove openSUSE's default cmake and compiler options, then it linked properly with static version without adding non-existent dependencies. Probably had something to do with -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=OFF. The usual full cmake OBS command is something like:

/usr/bin/cmake /home/abuild/rpmbuild/BUILD/<package_dir>/. '-GUnix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/usr -DINCLUDE_INSTALL_DIR:PATH=/usr/include -DLIB_INSTALL_DIR:PATH=/usr/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/share -DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib64 -DCMAKE_BUILD_TYPE=RelWithDebInfo '-DCMAKE_C_FLAGS=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -DNDEBUG' '-DCMAKE_CXX_FLAGS=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -DNDEBUG' '-DCMAKE_Fortran_FLAGS=-fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -DNDEBUG' '-DCMAKE_EXE_LINKER_FLAGS=-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' '-DCMAKE_MODULE_LINKER_FLAGS=-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' '-DCMAKE_SHARED_LINKER_FLAGS=-Wl,--as-needed -Wl,--no-undefined -Wl,-z,now' -DLIB_SUFFIX=64 -DCMAKE_SKIP_RPATH:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_STATIC_LIBS:BOOL=OFF -DCMAKE_COLOR_MAKEFILE:BOOL=OFF -DCMAKE_INSTALL_DO_STRIP:BOOL=OFF -DCMAKE_MODULES_INSTALL_DIR=/usr/share/cmake/Modules

@hcorion hcorion mentioned this pull request May 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gentoo LLVM linking problem
4 participants