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

CMake: Link OSDependent with Threads::Threads #1624

Merged
merged 1 commit into from
Dec 10, 2018

Conversation

akien-mga
Copy link
Contributor

Would typically be pthreads.
Without this, '-Wl,--no-undefined' would output these errors:

/usr/bin/ld: OSDependent/Unix/libOSDependent.a(ossource.cpp.o): in function `glslang::OS_CleanupThreadData()':
/home/akien/Mageia/Sandbox/_rpm/BUILD/glslang-7.10.2984/glslang/OSDependent/Unix/ossource.cpp:83: undefined reference to `__pthread_register_cancel'
/usr/bin/ld: /home/akien/Mageia/Sandbox/_rpm/BUILD/glslang-7.10.2984/glslang/OSDependent/Unix/ossource.cpp:93: undefined reference to `__pthread_unregister_cancel'
/usr/bin/ld: OSDependent/Unix/libOSDependent.a(ossource.cpp.o): in function `glslang::OS_AllocTLSIndex()':
/home/akien/Mageia/Sandbox/_rpm/BUILD/glslang-7.10.2984/glslang/OSDependent/Unix/ossource.cpp:122: undefined reference to `pthread_key_create'
/usr/bin/ld: OSDependent/Unix/libOSDependent.a(ossource.cpp.o): in function `glslang::OS_SetTLSValue(void*, void*)':
/home/akien/Mageia/Sandbox/_rpm/BUILD/glslang-7.10.2984/glslang/OSDependent/Unix/ossource.cpp:137: undefined reference to `pthread_setspecific'
/usr/bin/ld: OSDependent/Unix/libOSDependent.a(ossource.cpp.o): in function `glslang::OS_FreeTLSIndex(void*)':
/home/akien/Mageia/Sandbox/_rpm/BUILD/glslang-7.10.2984/glslang/OSDependent/Unix/ossource.cpp:162: undefined reference to `pthread_key_delete'
/usr/bin/ld: OSDependent/Unix/libOSDependent.a(ossource.cpp.o): in function `glslang::InitGlobalLock()':
/home/akien/Mageia/Sandbox/_rpm/BUILD/glslang-7.10.2984/glslang/OSDependent/Unix/ossource.cpp:175: undefined reference to `pthread_mutexattr_init'
/usr/bin/ld: /home/akien/Mageia/Sandbox/_rpm/BUILD/glslang-7.10.2984/glslang/OSDependent/Unix/ossource.cpp:176: undefined reference to `pthread_mutexattr_settype'
/usr/bin/ld: OSDependent/Unix/libOSDependent.a(ossource.cpp.o): in function `glslang::OS_GetTLSValue(void*)':
/home/akien/Mageia/Sandbox/_rpm/BUILD/glslang-7.10.2984/glslang/OSDependent/Unix/ossource.cpp:149: undefined reference to `pthread_getspecific'

Ref. #1484.

Would typically be pthreads.
Without this, '-Wl,--no-undefined' would output these errors:

