Path: ...!eternal-september.org!feeder3.eternal-september.org!panix!.POSTED.www.mrbrklyn.com!not-for-mail From: Popping Mad Newsgroups: comp.lang.perl.misc Subject: Re: Image::Imlib2 error Date: Sun, 30 Mar 2025 06:33:39 -0400 Organization: PANIX Public Access Internet and UNIX, NYC Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Date: Sun, 30 Mar 2025 10:33:39 -0000 (UTC) Injection-Info: reader1.panix.com; posting-host="www.mrbrklyn.com:96.57.23.83"; logging-data="27503"; mail-complaints-to="abuse@panix.com" User-Agent: Mozilla Thunderbird Content-Language: en-US In-Reply-To: Bytes: 5740 Lines: 139 On 3/29/25 6:32 PM, Popping Mad wrote: > On 3/28/25 12:35 PM, Popping Mad wrote: >> I have an old image gallery that uses this libary in apache2 and modperl >> >> I made a small test program is it behaves like the server code >> >> #!/usr/bin/perl >> use warnings; >> >> use Image::Imlib2; >> my $image; >> #my $pic = >> qq(/usr/local/apache2/htdocs/images/2025_purim_amsterdam/DSC03652.JPG); >> my $pic = qq(/home/ruben/20130303_133505.jpg); >> if (-e $pic) { >> print STDERR "File Exists ==> $pic\n"; >> $image = Image::Imlib2->load($pic); >> } >> $image->save("/home/ruben/out.jpg"); >> >> [ruben@www3 Image]$ ~/bin/testimlib.pl >> File Exists ==> /home/ruben/20130303_133505.jpg >> Image::Imlib2 load error: No loader for file format at >> /home/ruben/bin/testimlib.pl line 10. >> >> the load() method seems to no longer recognize the file types to decode >> them. It is very fustrating. I looked at the code in >> >> /usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux-thread-multi/Image/Imlib2.pm >> >> I can't even see the method load or where it might be inherited from >> >> package Image::Imlib2; >> >> use strict; >> use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD); >> >> require Exporter; >> require DynaLoader; >> >> @ISA = qw(Exporter DynaLoader); >> >> # Items to export into callers namespace by default. Note: do not export >> # names by default without a very good reason. Use EXPORT_OK instead. >> # Do not simply export all your public functions/methods/constants. >> @EXPORT = qw( >> TEXT_TO_RIGHT >> TEXT_TO_LEFT >> TEXT_TO_UP >> TEXT_TO_DOWN >> TEXT_TO_ANGLE >> ); >> $VERSION = '2.03'; >> >> bootstrap Image::Imlib2 $VERSION; >> >> Image::Imlib2->set_cache_size(0); >> >> sub new_transparent { >> my ( $pkg, $x, $y ) = @_; >> my $pixel = pack( 'CCCC', 0, 0, 0, 0 ); # ARGB >> return Image::Imlib2->new_using_data( $x, $y, $pixel x ( $x * $y ) ); >> } >> >> sub new_using_data { >> my ( $pkg, $x, $y, $data ) = @_; >> if ( defined $data && 4 * $x * $y == length $data ) { >> return $pkg->_new_using_data( $x, $y, $data ); >> } else { >> return undef; >> } >> } >> >> sub autocrop { >> my $image = shift; >> my ( $x, $y, $w, $h ) = $image->autocrop_dimensions; >> return $image->crop( $x, $y, $w, $h ); >> } >> >> 1; >> >> >> >> It is not that large really. >> >> I do find it in the source code for the module in the C library >> >> [ruben@www3 Image]$ pwd >> /home/ruben/.cpan/build/Image-Imlib2-2.03-6/lib/Image >> [ruben@www3 Image]$ >> [ruben@www3 Image]$ grep load ./* >> ./Imlib2.c:XS_EUPXS(XS_Image__Imlib2_load); /* prototype to pass >> -Wmissing-prototypes */ >> ./Imlib2.c:XS_EUPXS(XS_Image__Imlib2_load) >> ./Imlib2.c: image = imlib_load_image_with_error_return >> (filename, &err); >> ./Imlib2.c: Perl_croak(aTHX_ "Image::Imlib2 load error: >> File does not exist"); >> ./Imlib2.c: Perl_croak(aTHX_ "Image::Imlib2 load error: >> File is directory"); >> ./Imlib2.c: Perl_croak(aTHX_ "Image::Imlib2 load error: >> Permission denied"); >> ./Imlib2.c: Perl_croak(aTHX_ "Image::Imlib2 load error: >> No loader for file format"); >> ./Imlib2.c:XS_EUPXS(XS_Image__Imlib2_load_font); /* prototype to pass >> -Wmissing-prototypes */ >> ./Imlib2.c:XS_EUPXS(XS_Image__Imlib2_load_font) >> ./Imlib2.c: "Image::Imlib2::load_font", >> ./Imlib2.c: font = imlib_load_font(fontname); >> ./Imlib2.c: (void)newXSproto_portable("Image::Imlib2::load", >> XS_Image__Imlib2_load, file, "$$"); >> ./Imlib2.c: (void)newXSproto_portable("Image::Imlib2::load_font", >> XS_Image__Imlib2_load_font, file, >> >> I really need to fix this :( >> >> I would appreciate any help I can get. I never put a C program in perl >> code I don't even see how it inherited the load method or any >> constructor for image types. >> > > I fixed the Images::Imlib2 cpan package so it will at least compile by > hard coding the pkg-config file instead of the removed imlib2-config > But it is still not finding the image modules that are used by > Image::Imlib2->load() > I'm not really sure where that is even being inherited from > because I never worked with a C code project encalsulated by perl > > the debugger won't step into the load method eithe > Hello, imlib2-config was removed in imlib2 version 1.7.5 from 2021. imlib2 is now at version 1.12.4. Please use pkg-config instead. The "can't find loaders" problem you see may happen if the perl module dlopens libImlib2.so with RTLD_LOCAL instead of RTLD_GLOBAL. A change was introduced in imlib2 version 1.12.4 that requires libImlib2.so to be loaded with RTLD_GLOBAL. /Kim