Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linux] Building SFML fails with conflicting declarations when using a recent git mesa #1472

Closed
ShadowsFriend opened this issue Aug 15, 2018 · 5 comments

Comments

@ShadowsFriend
Copy link
Contributor

ShadowsFriend commented Aug 15, 2018

When I try to build the current master version of SFML it fails with several conflicting declarations with the previous declarations all being in glxext.h. On my system, this file is provided by a current git version of mesa. I have attached a logfile containing the output of cmake and make including the errors.

Your environment

  • Gentoo Linux x86_64
  • git master (83d05ea), also tested with 2.4.2 and 2.5.0
  • mesa git (70bf639328fa00d7875e82b43fb011b0687559c0)
  • GCC 7.3.0

Steps to reproduce

  1. Clone the SFML git repository
  2. Enter the directory where the repository has been cloned to
  3. cmake .
  4. make

Expected behavior

SFML builds without an error.

Actual behavior

SFML fails building with conflicting declarations.

build.log

Edit: The reason for this issue is src/SFML/Window/Unix/GlxExtensions.hpp including the system's GL/glx.h which in turn includes GL/glxext.h. And this file then provides declarations that are also in src/SFML/Window/Unix/GlxExtensions.hpp.

@eXpl0it3r
Copy link
Member

Does it give you the same errors if you go back one commit: 43f0292

@ShadowsFriend
Copy link
Contributor Author

Yes, this commit leads to the same errors.
I first encountered the issue when I was trying to install version 2.4.2 and -- after that one failed -- 2.5.0 with my distribution's package manager. It was only afterwards that I tested the upstream master to see if the problem has already been fixed, which is not the case.

@ShadowsFriend
Copy link
Contributor Author

ShadowsFriend commented Aug 15, 2018

It seems the header changes introduced in mesa commit [1] break the compilation. I was able to successfully compile SFML when using mesa 18.2.0-rc2 (which does not include this commit) but when I manually apply it on top of 18.2.0-rc2, the compilation of SFML breaks with the aforementioned errors.

[1] https://cgit.freedesktop.org/mesa/mesa/commit/?id=f7d42ee7d319256608ad60778f6787c140badada

eXpl0it3r pushed a commit that referenced this issue Aug 28, 2018
When mesa updated their headers, they changed the include guard
from __glxext_h_ to __glx_glxext_h_, which breaks compilation
due to conflicting declarations. This commit modifies the preprocessor
directives to allow for compilation with older and newer mesa header
versions.
Fixes: #1472
@eXpl0it3r eXpl0it3r added this to Discussion in SFML 2.5.1 via automation Aug 28, 2018
@eXpl0it3r eXpl0it3r added this to the 2.5.1 milestone Aug 28, 2018
@eXpl0it3r eXpl0it3r moved this from Discussion to Done in SFML 2.5.1 Aug 28, 2018
Boris-Barboris pushed a commit to Boris-Barboris/SFML that referenced this issue Dec 7, 2019
When mesa updated their headers, they changed the include guard
from __glxext_h_ to __glx_glxext_h_, which breaks compilation
due to conflicting declarations. This commit modifies the preprocessor
directives to allow for compilation with older and newer mesa header
versions.
Fixes: SFML#1472
@oprypin
Copy link
Member

oprypin commented Mar 21, 2020

For the record, this issue makes SFML releases before 2.5 un-buildable on any recent Linux system.
For discoverability, the error message is:

Clang:

In file included from src/SFML/Window/GlContext.cpp:47:
In file included from src/SFML/Window/Unix/GlxContext.hpp:32:
src/SFML/Window/Unix/GlxExtensions.hpp:123:3: error: typedef redefinition with different types ('struct GLXHyperpipeNetworkSGIX' vs 'struct GLXHyperpipeNetworkSGIX')
} GLXHyperpipeNetworkSGIX;
  ^
/usr/include/GL/glxext.h:771:3: note: previous definition is here
} GLXHyperpipeNetworkSGIX;
  ^
In file included from src/SFML/Window/GlContext.cpp:47:
In file included from src/SFML/Window/Unix/GlxContext.hpp:32:
src/SFML/Window/Unix/GlxExtensions.hpp:129:3: error: typedef redefinition with different types ('struct GLXHyperpipeConfigSGIX' vs 'struct GLXHyperpipeConfigSGIX')
} GLXHyperpipeConfigSGIX;
  ^
/usr/include/GL/glxext.h:777:3: note: previous definition is here
} GLXHyperpipeConfigSGIX;
  ^
In file included from src/SFML/Window/GlContext.cpp:47:
In file included from src/SFML/Window/Unix/GlxContext.hpp:32:
src/SFML/Window/Unix/GlxExtensions.hpp:134:3: error: typedef redefinition with different types ('struct GLXPipeRect' vs 'struct GLXPipeRect')
} GLXPipeRect;
  ^
/usr/include/GL/glxext.h:782:3: note: previous definition is here
} GLXPipeRect;
  ^
In file included from src/SFML/Window/GlContext.cpp:47:
In file included from src/SFML/Window/Unix/GlxContext.hpp:32:
src/SFML/Window/Unix/GlxExtensions.hpp:138:3: error: typedef redefinition with different types ('struct GLXPipeRectLimits' vs 'struct GLXPipeRectLimits')
} GLXPipeRectLimits;
  ^
/usr/include/GL/glxext.h:786:3: note: previous definition is here
} GLXPipeRectLimits;

GCC:

In file included from src/SFML/Window/Unix/GlxContext.hpp:32,
                 from src/SFML/Window/GlContext.cpp:47:
src/SFML/Window/Unix/GlxExtensions.hpp:123:3: error: conflicting declaration ‘typedef struct GLXHyperpipeNetworkSGIX GLXHyperpipeNetworkSGIX’
  123 | } GLXHyperpipeNetworkSGIX;
      |   ^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/GL/glx.h:333,
                 from src/SFML/Window/Unix/GlxExtensions.hpp:36,
                 from src/SFML/Window/Unix/GlxContext.hpp:32,
                 from src/SFML/Window/GlContext.cpp:47:
/usr/include/GL/glxext.h:771:3: note: previous declaration as ‘typedef struct GLXHyperpipeNetworkSGIX GLXHyperpipeNetworkSGIX’
  771 | } GLXHyperpipeNetworkSGIX;
      |   ^~~~~~~~~~~~~~~~~~~~~~~
In file included from src/SFML/Window/Unix/GlxContext.hpp:32,
                 from src/SFML/Window/GlContext.cpp:47:
src/SFML/Window/Unix/GlxExtensions.hpp:129:3: error: conflicting declaration ‘typedef struct GLXHyperpipeConfigSGIX GLXHyperpipeConfigSGIX’
  129 | } GLXHyperpipeConfigSGIX;
      |   ^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/GL/glx.h:333,
                 from src/SFML/Window/Unix/GlxExtensions.hpp:36,
                 from src/SFML/Window/Unix/GlxContext.hpp:32,
                 from src/SFML/Window/GlContext.cpp:47:
/usr/include/GL/glxext.h:777:3: note: previous declaration as ‘typedef struct GLXHyperpipeConfigSGIX GLXHyperpipeConfigSGIX’
  777 | } GLXHyperpipeConfigSGIX;
      |   ^~~~~~~~~~~~~~~~~~~~~~
In file included from src/SFML/Window/Unix/GlxContext.hpp:32,
                 from src/SFML/Window/GlContext.cpp:47:
src/SFML/Window/Unix/GlxExtensions.hpp:134:3: error: conflicting declaration ‘typedef struct GLXPipeRect GLXPipeRect’
  134 | } GLXPipeRect;
      |   ^~~~~~~~~~~
In file included from /usr/include/GL/glx.h:333,
                 from src/SFML/Window/Unix/GlxExtensions.hpp:36,
                 from src/SFML/Window/Unix/GlxContext.hpp:32,
                 from src/SFML/Window/GlContext.cpp:47:
/usr/include/GL/glxext.h:782:3: note: previous declaration as ‘typedef struct GLXPipeRect GLXPipeRect’
  782 | } GLXPipeRect;
      |   ^~~~~~~~~~~
In file included from src/SFML/Window/Unix/GlxContext.hpp:32,
                 from src/SFML/Window/GlContext.cpp:47:
src/SFML/Window/Unix/GlxExtensions.hpp:138:3: error: conflicting declaration ‘typedef struct GLXPipeRectLimits GLXPipeRectLimits’
  138 | } GLXPipeRectLimits;
      |   ^~~~~~~~~~~~~~~~~
In file included from /usr/include/GL/glx.h:333,
                 from src/SFML/Window/Unix/GlxExtensions.hpp:36,
                 from src/SFML/Window/Unix/GlxContext.hpp:32,
                 from src/SFML/Window/GlContext.cpp:47:
/usr/include/GL/glxext.h:786:3: note: previous declaration as ‘typedef struct GLXPipeRectLimits GLXPipeRectLimits’
  786 | } GLXPipeRectLimits;
      |   ^~~~~~~~~~~~~~~~~

@oprypin
Copy link
Member

oprypin commented Jul 10, 2023

And the workaround, for archeologists: if you git checkout 2.4.2, then you need git cherry-pick 87aaa9e145659d6a8fc193ab8540cf847d4d0def

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
SFML 2.5.1
  
Done
Development

No branches or pull requests

4 participants