Message ID | 1300537764-40315-1-git-send-email-martin@martin.st |
---|---|
State | Superseded |
Headers | show |
Martin Storsjö <martin@martin.st> writes: > Before edaf1ae2763ce, these parameters were present. SDL headers > replace and wrap the main function on some platforms (e.g. OS X), > and on those platforms, the test with main(void) failed with this > error message: > > error: conflicting types for 'SDL_main' > SDL_main.h:57: error: previous declaration of 'SDL_main' was here > --- > configure | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/configure b/configure > index 1494994..b10ae68 100755 > --- a/configure > +++ b/configure > @@ -718,7 +718,7 @@ check_func_headers(){ > for func in $funcs; do > echo "long check_$func(void) { return (long) $func; }" > done > - echo "int main(void) { return 0; }" > + echo "int main(int argc, char **argv) { return 0; }" > } | check_ld "$@" && enable $funcs && enable_safe $headers > } This is the wrong fix. Another library might require the opposite. The correct solution is to suppress the evil behaviour of the library. For SDL this might be possible by adding -D_SDL_main_h to the check_pkg_config call, possibly also -Umain. This follows the usual principle of fixing the problem at the source.
On Sat, 19 Mar 2011, Måns Rullgård wrote: > Martin Storsjö <martin@martin.st> writes: > > > Before edaf1ae2763ce, these parameters were present. SDL headers > > replace and wrap the main function on some platforms (e.g. OS X), > > and on those platforms, the test with main(void) failed with this > > error message: > > > > error: conflicting types for 'SDL_main' > > SDL_main.h:57: error: previous declaration of 'SDL_main' was here > > --- > > configure | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/configure b/configure > > index 1494994..b10ae68 100755 > > --- a/configure > > +++ b/configure > > @@ -718,7 +718,7 @@ check_func_headers(){ > > for func in $funcs; do > > echo "long check_$func(void) { return (long) $func; }" > > done > > - echo "int main(void) { return 0; }" > > + echo "int main(int argc, char **argv) { return 0; }" > > } | check_ld "$@" && enable $funcs && enable_safe $headers > > } > > This is the wrong fix. Another library might require the opposite. The > correct solution is to suppress the evil behaviour of the library. For > SDL this might be possible by adding -D_SDL_main_h to the check_pkg_config > call, possibly also -Umain. This follows the usual principle of fixing > the problem at the source. I tried that, but that ends up with a duplicate symbol error for the main symbol. Is there any flag to make gcc accept the issue that the function was defined with different parameters earlier, that could be added to this test? // Martin
Martin Storsjö <martin@martin.st> writes: > On Sat, 19 Mar 2011, Måns Rullgård wrote: > >> Martin Storsjö <martin@martin.st> writes: >> >> > Before edaf1ae2763ce, these parameters were present. SDL headers >> > replace and wrap the main function on some platforms (e.g. OS X), >> > and on those platforms, the test with main(void) failed with this >> > error message: >> > >> > error: conflicting types for 'SDL_main' >> > SDL_main.h:57: error: previous declaration of 'SDL_main' was here >> > --- >> > configure | 2 +- >> > 1 files changed, 1 insertions(+), 1 deletions(-) >> > >> > diff --git a/configure b/configure >> > index 1494994..b10ae68 100755 >> > --- a/configure >> > +++ b/configure >> > @@ -718,7 +718,7 @@ check_func_headers(){ >> > for func in $funcs; do >> > echo "long check_$func(void) { return (long) $func; }" >> > done >> > - echo "int main(void) { return 0; }" >> > + echo "int main(int argc, char **argv) { return 0; }" >> > } | check_ld "$@" && enable $funcs && enable_safe $headers >> > } >> >> This is the wrong fix. Another library might require the opposite. The >> correct solution is to suppress the evil behaviour of the library. For >> SDL this might be possible by adding -D_SDL_main_h to the check_pkg_config >> call, possibly also -Umain. This follows the usual principle of fixing >> the problem at the source. > > I tried that, but that ends up with a duplicate symbol error for the main > symbol. Ugh. Why must sdl be so evil? > Is there any flag to make gcc accept the issue that the function was > defined with different parameters earlier, that could be added to this > test? I hope not.
diff --git a/configure b/configure index 1494994..b10ae68 100755 --- a/configure +++ b/configure @@ -718,7 +718,7 @@ check_func_headers(){ for func in $funcs; do echo "long check_$func(void) { return (long) $func; }" done - echo "int main(void) { return 0; }" + echo "int main(int argc, char **argv) { return 0; }" } | check_ld "$@" && enable $funcs && enable_safe $headers }