Menu

#77 Cant compile with gcc 11.2.1 - on Gentoo

1.2
closed
nobody
None
X11
1.0
2022-12-24
2022-01-05
Psilovybin
No

here's the error I get a few minutes into compilation:

make[1]: Leaving directory '/home/doc/Downloads/syncterm-20220104/src/hash'
Linking gcc.linux.x64.exe.debug/syncterm
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: /home/doc/Downloads/syncterm-20220104/src/../3rdp/gcc.linux.x64.debug/cl/libcl.a(sendmsg.o): in function `waitForObject':
sendmsg.c:(.text+0x10c6): undefined reference to `pthread_yield'
collect2: error: ld returned 1 exit status
make: *** [GNUmakefile:111: gcc.linux.x64.exe.debug/syncterm] Error 1

Discussion

  • Stephen James Hurd

    Could you rebuild with VERBOSE=1 passed on the make command-line and provide the ld command used? The manpage for pthread_yield on Gentoo may help as well.

    pthread_yield() is a terrible non-portable function, but it's always been available on Linux as far as I've seen.

     
    • Psilovybin

      Psilovybin - 2022-01-17

      man page for pthread_yield shows this":

      VERSIONS
      Since glibc 2.34, this function is marked as deprecated.

      Full Build Log at https://pastebin.com/V0Pxyqk3

       
  • Psilovybin

    Psilovybin - 2022-01-17

    Ah, just realized i could upload attachment

     
  • chrll

    chrll - 2022-02-26

    I also have this problem, but I'm using Arch Linux. I'm including my log.

    (my man page also says "Since glibc 2.34, this function is marked as deprecated.")

     

    Last edit: chrll 2022-02-26
  • Aaron Brown

    Aaron Brown - 2022-04-06

    Also failing on Fedora35

     
  • Anonymous

    Anonymous - 2022-04-21

    Failing here too, also on Arch.

     
  • Paul Dufresne

    Paul Dufresne - 2022-04-27

    I believe the problem is that for Linux with GNU, PTHREAD_YIELD is wrongly defined as pthread_yield, but man pthread_yield say it is deprecated, and sched_yield() should be used instead. As explained in the thread.h of cl (cryptlib), sched_yield is the right choice after the standard confusion (two parralel versions, they were unsure which would be standardized).
    /syncterm-1.1/3rdp/src/cl/kernel/thread.h:3015 have:

    else

    #if defined( linux ) && !defined( __USE_GNU )
    void pthread_yield( void );
    #endif / Present but not prototyped unless GNU extensions are enabled /
    #define THREAD_YIELD() pthread_yield()

    should be #define THREAD_YIELD sched_yield()

    I believe some compatibility define has been removed in Ubuntu lately:
    https://sourceware.org/git/?p=glibc.git;a=commit;h=c2fd60a5861efef48252f5cc7efc70e1d8a0da9a
    and so in Ubuntu 22.04 it does not compile anymore.

    That said, I tried to change the file directly, and remove syncterm-1.1-src/syncterm-1.1/3rdp/gcc.linux.x64.debug/cl/libcl.a, but that does not work, because I believe the .zip is redecompress and so a new patch file must be made.

     
  • Paul Dufresne

    Paul Dufresne - 2022-04-27

    cryptlib 3.4.6 (release candidate) have:

    elif defined( linux )

    / Under newer versions of Linux, once they got the threading model sorted
    out via the NPTL vs. earlier LinuxThreads and others, sched_yield() ==
    pthread_yield() (that is, pthread_yield() is just a wrapper for
    sched_yield() in pthread_yield.c). In addition some newer distros
    mangle the wrapper in glibc so that linking fails if we use
    pthread_yield() but not if we use sched_yield(). To deal with this, if
    the OS version is new enough that threading is standardised via NPTL we
    use sched_yield() rather than pthread_yield()
    /
    #if ( OSVERSION > 3 )
    #include <sched.h>
    #define THREAD_YIELD() sched_yield()
    #else
    #ifndef __USE_GNU
    void pthread_yield( void );
    #endif / Present but not prototyped unless GNU extensions are enabled /
    #define THREAD_YIELD() pthread_yield()
    #endif / Linux > 3.x /</sched.h>

    else

    #define THREAD_YIELD() pthread_yield()

    endif / Not-very-portable Posix portability /

    I tried to replace the zip file by the new version but then some patch does not apply anymore.

     
  • Paul Dufresne

    Paul Dufresne - 2022-04-27

    I was not using git clone https://gitlab.synchro.net/main/sbbs.git
    and it seems fixed there (I change hard disk since yesterday, but using Xubuntu 22.04, yesterday Ubuntu 22.04). I looked at the modified thread.h file and it seems ok:

    paul@kasparno:~/sbbs/3rdp/build$ git log cl-linux-yield.patch
    commit 53264f2b0f20d28508ecdc611b7dfba385e27350
    Author: Rob Swindell rob@synchro.net
    Date: Tue Oct 19 12:55:56 2021 -0700

    Use shed_yield() instead of pthread_yield() on Linux
    
    Per https://man7.org/linux/man-pages/man3/pthread_yield.3.html
            This call is nonstandard, but present on several other systems.
            Use the standardized sched_yield(2) instead.
    
    Should fix #299.
    
     
  • Stephen James Hurd

    • status: open --> closed
     

Anonymous
Anonymous

Add attachments
Cancel