LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-11-2016, 05:11 PM   #1
timsoft
Member
 
Registered: Oct 2004
Location: scotland
Distribution: slackware 15.0 64bit, 14.2 64 and 32bit and arm, ubuntu and rasbian
Posts: 495

Rep: Reputation: 144Reputation: 144
Question SDL2_image jpeg not loading on slackware 14.2


has anyone come across this issue with SDL2_image not loading jpegs on slackware 14.2 and got a fix?
I used dugan's sbobuild via sbopkg and it loads png and bmp images ok but fails to load jpgs.
I didn't see any errors in the build log, so I assume the jpeg library included with sdl2_image is different from the slackware 14.2 one, causing some sort of issue.

to confirm, slackware 14.2 switched to libjpeg-turbo 1.5.0 instead of libjpeg v8a used by slackware 14.1 (and by sdl2_image)

presumably the header file for the library and functions included is different in some critical way.
Any clues? without jpg reading, sdl2_image is "not a full shilling".
 
Old 10-11-2016, 05:45 PM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,220

Rep: Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309
If you're the same person who emailed me, then my response is the same: report it to the libsdl mailing list.

I assume you didn't see anything obviously relevant in SDL2_image's ./configure output, such as "...disabling JPEG support" or "JPEG support: no"?

Last edited by dugan; 10-11-2016 at 05:54 PM.
 
Old 10-11-2016, 09:56 PM   #3
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,220

Rep: Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309
I just checked. There is nothing wrong with the SlackBuild.

Take it to the libsdl mailing list. Give them your sample code, the command you used to compile it, and how you know it's not working (something more technically detailed than "fails to load").

Post back here only, and I mean only, if they say it's an issue with how SDL2_image is built. And when you do, the first thing I want to see is a direct link to the issue tracker comment or mailing list post that sent you back here.

Last edited by dugan; 10-11-2016 at 10:42 PM.
 
Old 10-12-2016, 04:09 AM   #4
timsoft
Member
 
Registered: Oct 2004
Location: scotland
Distribution: slackware 15.0 64bit, 14.2 64 and 32bit and arm, ubuntu and rasbian
Posts: 495

Original Poster
Rep: Reputation: 144Reputation: 144
possible solution?

Hi dugan, yes it is the same person. I have found a solution which works.

If you add
Code:
--enable-jpg-shared=no
to the configure line in your slackbuild, then loading jpgs works with slackware 14.2

On hindsight, it is obvious that enable-jpg-shared=yes (the default if not specified) will not work as the system (ie slackware 14.2) library is different from the one included in the sdl2_image source code. The only way to make that work would be either overwriting the default slackware jpeg library and headers(probably not a preferred option), or to replace the sdl2_image jpg source with the slackware turbo-jpg source and hope it works.

note: this is not an issue with earlier versions of slackware which don't use the turbo-jpg library.

If you still would like me to chase the libsdl mailing list I can do so, although from the reasoning above, I don't see how the source could easily be changed to accommodate both jpg libraries at the same time.
Regards, Tim

test case program is listed below,
Code:
#include <stdbool.h>
#include <SDL.h>
#include <SDL_image.h>
int main(int argc, char ** argv)
{
    bool quit = false;
    SDL_Event event;
    SDL_Init(SDL_INIT_VIDEO);
    IMG_Init(IMG_INIT_JPG);
    SDL_Window * window = SDL_CreateWindow("SDL2 Displaying Image",
        SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0);
    SDL_Renderer * renderer = SDL_CreateRenderer(window, -1, 0);
/*    SDL_Surface * image = SDL_LoadBMP("image.bmp");  */
    SDL_Surface *image;
    image = IMG_Load("image.jpg");
    if (!image) {
      printf("IMG_Load: %s\n", IMG_GetError());
    }
    SDL_Texture * texture = SDL_CreateTextureFromSurface(renderer, image);
    while (!quit)
    {
       SDL_WaitEvent(&event);
       switch(event.type)
       {
       case SDL_QUIT:
           quit = true;
           break;
       }
       SDL_RenderCopy(renderer, texture, NULL, NULL);
       SDL_RenderPresent(renderer);
    }
    SDL_DestroyTexture(texture);
    SDL_FreeSurface(image);
    SDL_DestroyRenderer(renderer);
    SDL_DestroyWindow(window);
    IMG_Quit();
    SDL_Quit();
    return 0;
}
makefile for above is below
Code:
LIBS = `pkg-config --libs sdl2 SDL2_image`
CFLAGS = `pkg-config --cflags sdl2 SDL2_image`
OBJS = testprog.o
VERSION = 1.0
DATADIR += ""
PROG = testprog
# top level rule to create the program
ALL = $(PROG)
all: $(ALL)
#compiling other source files
%.c: src/%.c src/*.h
        $(CC) $(CFLAGS) -c -DVERSION=\"$(VERSION)\" -DDATADIR=\"$(DATADIR)\"
$<
#linking the program
$(PROG): $(OBJS)
        $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) -o $(PROG) $(LIBS)
clean:
        $(RM_ $(OBJS) $(ALL)
test program requires a image.jpg picture in the same directory as the program
 
1 members found this post helpful.
Old 10-12-2016, 09:18 AM   #5
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,220

Rep: Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309
Thanks for the solution, and my apologies for having been dismissive about this.

I've sent SBo an updated SlackBuild.

I have not yet had time to try out your test program.

Last edited by dugan; 10-12-2016 at 09:24 AM.
 
1 members found this post helpful.
Old 10-12-2016, 01:29 PM   #6
timsoft
Member
 
Registered: Oct 2004
Location: scotland
Distribution: slackware 15.0 64bit, 14.2 64 and 32bit and arm, ubuntu and rasbian
Posts: 495

Original Poster
Rep: Reputation: 144Reputation: 144
no probs. The simple test program can test loading all supporting image formats. just change the filename in the IMGLoad function call and recompile.
I tested it with a png a bmp and a jpg.
As soon as willy or rob or dave push the updates on sbo I'll be able to submit the slackbuild I am updating for slackware 14.2
Thanks for the quick response.
 
Old 10-13-2016, 04:36 AM   #7
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 4,661

Rep: Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784Reputation: 1784
It's been pushed in my branch
 
  


Reply

Tags
sdlimage, slackware 14.2



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PySDL2 error loading jpeg ahc_fan Programming 2 02-15-2016 11:51 AM
[SOLVED] retrieving jpeg files from BkUp copy yields:ERR INTERPRETING JPEG; file not jpeg, drmjh Linux - General 7 10-03-2010 08:13 AM
Loading slackware faris10 Slackware 3 11-27-2005 07:52 AM
loading up slackware existenz Slackware 5 10-27-2004 07:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration