Giter VIP home page Giter VIP logo

Comments (2)

rdp avatar rdp commented on June 13, 2024 1

This is a weird one.

cmakelog:

Determining if the pthread_setname_np exist passed with the following output:
Change Dir: /home/rdp/new/sandbox/win64_static/source_files/srt/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_d7a70/fast && /usr/bin/gmake  -f CMakeFiles/cmTC_d7a70.dir/build.make CMakeFiles/cmTC_d7a70.dir/build
gmake[1]: Entering directory '/home/rdp/new/sandbox/win64_static/source_files/srt/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_d7a70.dir/CheckSymbolExists.c.obj
/usr/bin/x86_64-w64-mingw32-gcc -D_DARWIN_C_SOURCE -D_GNU_SOURCE -D_POSIX_SOURCE=1  -pthread -o CMakeFiles/cmTC_d7a70.dir/CheckSymbolExists.c.obj -c /home/rdp/new/sandbox/win64_static/source_files/srt/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_d7a70.exe
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_d7a70.dir/link.txt --verbose=1
/usr/bin/cmake -E rm -f CMakeFiles/cmTC_d7a70.dir/objects.a
/usr/bin/x86_64-w64-mingw32-ar qc CMakeFiles/cmTC_d7a70.dir/objects.a @CMakeFiles/cmTC_d7a70.dir/objects1.rsp
/usr/bin/x86_64-w64-mingw32-gcc  -pthread -Wl,--whole-archive CMakeFiles/cmTC_d7a70.dir/objects.a -Wl,--no-whole-archive -o cmTC_d7a70.exe -Wl,--out-implib,libcmTC_d7a70.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles/cmTC_d7a70.dir/linklibs.rsp
gmake[1]: Leaving directory '/home/rdp/new/sandbox/win64_static/source_files/srt/CMakeFiles/CMakeTmp'


File /home/rdp/new/sandbox/win64_static/source_files/srt/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef pthread_setname_np
  return ((int*)(&pthread_setname_np))[argc];
#else
  (void)argc;
  return 0;
#endif
}

It succeeds by using "-pthread" which (according to gcc) basically just means "-lpthread"

However I am attempting to use win32-pthreads from a different directory. Later compilation says:

[  2%] Building CXX object CMakeFiles/srt_virtual.dir/srtcore/api.cpp.obj
/usr/bin/x86_64-w64-mingw32-g++ -DCRYSPR2 -DENABLE_SOCK_CLOEXEC=1 -DHAI_ENABLE_SRT=1 -DHAI_PATCH=1 -DHAVE_CXX_STD_PUT_TIME=1 -DHAVE_INET_PTON=1 -DHAVE_PTHREAD_GETNAME_NP=1 -DHAVE_PTHREAD_SETNAME_NP=1 -DNDEBUG -DPTW32_STATIC_LIB=1 -DSRT_ENABLE_APP_READER -DSRT_ENABLE_CLOSE_SYNCH -DSRT_ENABLE_ENCRYPTION -DSRT_EXPORTS -DSRT_LOG_SLOWDOWN_FREQ_MS=1000 -DSRT_VERSION=\"1.5.3\" -DUSE_OPENSSL=1 -DWIN32=1 -D_GNU_SOURCE -D_WIN32_WINNT=0x0600 @CMakeFiles/srt_virtual.dir/includes_CXX.rsp -static -static-libstdc++ -fPIC   -DENABLE_LOGGING=1 -Wall -Wextra -O3 -DNDEBUG -MD -MT CMakeFiles/srt_virtual.dir/srtcore/api.cpp.obj -MF CMakeFiles/srt_virtual.dir/srtcore/api.cpp.obj.d -o CMakeFiles/srt_virtual.dir/srtcore/api.cpp.obj -c /home/rdp/new/sandbox/win64_static/source_files/srt/srtcore/api.cpp
In file included from /home/rdp/new/sandbox/win64_static/source_files/srt/srtcore/logging.h:34,
                 from /home/rdp/new/sandbox/win64_static/source_files/srt/srtcore/crypto.h:26,
                 from /home/rdp/new/sandbox/win64_static/source_files/srt/srtcore/handshake.h:51,
                 from /home/rdp/new/sandbox/win64_static/source_files/srt/srtcore/socketconfig.h:62,
                 from /home/rdp/new/sandbox/win64_static/source_files/srt/srtcore/queue.h:58,
                 from /home/rdp/new/sandbox/win64_static/source_files/srt/srtcore/api.h:62,
                 from /home/rdp/new/sandbox/win64_static/source_files/srt/srtcore/api.cpp:64:
/home/rdp/new/sandbox/win64_static/source_files/srt/srtcore/threadname.h: In static member function ‘static bool srt::ThreadName::ThreadNameImpl::get(char*)’:
/home/rdp/new/sandbox/win64_static/source_files/srt/srtcore/threadname.h:89:20: error: ‘pthread_getname_np’ was not declared in this scope; did you mean ‘pthread_getunique_np’?
   89 |             return pthread_getname_np(pthread_self(), namebuf, BUFSIZE) == 0;

there is a file /usr/x86_64-w64-mingw32/lib/libpthread.a that cmake appears to be "testing against" that does have it defined.
I think it's from winpthreads.
Not sure why it doesn't seem to be using -pthread at all, like it did when it tested, but also appears it wouldn't make a difference even if it did..

Then at compile time it is pulling in openssl' lib dir which happens to also have win32-pthreads' libpthread.a in it as well, so it ends up linking against that which is different and it fails.

One option: add in my shared lib dir -DCMAKE_C_FLAGS=" -L$build_files_dir/lib" so it tests the right version of pthreads. Another to not use win32-pthreads but use the internal winpthreads only.

A pretty weird edge case, maybe not worth fixing, at least there's plenty of work arounds, thanks!

from srt.

ethouris avatar ethouris commented on June 13, 2024

How exactly did your cmake then detect this function as existing? It's shown above in the cmake log.

It might be disputable if it was a linker error, but you definitely lack a header of this function here. Maybe in your system it's in a different header or something like this.

from srt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.