codeblocks 64bit-portability-issue

I get error:

E: codeblocks 64bit-portability-issue bzlib.c:1431

bzlib.c:1431

      fp = fdopen(fd,mode2);

all function:

static
BZFILE * bzopen_or_bzdopen
               ( const char *path,   /* no use when bzdopen */
                 int fd,             /* no use when bzdopen */
                 const char *mode,
                 int open_mode)      /* bzopen: 0, bzdopen:1 */
{
   int    bzerr;
   char   unused[BZ_MAX_UNUSED];
   int    blockSize100k = 9;
   int    writing       = 0;
   char   mode2[10]     = "";
   FILE   *fp           = NULL;
   BZFILE *bzfp         = NULL;
   int    verbosity     = 0;
   int    workFactor    = 30;
   int    smallMode     = 0;
   int    nUnused       = 0;

   if (mode == NULL) return NULL;
   while (*mode) {
      switch (*mode) {
      case 'r':
         writing = 0; break;
      case 'w':
         writing = 1; break;
      case 's':
         smallMode = 1; break;
      default:
         if (isdigit((int)(*mode))) {
            blockSize100k = *mode-BZ_HDR_0;
         }
      }
      mode++;
   }
   strcat(mode2, writing ? "w" : "r" );
   strcat(mode2,"b");   /* binary mode */

   if (open_mode==0) {
      if (path==NULL || strcmp(path,"")==0) {
        fp = (writing ? stdout : stdin);
        SET_BINARY_MODE(fp);
      } else {
        fp = fopen(path,mode2);
      }
   } else {
#ifdef BZ_STRICT_ANSI
      fp = NULL;
#else
      fp = fdopen(fd,mode2);
#endif
   }
   if (fp == NULL) return NULL;

   if (writing) {
      /* Guard against total chaos and anarchy -- JRS */
      if (blockSize100k < 1) blockSize100k = 1;
      if (blockSize100k > 9) blockSize100k = 9;
      bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k,
                             verbosity,workFactor);
   } else {
      bzfp = BZ2_bzReadOpen(&bzerr,fp,verbosity,smallMode,
                            unused,nUnused);
   }
   if (bzfp == NULL) {
      if (fp != stdin && fp != stdout) fclose(fp);
      return NULL;
   }
   return bzfp;
}

Do you have any idea how to solve that?

When did you get this error message and what do you want to do?
What do you want to install and how do you install (zypper/ YaST)?

When I’m build Code::Blocks RPM package in OBS for opensuse 12.3 and higher.

Hm, I don’t see anything wrong there. The types are all ok.

Maybe that file misses an “#include <stdio.h>” and therefore fdopen is not declared (so the compiler would expect the return code and mode2 to be int)?
Try to patch that in.

???
AFAICS codeblocks builds just fine in your home repo, for 12.3, 13.1, and Factory. :\

not build one codebloc contrib plugins I removed it.

No stdio.h include in bzlib.c.
All build log

Yes, but there is one in bzlib_private.h which is included by bzlib.c, although only if BZ_NO_STDIO is not defined. Maybe that is somehow defined causing the problem?
Your build log confirms that stdio.h is not included: (fdopen is declared in stdio.h)

  683s] bzlib.c: In function 'bzopen_or_bzdopen':
  683s] bzlib.c:1431:7: warning: implicit declaration of function 'fdopen' -Wimplicit-function-declaration]
  683s]        fp = fdopen(fd,mode2);
  683s]        ^
  683s] bzlib.c:1431:10: warning: assignment makes pointer from integer without a cast [enabled by default]
  683s]        fp = fdopen(fd,mode2);
  683s]           ^

So maybe try to patch out that “#ifndef BZ_NO_STDIO” in line 27 of bzlib_private.h, or patch in “#include <stdio.h>” in bzlib.c, or find out why BZ_NO_STDIO is defined and change that (maybe some configure switch?).

The only thing about BZ2 I can find in your build log (or in the configure script) is this:

  153s] checking for library containing BZ2_bzopen... no

So maybe it would suffice to add “BuildRequires: libbz2-devel” ?

Thanks. rotfl!

Confirmed, adding “BuildRequires: libbz2-devel” fixes the build! :slight_smile: