Code::Blocks with C/C++ Compiler


@edgex004 : I did, but the links are not quite visible on these new boards.

Hint: check the word "here" on my previous post, in the EDIT section ;)

Cheers, Magic Sam
[doublepost=1473681361,1473669003][/doublepost]Hi again,

@ptitSeb : I'm updating my Odamex package to a more recent SVN revision. The compilation completed successfully, but the binary crashes on startup with the following error message:
Fatal Error: Mismatch between the program and library build versions detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1009,wx containers,compatible with 2.6,compatible with 2.8),
and your program used 3.0 (wchar_t,compiler with C++ ABI 1010,wx containers,compatible with 2.6,compatible with 2.8).
/usr/pandora/scripts/pnd_run.sh: line 528: 2126 Aborted

What am I doing wrong ?

Cheers, Magic Sam
 
@Magic Sam : did you clean you project and make it from scratch ?
Maybe the GCC update I have done has break ABI compatiblity for wxWidget lib, and I will have to rebuild it :'( and all associated software (at least codeblocks).
 
Hi @ptitSeb ,

Yes, the project was built from scratch, using a newer SVN revision.

Sorry for the bad news :(

I'm looking forward to using an updated Code::Blocks package ;) If I can do anything to help you test it, just let me know !

Cheers, Magic Sam
 
@ptitSeb : if I understand correctly, the issue is that I compiled some binary with some GCC version, that binary uses wxWidget libraries, but those were compiled with a different GCC version.

Am I correct ?

Cheers, Magic Sam

P.S: sorry for the n00b question, I'm just trying to understand what happened and why :)

/me reading the Wikipedia page about ABIs
 
@Magic Sam : yes, it is that.
I have tested and I had the same issue with the codeblocks IDE.
Now, with that new wxWidget build, I have rebuild codeblocks and it works fine. To be sure, i have updated the filezilla pnd :).

Now, a new codeblocks pnd is packaged (and it weight 2.9GB, I probably have to do some cleanup). and I will upload it. I'll put the link in the beta thread tomorow....
It will feature gcc 6.2, new build of wxWidget 3.0.2, FLIF libs and FLIF support in qtImagecodec for Qt4 and Qt5, but unfortunatly, still no FLIF support in QtWebKit (I already tryed that for some hours with Otter without success).
 
Hello,
I'm trying to get GLES2 working using SDL2, but shaders always report compilation failure with empty error logs. glGetError() also reports 0. I wrote a very simple test, which should display a red triangle using a shader on a blue background (at least it does on my PC).

Here's my build command:
Code:
c++ `pkg-config --cflags --libs sdl2 glesv2` main.cpp -o main

And here's main.cpp:
Code:
#define USE_OPENGLES

#include <SDL.h>
#ifdef USE_OPENGLES
#include <SDL_opengles2.h>
#else
#define GL_GLEXT_PROTOTYPES
#include <SDL_opengl.h>
#include <SDL_opengl_glext.h>
#endif

#include <stdio.h>

SDL_Window *sdl_window;
SDL_GLContext sdl_gl_context;

int main(int argc, char *argv[]) {
    if (SDL_Init(SDL_INIT_VIDEO) < 0) {
        fprintf(stderr, "Couldn't init SDL2: %s\n", SDL_GetError());
        exit(1);
    }

#ifdef USE_OPENGLES
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK,
        SDL_GL_CONTEXT_PROFILE_ES);
#endif

#if 0
    SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
    SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
#endif

    int video_width = 800;
    int video_height = 480;
    int window_flags = SDL_WINDOW_OPENGL
        | SDL_WINDOW_FULLSCREEN;
    sdl_window = SDL_CreateWindow("Test",
        SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
        video_width, video_height, window_flags);
    if (!sdl_window) {
        fprintf(stderr, "Failed to create OpenGL window: %s\n", SDL_GetError());
        exit(1);
    }
    sdl_gl_context = SDL_GL_CreateContext(sdl_window);
    if (!sdl_gl_context) {
        fprintf(stderr, "Failed to create OpenGL context: %s\n", SDL_GetError());
        exit(2);
    }
//    SDL_GL_MakeCurrent(sdl_window, sdl_gl_context);

    // create shader
    const char *shader_vert_src = "attribute vec2 va_position; void main() {gl_Position = vec4(va_position, 0.0, 1.0);}";
    const char *shader_frag_src = "void main() {gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);}";
    GLint is_compiled;
    GLuint program = glCreateProgram();
    GLuint shader_vert = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(shader_vert, 1, &shader_vert_src, NULL);
    glCompileShader(shader_vert);
    glGetShaderiv(shader_vert, GL_COMPILE_STATUS, &is_compiled);
    printf("compiled %d\n", is_compiled);
    glAttachShader(program, shader_vert);
    GLuint shader_frag = glCreateShader(GL_FRAGMENT_SHADER);
    glShaderSource(shader_frag, 1, &shader_frag_src, NULL);
    glCompileShader(shader_frag);
    glGetShaderiv(shader_frag, GL_COMPILE_STATUS, &is_compiled);
    printf("compiled %d\n", is_compiled);
    glAttachShader(program, shader_frag);
    glLinkProgram(program);
    glUseProgram(program);

    // create vbo
    GLuint vbo;
    glGenBuffers(1, &vbo);
    glBindBuffer(GL_ARRAY_BUFFER, vbo);
    float vertex_data[] = {0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f};
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_data), vertex_data, GL_STATIC_DRAW);

    // setup vertex attribs
    GLuint va_position = 0;
    glEnableVertexAttribArray(va_position);
    glVertexAttribPointer(va_position, 2, GL_FLOAT, GL_FALSE, 0, (GLvoid*)0);

    glClearColor(0.4, 0.6, 0.8, 1.0);
    for (int i = 0; i < 10; i++) {
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        // draw something
        glDrawArrays(GL_TRIANGLES, 0, 3);
        SDL_GL_SwapWindow(sdl_window);
        SDL_Delay(100);
    }
    printf("gl error %d\n", glGetError());

    SDL_GL_DeleteContext(sdl_gl_context);
    SDL_DestroyWindow(sdl_window);
    SDL_Quit();

    return 0;
}

Edit: Here's what I have linked against:
Code:
    libGLESv2.so => /mnt/utmp/codeblocks/usr/lib/libGLESv2.so (0x401e2000)
    libSDL2-2.0.so.0 => /mnt/utmp/codeblocks/usr/lib/libSDL2-2.0.so.0 (0x4022e000)
    libstdc++.so.6 => /mnt/utmp/codeblocks/usr/lib/libstdc++.so.6 (0x40330000)
    libm.so.6 => /lib/libm.so.6 (0x400eb000)
    libgcc_s.so.1 => /mnt/utmp/codeblocks/usr/lib/libgcc_s.so.1 (0x4008c000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x4015e000)
    libc.so.6 => /lib/libc.so.6 (0x40429000)
    libIMGegl.so => /usr/lib/libIMGegl.so (0x4017d000)
    libsrv_um.so => /usr/lib/libsrv_um.so (0x4000c000)
    libiconv.so.2 => /mnt/utmp/codeblocks/usr/lib/libiconv.so.2 (0x40550000)
    libdl.so.2 => /mnt/utmp/codeblocks/usr/lib/libdl.so.2 (0x4002b000)
    libts-1.0.so.0 => /mnt/utmp/codeblocks/usr/lib/libts-1.0.so.0 (0x4006f000)
    librt.so.1 => /mnt/utmp/codeblocks/usr/lib/librt.so.1 (0x40191000)
    /lib/ld-linux.so.3 (0x400bc000)

And here's the output on my Pandora (rebirth <1 GHz):
Code:
X11_GL_LoadLibrary(0x2a040, (null))
LIBGL: Initialising glshim
libGL egl backend: libEGL.so
libGL: built on Oct 22 2015 21:48:58
LIBGL: Current folder is:/home/fabio/devel/gles2_test
X11_GL_LoadLibrary(0x2a040, (null))
compiled 0
compiled 0
gl error 0

I find it weird that it's using glshim. As far as I understand glshim is only necessary for OpenGL 1.5 to OpenGLES 2.0 translation. Another weird thing is if I link with glesv1_cm it doesn't flicker as much.
Any help would be appreciated.
 
The SDL2 version inside codeblocks has both OpenGL and OpenGLES support compiled in. But SDL2 is not supposed to be compiled with support of this two version at the same time, and OpenGL is always the only one loaded.
So I added some special env. variable to be abble to swtich from OpenGL to OpenGLES.
export thoses two
Code:
SDL_VIDEO_GLES2=1 SDL_VIDEO_GL_DRIVER=libGLESv2.so
and you will load GLES|2 in SDL2 and have access to shaders.
 
Back
Top