Closed robe2 closed 1 year ago
From
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
maybe its the compiler version Try to compile with lower version (like 9)
Need to contact @estebanzimanyi or @mbakli They wrote this code
I installed g++-12 and got some other warnings that I just fixed on #2472 and I don't think that solved this problem.
The fix we proposed a few years ago was based on the solution used in PostGIS which also uses the function CHECK_FOR_INTERRUPTS(); / give interrupter a chance / e.g., https://github.com/postgis/postgis/blob/master/libpgcommon/lwgeom_pg.c#L291
The error message is indicating that there is no declaration available for UNBLOCKED_SIGNAL_QUEUE, which is used in the cpp_common/interruption.h header file. This could be due to a missing include file, a missing definition or macro, or an incorrect configuration. The error message suggests using the -fpermissive flag with G++ to allow the code to compile, but this is not a recommended solution as it could introduce other issues.
One possible solution is to check if the necessary header files and macros are included in the source code and that the code is correctly configured. It may also be necessary to update the version of the compiler or any relevant dependencies. Another option is to seek help from the community or the developers of the software to resolve the issue.
Okay I'm still getting errors but in a different place. I should note this is against develop branch. I'll try against main in a bit.
Now I get:
[ 0%] Building C object src/circuits/CMakeFiles/circuits.dir/hawickCircuits.c.obj
[ 1%] Building CXX object src/circuits/CMakeFiles/circuits.dir/hawickCircuits_driver.cpp.obj
In file included from C:/Msys2pgRouting/msys2/mingw64/include/postgresql/server/port/win32_port.h:6
,
from C:/Msys2pgRouting/msys2/mingw64/include/postgresql/server/port.h:24,
from C:/Msys2pgRouting/msys2/mingw64/include/postgresql/server/c.h:1388,
from C:/Msys2pgRouting/msys2/mingw64/include/postgresql/server/postgres.h:46,
from C:/projects/pgRouting/include/cpp_common/interruption.h:38,
from C:/projects/pgRouting/include/circuits/hawickcircuits.hpp:41,
from C:/projects/pgRouting/src/circuits/hawickCircuits_driver.cpp:41:
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h: In function 'int microsoft_native_fstat(int, mic
rosoft_native_stat*)':
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:226:20: error: invalid application of 'sizeof' to
incomplete type 'microsoft_native_stat'
226 | memset(_Stat,0,sizeof(struct stat));
| ^~~~~~~~~~~~~~~~~~~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:231:8: error: invalid use of incomplete type 'str
uct microsoft_native_stat'
231 | _Stat->st_dev=st.st_dev;
| ^~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:174:36: note: forward declaration of 'struct micr
osoft_native_stat'
174 | int __cdecl fstat(int _Desc,struct stat *_Stat);
| ^~~~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:232:8: error: invalid use of incomplete type 'str
uct microsoft_native_stat'
232 | _Stat->st_ino=st.st_ino;
| ^~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:174:36: note: forward declaration of 'struct micr
osoft_native_stat'
174 | int __cdecl fstat(int _Desc,struct stat *_Stat);
| ^~~~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:233:8: error: invalid use of incomplete type 'str
uct microsoft_native_stat'
233 | _Stat->st_mode=st.st_mode;
| ^~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:174:36: note: forward declaration of 'struct micr
osoft_native_stat'
174 | int __cdecl fstat(int _Desc,struct stat *_Stat);
| ^~~~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:234:8: error: invalid use of incomplete type 'str
uct microsoft_native_stat'
234 | _Stat->st_nlink=st.st_nlink;
| ^~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:174:36: note: forward declaration of 'struct micr
osoft_native_stat'
174 | int __cdecl fstat(int _Desc,struct stat *_Stat);
| ^~~~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:235:8: error: invalid use of incomplete type 'str
uct microsoft_native_stat'
235 | _Stat->st_uid=st.st_uid;
| ^~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:174:36: note: forward declaration of 'struct micr
osoft_native_stat'
174 | int __cdecl fstat(int _Desc,struct stat *_Stat);
| ^~~~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:236:8: error: invalid use of incomplete type 'str
uct microsoft_native_stat'
236 | _Stat->st_gid=st.st_gid;
| ^~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:174:36: note: forward declaration of 'struct micr
osoft_native_stat'
174 | int __cdecl fstat(int _Desc,struct stat *_Stat);
| ^~~~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:237:8: error: invalid use of incomplete type 'str
uct microsoft_native_stat'
237 | _Stat->st_rdev=st.st_rdev;
| ^~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:174:36: note: forward declaration of 'struct micr
osoft_native_stat'
174 | int __cdecl fstat(int _Desc,struct stat *_Stat);
| ^~~~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:238:8: error: invalid use of incomplete type 'str
uct microsoft_native_stat'
238 | _Stat->st_size=(_off_t) st.st_size;
| ^~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:174:36: note: forward declaration of 'struct micr
osoft_native_stat'
174 | int __cdecl fstat(int _Desc,struct stat *_Stat);
| ^~~~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:239:8: error: invalid use of incomplete type 'str
uct microsoft_native_stat'
239 | _Stat->st_atime=st.st_atime;
| ^~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:174:36: note: forward declaration of 'struct micr
osoft_native_stat'
174 | int __cdecl fstat(int _Desc,struct stat *_Stat);
| ^~~~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:240:8: error: invalid use of incomplete type 'str
uct microsoft_native_stat'
240 | _Stat->st_mtime=st.st_mtime;
| ^~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:174:36: note: forward declaration of 'struct micr
osoft_native_stat'
174 | int __cdecl fstat(int _Desc,struct stat *_Stat);
| ^~~~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:241:8: error: invalid use of incomplete type 'str
uct microsoft_native_stat'
241 | _Stat->st_ctime=st.st_ctime;
| ^~
C:/Msys2pgRouting/msys2/mingw64/include/sys/stat.h:174:36: note: forward declaration of 'struct micr
osoft_native_stat'
174 | int __cdecl fstat(int _Desc,struct stat *_Stat);
| ^~~~
C:/Msys2pgRouting/msys2/mingw64/include/postgresql/server/port/win32_port.h: At global scope:
C:/Msys2pgRouting/msys2/mingw64/include/postgresql/server/port/win32_port.h:264:8: error: redefiniti
on of 'struct stat'
264 | struct stat /* This should match struct __stat64
*/
| ^~~~
In file included from C:/Msys2pgRouting/msys2/mingw64/include/wchar.h:413,
from C:/Msys2pgRouting/msys2/mingw64/include/c++/12.2.0/cwchar:44,
from C:/Msys2pgRouting/msys2/mingw64/include/c++/12.2.0/bits/postypes.h:40,
from C:/Msys2pgRouting/msys2/mingw64/include/c++/12.2.0/iosfwd:40,
from C:/Msys2pgRouting/msys2/mingw64/include/c++/12.2.0/ios:38,
from C:/Msys2pgRouting/msys2/mingw64/include/c++/12.2.0/istream:38,
from C:/Msys2pgRouting/msys2/mingw64/include/c++/12.2.0/sstream:38,
from C:/projects/pgRouting/src/circuits/hawickCircuits_driver.cpp:32:
C:/Msys2pgRouting/msys2/mingw64/include/_mingw_stat64.h:40:10: note: previous definition of 'struct
stat'
40 | struct stat {
| ^~~~
In file included from C:/projects/pgRouting/include/cpp_common/interruption.h:39:
C:/projects/pgRouting/include/circuits/hawickcircuits.hpp: In member function 'std::deque<circuits_r
t> pgrouting::functions::pgr_hawickCircuits<G>::hawickCircuits(G&)':
C:/projects/pgRouting/include/circuits/hawickcircuits.hpp:135:9: error: second operand to the condit
ional operator is of type 'void', but the third operand is neither a throw-expression nor of type 'v
oid'
135 | CHECK_FOR_INTERRUPTS();
| ^~~~~~~~~~~~~~~~~~~~
make[2]: *** [src/circuits/CMakeFiles/circuits.dir/build.make:92: src/circuits/CMakeFiles/circuits.d
ir/hawickCircuits_driver.cpp.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:2305: src/circuits/CMakeFiles/circuits.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Nope same problem with main. I'll try @estebanzimanyi suggestion later.
Add the following line at the beginning of your C++ code to include the sys/stat.h header file:
If it does not work check the version of mingw64 and PostgreSQL you are using. It is possible that there is an incompatibility issue between the two versions.
On winnie (PostGIS Build bot), main branch is broken:
https://winnie.postgis.net/job/pgRouting_PGVersionEDB/9941/console
/hawickCircuits_driver.cpp.obj.d -o CMakeFiles/circuits.dir/hawickCircuits_driver.cpp.obj -c /E/jenkins/pgrouting/branches/3.5/src/circuits/hawickCircuits_driver.cpp
In file included from E:/jenkins/postgresql/rel/pg15w64gcc81/include/server/port/win32_port.h:66,
from E:/jenkins/postgresql/rel/pg15w64gcc81/include/server/port.h:24,
from E:/jenkins/postgresql/rel/pg15w64gcc81/include/server/c.h:1387,
from E:/jenkins/postgresql/rel/pg15w64gcc81/include/server/postgres.h:46,
from E:/jenkins/pgrouting/branches/3.5/include/cpp_common/interruption.h:38,
from E:/jenkins/pgrouting/branches/3.5/include/circuits/hawickcircuits.hpp:41,
from E:/jenkins/pgrouting/branches/3.5/src/circuits/hawickCircuits_driver.cpp:41:
C:/ming64gcc81/mingw64/x86_64-w64-mingw32/include/sys/stat.h: In function 'int microsoft_native_fstat(int, microsoft_native_stat*)':
C:/ming64gcc81/mingw64/x86_64-w64-mingw32/include/sys/stat.h:226:38: error: invalid application of 'sizeof' to incomplete type 'microsoft_native_stat'
memset(_Stat,0,sizeof(struct stat))
But the develop branch at least compiles. I have to check why the tests aren't running on that. Winnie is running gcc 8.1.0 and mingw64/msys2
But unfortunately my new chain setup gcc 12.1 msys2, mingw64 (using cmake -G 'Unix Makefiles' gives on develop branch
In file included from C:/projects/pgRouting/include/circuits/hawickcircuits.hpp:41, from C:/projects/pgRouting/src/circuits/hawickCircuits_driver.cpp:41: C:/projects/pgRouting/include/circuits/hawickcircuits.hpp: In member function 'std::deque
pgrouting::functions::pgr_hawickCircuits ::hawickCircuit s(G&)': C:/projects/pgRouting/include/cpp_common/interruption.h:75:15: error: there are no arguments to 'UNBLOCKED_SIGNAL_QUEUE' that depend on a template parameter, so a declaration of 'UNBLOCKED_SIGNAL_QUEUE' must be available [-fpermissive] 75 | (unlikely(UNBLOCKED_SIGNAL_QUEUE()) ? pgwin32_dispatch_queued_signals() : 0, \ | ^ ~~~~~ C:/projects/pgRouting/include/cpp_common/interruption.h:63:39: note: in definition of macro 'unlikely' 63 | #define unlikely(x) builtin_expect((x) != 0, 0) | ^ C:/projects/pgRouting/include/cpp_common/interruption.h:82:13: note: in expansion of macro 'INTERRUPTS_PENDING_CONDITION' 82 | if (INTERRUPTS_PENDING_CONDITION()) \ | ^~~~~~~~ C:/projects/pgRouting/include/circuits/hawickcircuits.hpp:135:9: note: in expansion of macro 'CHECK_FOR_INTERRUPTS' 135 | CHECK_FOR_INTERRUPTS(); | ^~~~~~~~ C:/projects/pgRouting/include/cpp_common/interruption.h:75:15: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) 75 | (unlikely(UNBLOCKED_SIGNAL_QUEUE()) ? pgwin32_dispatch_queued_signals() : 0, \ | ^~~~~~ C:/projects/pgRouting/include/cpp_common/interruption.h:63:39: note: in definition of macro 'unlikely' 63 | #define unlikely(x) __builtin_expect((x) != 0, 0) | ^ C:/projects/pgRouting/include/cpp_common/interruption.h:82:13: note: in expansion of macro 'INTERRUPTS_PENDING_CONDITION' 82 | if (INTERRUPTS_PENDING_CONDITION()) \ | ^~~~~~~~ C:/projects/pgRouting/include/circuits/hawickcircuits.hpp:135:9: note: in expansion of macro 'CHECK_FOR_INTERRUPTS' 135 | CHECK_FOR_INTERRUPTS(); | ^~~~~~~~ C:/projects/pgRouting/include/circuits/hawickcircuits.hpp: In instantiation of 'std::dequepgrouting::functions::pgr_hawickCircuits builtin_expect((x) != 0, 0) | ^ C:/projects/pgRouting/include/cpp_common/interruption.h:82:13: note: in expansion of macro 'INTERRUPTS_PENDING_CONDITION' 82 | if (INTERRUPTS_PENDING_CONDITION()) \ | ^::hawickCircui ts(G&) [with G = pgrouting::graph::Pgr_base_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, pgrouting::Basic_vertex, pgrouting::Basi c_edge>, pgrouting::Basic_vertex, pgrouting::Basic_edge>]': C:/projects/pgRouting/src/circuits/hawickCircuits_driver.cpp:57:52: required from 'std::deque pgr_hawickCircuits(G&) [with G = pgrouting::graph::P gr_base_graph<boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, pgrouting::Basic_vertex, pgrouting::Basic_edge>, pgrouting::Basic_vertex, pg routing::Basic_edge>]' C:/projects/pgRouting/src/circuits/hawickCircuits_driver.cpp:112:37: required from here C:/projects/pgRouting/include/cpp_common/interruption.h:75:37: error: 'UNBLOCKED_SIGNAL_QUEUE' was not declared in this scope 75 | (unlikely(UNBLOCKED_SIGNAL_QUEUE()) ? pgwin32_dispatch_queued_signals() : 0, \ | ^ C:/projects/pgRouting/include/cpp_common/interruption.h:63:39: note: in definition of macro 'unlikely' 63 | #define unlikely(x) ~~~~~~~ C:/projects/pgRouting/include/circuits/hawickcircuits.hpp:135:9: note: in expansion of macro 'CHECK_FOR_INTERRUPTS' 135 | CHECK_FOR_INTERRUPTS(); | ^~~~~~~~ make[2]: [src/circuits/CMakeFiles/circuits.dir/build.make:92: src/circuits/CMakeFiles/circuits.dir/hawickCircuits_driver.cpp.obj] Error 1 make[1]: [CMakeFiles/Makefile2:2305: src/circuits/CMakeFiles/circuits.dir/all] Error 2 make: *** [Makefile:136: all] Error 2
So I think the stats issue is no longer an issue (at least not in develop)
Okay I think I see the issue now, it's still compiling but got passed that step.
the issue is with the interrupt.h.
Since WIN32 is defined, it's falling into the the else branch which mucks up everything. I have to figure out what variable to use to prevent it from doing that and make sure it doesn't break my current setup.
changing #ifndef true
fixes the compile issue
/* Test whether an interrupt is pending */
#ifndef WIN32
#define INTERRUPTS_PENDING_CONDITION() \
(unlikely(InterruptPending))
#else
extern void pgwin32_dispatch_queued_signals(void);
#define INTERRUPTS_PENDING_CONDITION() \
(unlikely(UNBLOCKED_SIGNAL_QUEUE()) ? pgwin32_dispatch_queued_signals() : 0, \
unlikely(InterruptPending))
#endif
Note that main is broken in both my current setup (winnie) and my new setup. So develop is a clear winner.
Rolled back to original interrupts file
@cvvergara I was writing up instructions on how to build on windows with msys2 and mingw64 and ran into a stumbling block
Here are the instructions
all goes smoothly until the build step, which errors in