Source: libpg-query Version: 13-2.1.2-1 Severity: minor Tags: ftbfs, patch User: [email protected] Usertags: riscv64 X-Debbugs-Cc: [email protected]
Dear libpg-query Maintainer,
The libpg-query has a ftbfs issue on riscv64:
```
...
In file included from ./src/postgres/include/storage/condition_variable.h:26,
from ./src/postgres/include/nodes/execnodes.h:25,
from ./src/postgres/include/catalog/index.h:18,
from src/pg_query_deparse.c:5:
./src/postgres/include/storage/s_lock.h:922:2: error: #error PostgreSQL does
not have native spinlock support on this platform. To continue the compilation,
rerun configure using --disable-spinlocks. However, performance will be poor.
Please report this to [email protected].
922 | #error PostgreSQL does not have native spinlock support on this
platform. To continue the compilation, rerun configure using
--disable-spinlocks. However, performance will be poor. Please report this to
[email protected].
| ^~~~~
./src/postgres/include/storage/s_lock.h:994:30: error: unknown type name
‘slock_t’
994 | extern int tas(volatile slock_t *lock); /* in
port/.../tas.s, or
| ^~~~~~~
./src/postgres/include/storage/s_lock.h:1004:8: error: unknown type name
‘slock_t’
1004 | extern slock_t dummy_spinlock;
| ^~~~~~~
./src/postgres/include/storage/s_lock.h:1009:28: error: unknown type name
‘slock_t’
1009 | extern int s_lock(volatile slock_t *lock, const char *file, int line,
const char *func);
| ^~~~~~~
In file included from ./src/postgres/include/nodes/execnodes.h:25,
from ./src/postgres/include/catalog/index.h:18,
...
```
The patch attached is to fix the issue and I build libpg-query package
successfully on my locally real riscv64 hardware(Unmatched board).
If there are any issues please let me know. thank you.
Bo
--
Best Regards,
The code refer to: https://github.com/postgres/postgres/blob/master/src/include/storage/s_lock.h Bo YU <[email protected]> --- a/src/postgres/include/storage/s_lock.h +++ b/src/postgres/include/storage/s_lock.h @@ -339,6 +339,27 @@ #endif /* HAVE_GCC__SYNC_INT32_TAS */ #endif /* __arm__ || __arm || __aarch64__ || __aarch64 */ +/* + * RISC-V likewise uses __sync_lock_test_and_set(int *, int) if available. + */ +#if defined(__riscv) +#ifdef HAVE_GCC__SYNC_INT32_TAS +#define HAS_TEST_AND_SET + +#define TAS(lock) tas(lock) + +typedef int slock_t; + +static __inline__ int +tas(volatile slock_t *lock) +{ + return __sync_lock_test_and_set(lock, 1); +} + +#define S_UNLOCK(lock) __sync_lock_release(lock) + +#endif /* HAVE_GCC__SYNC_INT32_TAS */ +#endif /* __riscv */ /* S/390 and S/390x Linux (32- and 64-bit zSeries) */ #if defined(__s390__) || defined(__s390x__)
signature.asc
Description: PGP signature

