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

[Windows] MSYS2 causes `realpath` to be redeclared in `tm_source_file.c` #2261

Closed
ntrel opened this issue Aug 16, 2019 · 8 comments · Fixed by #2263

Comments

@ntrel
Copy link
Member

commented Aug 16, 2019

I'm using MSYS2 as recommended by: https://wiki.geany.org/howtos/win32/msys2.
Building git master.

$ gcc --version
gcc (GCC) 7.4.0

make V=1 gives:

depbase=`echo tm_source_file.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ../../libtool --silent  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../..  -I. -I../../ctags/main -DGEANY_PRIVATE -DG_LOG_DOMAIN=\"Tagmanager\"  -mms-bitfields -pthread -mms-bitfields -I/mingw32/include/gtk-2.0 -I/mingw32/lib/gtk-2.0/include -I/mingw32/include/pango-1.0 -I/mingw32/include/fribidi -I/mingw32/include -I/mingw32/include/cairo -I/mingw32/include/atk-1.0 -I/mingw32/include/cairo -I/mingw32/include/pixman-1 -I/mingw32/include -I/mingw32/include/freetype2 -I/mingw32/include -I/mingw32/include/harfbuzz -I/mingw32/include -I/mingw32/include/libpng16 -I/mingw32/include/gdk-pixbuf-2.0 -I/mingw32/include/libpng16 -I/mingw32/include -I/mingw32/lib/libffi-3.2.1/include -I/mingw32/include -I/mingw32/include/glib-2.0 -I/mingw32/lib/glib-2.0/include -I/mingw32/include -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32 -fvisibility=hidden -DGEANY_EXPORT_SYMBOL="__attribute__((visibility(\"default\")))" -DGEANY_API_SYMBOL=GEANY_EXPORT_SYMBOL -g -DGEANY_DEBUG -g -O0 -MT tm_source_file.lo -MD -MP -MF $depbase.Tpo -c -o tm_source_file.lo tm_source_file.c &&\
mv -f $depbase.Tpo $depbase.Plo
tm_source_file.c:91:14: error: static declaration of ‘realpath’ follows non-static declaration
 static char *realpath (const char *pathname, char *resolved_path)
              ^~~~~~~~
In file included from tm_source_file.c:20:0:
/usr/include/stdlib.h:151:8: note: previous declaration of ‘realpath’ was here
 char * realpath (const char *__restrict path, char *__restrict resolved_path);
        ^~~~~~~~
make[3]: *** [Makefile:505: tm_source_file.lo] Error 1
make[3]: Leaving directory '/c/git/geany/src/tagmanager'
@codebrainz

This comment has been minimized.

Copy link
Member

commented Aug 16, 2019

We should probably add a proper Autoconf check for realpath if mingw's newlib activates it for windows.

As a possible workaround, you could try updating your msys2, judging by the GCC version, it's rather out of date.

@ntrel

This comment has been minimized.

Copy link
Member Author

commented Aug 17, 2019

@codebrainz

As a possible workaround, you could try updating your msys2, judging by the GCC version, it's rather out of date.

Done. Edit: didn't help.

I added realpath to AC_CHECK_FUNCS in the referenced pull but it doesn't define HAVE_REALPATH in config.h, what am I doing wrong?

@ntrel

This comment has been minimized.

Copy link
Member Author

commented Aug 17, 2019

My gcc is now: gcc version 9.1.0 (GCC)

@ntrel

This comment has been minimized.

Copy link
Member Author

commented Aug 17, 2019

OK, so after running make I do now get HAVE_REALPATH.

@eht16

This comment has been minimized.

Copy link
Member

commented Aug 17, 2019

This is strange.
It doesn't happen in my MSYS2 installation.
I'm wondering why your gcc is considering /usr/include/stdlib.h and so get confused about the realpath definition.

I think the proper location of the header is /msys64/mingw32/i686-w64-mingw32/include/stdlib.h and there is also no definition of realpth and so no problem.

$ gcc --version
gcc.exe (Rev1, Built by MSYS2 project) 9.2.0
...
depbase=`echo tm_source_file.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ../../libtool --silent  --tag=CC   --mode=compile ccache gcc -DHAVE_CONFIG_H -I. -I../..  -I. -I../../ctags/main -DGEANY_PRIVATE -DG_LOG_DOMAIN=\"Tagmanager\"  -mms-bitfields -pthread -mms-bitfields -IC:/msys64/mingw32/include/gtk-2.0 -IC:/msys64/mingw32/lib/gtk-2.0/include -IC:/msys64/mingw32/include/pango-1.0 -IC:/msys64/mingw32/include/fribidi -IC:/msys64/mingw32/include -IC:/msys64/mingw32/include/cairo -IC:/msys64/mingw32/include/atk-1.0 -IC:/msys64/mingw32/include/cairo -IC:/msys64/mingw32/include/pixman-1 -IC:/msys64/mingw32/include -IC:/msys64/mingw32/include/freetype2 -IC:/msys64/mingw32/include -IC:/msys64/mingw32/include/harfbuzz -IC:/msys64/mingw32/include/libpng16 -IC:/msys64/mingw32/include/gdk-pixbuf-2.0 -IC:/msys64/mingw32/include/libpng16 -IC:/msys64/mingw32/include -IC:/msys64/mingw32/lib/libffi-3.2.1/include -IC:/msys64/mingw32/include -IC:/msys64/mingw32/include/glib-2.0 -IC:/msys64/mingw32/lib/glib-2.0/include -IC:/msys64/mingw32/include -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32 -DG_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGEANY_EXPORT_SYMBOL="__declspec(dllexport)" -DGEANY_API_SYMBOL=GEANY_EXPORT_SYMBOL -g -DGEANY_DEBUG -g -O2 -MT tm_source_file.lo -MD -MP -MF $depbase.Tpo -c -o tm_source_file.lo tm_source_file.c &&\
mv -f $depbase.Tpo $depbase.Plo
@ntrel

This comment has been minimized.

Copy link
Member Author

commented Aug 17, 2019

Thanks for the info @eht16. Yes I also have errors with spawn, that might be the problem. I'll check this on Monday. So should we merge the pull for this issue or not?

@eht16

This comment has been minimized.

Copy link
Member

commented Aug 17, 2019

Well, let's first check the source of the problem to know if it is in your local setup, in my local setup or if it is actually a real issue.

@ntrel

This comment has been minimized.

Copy link
Member Author

commented Aug 17, 2019

OK, I have now fixed my setup thanks to @eht16. The problem was I had installed a pacman package called gcc, then I installed mingw-w64-i686-gcc as well as written on the wiki page. This was very confusing. I removed gcc, reinstalled mingw-w64-i686-gcc, then I had to close MSYS2 and restart. Now I can build tm_source_file.c and spawn.c fine :-D

@elextr elextr closed this in #2263 Sep 21, 2019
elextr added a commit that referenced this issue Sep 21, 2019
LarsGit223 added a commit to LarsGit223/geany that referenced this issue Oct 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.