Menu

CTL_HW (and HW_NCPU) not defined problem.

2007-09-14
2013-05-23
  • Nobody/Anonymous

    Hi there.

    Apparently there's been a small change in newer kernels, sysctl doesn't recognise CTL_HW (and all the HW_ options) anymore. Didn't bother to search for any more info (like the interesting "why" and "since when" things), mainly because I've found the solution.
    For the most recent (cvsuped at 20070914) CVS, here's the patch:

    >> http://lain.pl/par2cmdline-cvs-cpudetection.diff

    The HW_ part of sysctl() is now `abandoned' in favor of sysconf(), which is even easier to use.

    The above patch checks whether CTL_HW is defined and uses sysctl() if it is, otherwise attempts to use sysconf(). Works fine for me.

    Also, I'm testing par2cmdline on Linux 2.6.22.5 SMP (x86_64 Core 2 Duo E6600 - yes, 64bit) and it works fine (the cvs ver, the older 0.4 release didn't work for files above 2^32 bytes in size). Generated .par2 files (two 4.2GB .isos) also checked in QuickPar under WinXP (32bit, pentium4) - everything seems to be ok.

    --
    ru.

     
    • Nobody/Anonymous

      I still get an error compiling the cvs version.
      (no changes in cvs since july 2007)

      any idea?

      g++ -Wall -g -O2   -o par2  par2cmdline.o commandline.o crc.o creatorpacket.o criticalpacket.o datablock.o descriptionpacket.o diskfile.o filechecksummer.o galois.o mainpacket.o md5.o par1fileformat.o par1repairer.o par1repairersourcefile.o par2creator.o par2creatorsourcefile.o par2fileformat.o par2repairer.o par2repairersourcefile.o recoverypacket.o reedsolomon.o verificationhashtable.o verificationpacket.o -lstdc++
      par2creator.o: In function `Par2Creator::CreateParityBlocks(unsigned long, unsigned int)':
      /home/jan/dev/par2-cmdline/par2creator.cpp:1073: undefined reference to `pthread_create'
      /home/jan/dev/par2-cmdline/par2creator.cpp:1088: undefined reference to `pthread_join'
      par2repairer.o: In function `Par2Repairer::RepairMissingBlocks(unsigned long, unsigned int)':
      /home/jan/dev/par2-cmdline/par2repairer.cpp:2611: undefined reference to `pthread_create'
      /home/jan/dev/par2-cmdline/par2repairer.cpp:2626: undefined reference to `pthread_join'
      par2repairer.o: In function `Par2Repairer::VerifyExtraFiles(std::list<CommandLine::ExtraFile, std::allocator<CommandLine::ExtraFile> > const&)':
      /home/jan/dev/par2-cmdline/par2repairer.cpp:1394: undefined reference to `pthread_create'
      /home/jan/dev/par2-cmdline/par2repairer.cpp:1409: undefined reference to `pthread_join'
      par2repairer.o: In function `Par2Repairer::VerifyTargetFiles()':
      /home/jan/dev/par2-cmdline/par2repairer.cpp:2684: undefined reference to `pthread_create'
      /home/jan/dev/par2-cmdline/par2repairer.cpp:2701: undefined reference to `pthread_join'
      par2repairer.o: In function `Par2Repairer::VerifySourceFiles()':
      /home/jan/dev/par2-cmdline/par2repairer.cpp:1258: undefined reference to `pthread_create'
      /home/jan/dev/par2-cmdline/par2repairer.cpp:1274: undefined reference to `pthread_join'
      collect2: ld gab 1 als Ende-Status zurück

      Linux version 2.6.22-14-generic (gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)) SMP
      it is 64 bit, on Athlon X2.

      JPT

       
    • Nobody/Anonymous

      sounds like you need to add -pthread to CFLAGS/LDFLAGS

       

Log in to post a comment.