/usr/bin/ld: OSDependent/Unix/libOSDependent.a(ossource.cpp.o): in function `glslang::OS_CleanupThreadData()':
/home/akien/Mageia/Sandbox/_rpm/BUILD/glslang-7.10.2984/glslang/OSDependent/Unix/ossource.cpp:83: undefined reference to `__pthread_register_cancel'
/usr/bin/ld: /home/akien/Mageia/Sandbox/_rpm/BUILD/glslang-7.10.2984/glslang/OSDependent/Unix/ossource.cpp:93: undefined reference to `__pthread_unregister_cancel'
/usr/bin/ld: OSDependent/Unix/libOSDependent.a(ossource.cpp.o): in function `glslang::OS_AllocTLSIndex()':
/home/akien/Mageia/Sandbox/_rpm/BUILD/glslang-7.10.2984/glslang/OSDependent/Unix/ossource.cpp:122: undefined reference to `pthread_key_create'
/usr/bin/ld: OSDependent/Unix/libOSDependent.a(ossource.cpp.o): in function `glslang::OS_SetTLSValue(void*, void*)':
/home/akien/Mageia/Sandbox/_rpm/BUILD/glslang-7.10.2984/glslang/OSDependent/Unix/ossource.cpp:137: undefined reference to `pthread_setspecific'
/usr/bin/ld: OSDependent/Unix/libOSDependent.a(ossource.cpp.o): in function `glslang::OS_FreeTLSIndex(void*)':
/home/akien/Mageia/Sandbox/_rpm/BUILD/glslang-7.10.2984/glslang/OSDependent/Unix/ossource.cpp:162: undefined reference to `pthread_key_delete'
/usr/bin/ld: OSDependent/Unix/libOSDependent.a(ossource.cpp.o): in function `glslang::InitGlobalLock()':
/home/akien/Mageia/Sandbox/_rpm/BUILD/glslang-7.10.2984/glslang/OSDependent/Unix/ossource.cpp:175: undefined reference to `pthread_mutexattr_init'
/usr/bin/ld: /home/akien/Mageia/Sandbox/_rpm/BUILD/glslang-7.10.2984/glslang/OSDependent/Unix/ossource.cpp:176: undefined reference to `pthread_mutexattr_settype'
/usr/bin/ld: OSDependent/Unix/libOSDependent.a(ossource.cpp.o): in function `glslang::OS_GetTLSValue(void*)':
/home/akien/Mageia/Sandbox/_rpm/BUILD/glslang-7.10.2984/glslang/OSDependent/Unix/ossource.cpp:149: undefined reference to `pthread_getspecific'
@johnkslang johnkslang merged commit a10e6e9 into KhronosGroup:master Dec 10, 2018
@archimedus
Copy link
Contributor

This change leads Vulkan CTS to fail under Ubuntu 14.04 like:

/usr/bin/c++ -Wall -Wextra -Wno-long-long -Wshadow -Wundef -Wconversion -Wno-sign-conversion -std=c++03 -Wno-delete-non-virtual-dtor -fwrapv -fvisibility=hidden -fvisibility-inlines-hidden -Wno-conversion -Wno-unused-function -g external/openglcts/modules/CMakeFiles/glcts.dir///__/framework/platform/tcuMain.cpp.o external/openglcts/modules/CMakeFiles/glcts.dir/glcTestPackageEntry.cpp.o -o external/openglcts/modules/glcts -rdynamic framework/platform/libtcutil-platform.a external/openglcts/modules/libglcts-package.a external/vulkancts/framework/vulkan/libvkutil.a external/vulkancts/framework/vulkan/libvkutilnoshader.a external/spirv-tools/spirv-tools/source/opt/libSPIRV-Tools-opt.a external/openglcts/modules/common/libglcts-common-nocontext-package.a external/openglcts/modules/gl/libglcts-gl.a external/glslang/src/SPIRV/libSPIRV.a external/glslang/src/glslang/libglslang.a external/glslang/src/OGLCompilersDLL/libOGLCompiler.a external/glslang/src/glslang/OSDependent/Unix/libOSDependent.a -lThreads::Threads external/glslang/src/hlsl/libHLSL.a external/glslang/src/SPIRV/libSPVRemapper.a external/spirv-tools/spirv-tools/source/libSPIRV-Tools.a external/openglcts/modules/gtf/libglcts-gtf.a external/openglcts/GTF/libGTF_ES.a external/openglcts/modules/gtf/libglcts-gtf-wrapper.a external/openglcts/modules/gles2/libglcts-es2.a external/openglcts/modules/gles3/libglcts-es3.a external/openglcts/modules/gles31/libglcts-es31.a external/openglcts/modules/gles32/libglcts-es32.a external/openglcts/modules/glesext/libglcts-esext.a external/openglcts/modules/common/libglcts-common.a modules/egl/libdeqp-egl-package.a framework/egl/libeglutil.a framework/egl/wrapper/libeglwrapper.a modules/gles2/libdeqp-gles2-package.a modules/gles2/accuracy/libdeqp-gles2-accuracy.a modules/gles2/functional/libdeqp-gles2-functional.a modules/gles2/performance/libdeqp-gles2-performance.a modules/gles2/stress/libdeqp-gles2-stress.a modules/gles3/libdeqp-gles3-package.a modules/gles3/accuracy/libdeqp-gles3-accuracy.a modules/gles3/functional/libdeqp-gles3-functional.a modules/gles3/performance/libdeqp-gles3-performance.a modules/gles3/stress/libdeqp-gles3-stress.a modules/gles31/libdeqp-gles31-package.a modules/gles31/functional/libdeqp-gles31-functional.a modules/gles31/stress/libdeqp-gles31-stress.a modules/glshared/libdeqp-gl-shared.a framework/opengl/simplereference/libglutil-sglr.a framework/opengl/libglutil.a framework/opengl/wrapper/libglwrapper.a framework/referencerenderer/libreferencerenderer.a framework/randomshaders/librandomshaders.a framework/common/libtcutil.a framework/delibs/decpp/libdecpp.a framework/qphelper/libqphelper.a framework/delibs/deutil/libdeutil.a -lrt -ldl framework/delibs/dethread/libdethread.a framework/delibs/depool/libdepool.a framework/delibs/debase/libdebase.a -lm -lpthread external/libpng/libpng.a external/zlib/libz.a
/usr/bin/ld: cannot find -lThreads::Threads

Any ideas?

@akien-mga akien-mga deleted the osdependent-link-threads branch December 18, 2018 10:09
@akien-mga
Copy link
Contributor Author

Looking at CMake git history, Threads::Threads seems to be a feature added in CMake 3.1, so this change means that https://github.com/KhronosGroup/glslang/blob/master/CMakeLists.txt#L1-L3 should be changed to 3.1 as min version.

If this is not wanted, I could have a look at linking pthread directly without using the recommended Threads::Threads target.

@archimedus
Copy link
Contributor

I suppose it would be a good way out, though I suppose I need @johnkslang opinion.

@alegal-arm
Copy link
Contributor

CTS still supports Ubuntu 14 which uses cmake 2.8.12 by default. I'd prefer to not raise the version

@archimedus
Copy link
Contributor

I meant that a good way out would be:

If this is not wanted, I could have a look at linking pthread directly without using the recommended Threads::Threads target.

@alegal-arm

Thank you for details.

@akien-mga
Copy link
Contributor Author

I'll prepare a PR to fix the compat breakage then.

akien-mga added a commit to akien-mga/glslang that referenced this pull request Dec 18, 2018
As reported in KhronosGroup#1624, Ubuntu 14.04 LTS still uses CMake 2.8.12 which
does not support the Threads::Threads target (added in CMake 3.1).

This could be reverted once the required CMake version is bumped to 3.1+.
akien-mga added a commit to akien-mga/glslang that referenced this pull request Dec 18, 2018
As reported in KhronosGroup#1624, Ubuntu 14.04 LTS still uses CMake 2.8.12 which
does not support the Threads::Threads target (added in CMake 3.1).

This could be reverted once the required CMake version is bumped to 3.1+.
akien-mga added a commit to akien-mga/glslang that referenced this pull request Dec 18, 2018
As reported in KhronosGroup#1624, Ubuntu 14.04 LTS still uses CMake 2.8.12 which
does not support the Threads::Threads target (added in CMake 3.1).

This could be reverted once the required CMake version is bumped to 3.1+.
akien-mga added a commit to akien-mga/glslang that referenced this pull request Dec 18, 2018
As reported in KhronosGroup#1624, Ubuntu 14.04 LTS still uses CMake 2.8.12 which
does not support the Threads::Threads target (added in CMake 3.1).

This could be reverted once the required CMake version is bumped to 3.1+.
@archimedus
Copy link
Contributor

Looks good to me.

akien-mga added a commit to akien-mga/glslang that referenced this pull request Dec 18, 2018
As reported in KhronosGroup#1624, Ubuntu 14.04 LTS still uses CMake 2.8.12 which
does not support the Threads::Threads target (added in CMake 3.1).

This could be reverted once the required CMake version is bumped to 3.1+.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants