Menu

#2659 Build fails when libzip is not available

None
closed-fixed
nobody
None
2023-12-30
2023-10-05
Anonymous
No

This is based on gnuplot 5.4.9. I haven't tried to figure out exactly when i twas introduced, but it was no present in 5.4.5.

If you try to build gnuplot without libzip installed, building fails in post.trm. Specifically, starting from line 4002, that file contains:

#ifdef HAVE_DEFLATE_ENCODER
    if (ps_params->level3) {
    encoded_image = (void *)PS_encode_png_image(M, N, image, color_mode,
                        bits_per_component, max_colors, cscale,
                        &num_encoded_bytes);
    } else {
#endif
    encoded_image = PS_encode_image(M, N, image, color_mode,
                    bits_per_component, max_colors, cscale,
                    (ps_params->level1 ? PS_ASCII_HEX : PS_ASCII85),
                    &num_encoded_bytes);
    }


    fputs("%%%%BeginImage\n", gppsfile);

The closing curly brace at line 4013 is intended to match the opening curly brace at line 4007. But when HAVE_DEFLATE_DECODER is not defined, there is no matching opening brace, so the brace at line 4013 ends the function, and the fputs is rejected, because it's outside any function.

The obvious fix is to enclose the closing curly brace in #ifdef as well:

#ifdef HAVE_DEFLATE_ENCODER
    if (ps_params->level3) {
    encoded_image = (void *)PS_encode_png_image(M, N, image, color_mode,
                        bits_per_component, max_colors, cscale,
                        &num_encoded_bytes);
    } else {
#endif
    encoded_image = PS_encode_image(M, N, image, color_mode,
                    bits_per_component, max_colors, cscale,
                    (ps_params->level1 ? PS_ASCII_HEX : PS_ASCII85),
                    &num_encoded_bytes);
#ifdef HAVE_DEFLATE_ENCODER
    }
#endif


    fputs("%%%%BeginImage\n", gppsfile);

Discussion

  • Ethan Merritt

    Ethan Merritt - 2023-10-05

    Duplicate. Already fixed in 6.1, will be in 6.0 rc3

     
  • Ethan Merritt

    Ethan Merritt - 2023-10-05
    • status: open --> pending-duplicate
    • Group: -->
    • Priority: -->
     
  • Ethan Merritt

    Ethan Merritt - 2023-12-30
    • Status: pending-duplicate --> closed-fixed
     

Log in to post a comment.