Compile problems on NetBSD/alpha 1.4.2 (and partial solution)

From: Jaap Boender <jaapb(at)kerguelen(dot)org>
To: pgsql-patches(at)postgresql(dot)org
Subject: Compile problems on NetBSD/alpha 1.4.2 (and partial solution)
Date: 2000-10-03 10:00:25
Message-ID: 200010031000.MAA07855@courbet.kerguelen.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Jaap Boender
Your email address : jaapb(at)kerguelen(dot)org

System Configuration
---------------------
Architecture (example: Intel Pentium) : Alpha AXPpci33 (NoName)

Operating System (example: Linux 2.0.26 ELF) : NetBSD/alpha 1.4.2

PostgreSQL version (example: PostgreSQL-7.0): PostgreSQL-7.0.2

Compiler used (example: gcc 2.8.0) : egcs 1.1.1

Please enter a FULL description of your problem:
------------------------------------------------

Postgres 7.0.2 did not compile on my Alpha with NetBSD 1.4.2 due to
a) the fact that src/backend/main/main.c included the wrong files
b) the TAS implementation was not included.

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

Just get an Alpha, install NetBSD 1.4.2, download source and make it.

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

A patch for problem a), to be applied to src/backend/main/main.c:

<patch>
*** main.c Mon Oct 2 15:57:26 2000
--- main.c.orig Wed Jan 26 06:56:30 2000
***************
*** 15,22 ****
#include <unistd.h>

#if defined(__alpha__) && !defined(linux)
! #include <sys/param.h>
! #include <sys/time.h>
#define ASSEMBLER
#include <sys/proc.h>
#undef ASSEMBLER
--- 15,22 ----
#include <unistd.h>

#if defined(__alpha__) && !defined(linux)
! #include <sys/sysinfo.h>
! #include "machine/hal_sysinfo.h"
#define ASSEMBLER
#include <sys/proc.h>
#undef ASSEMBLER
</patch>

For problem b), I just removed all #defines from
src/include/storage/s_lock.h until I ended up with this file:

<file>
[initial commentary]
#if !defined(S_LOCK_H)
#define S_LOCK_H

#include "storage/ipc.h"

extern void s_lock_sleep(unsigned spin);

#define TAS(lock) tas(lock)
#define S_UNLOCK(lock) do { __asm__("mb"); *(lock) = 0; } while (0)

static __inline__ int
tas(volatile slock_t *lock)
{
register slock_t _res;

__asm__(" ldq $0, %0 \n\
bne $0, 3f \n\
ldq_l $0, %0 \n\
bne $0, 3f \n\
or $31, 1, $0 \n\
stq_c $0, %0 \n\
beq $0, 2f \n\
bis $31, $31, %1 \n\
mb \n\
jmp $31, 4f \n\
2: or $31, 1, $0 \n\
3: bis $0, $0, %1 \n\
4: nop ": "=m"(*lock), "=r"(_res): :"0");

return (int) _res;
}

#endif /* S_LOCK_H */
</file>

This worked. I don't exactly know what is defined and what isn't (I tried
gcc -E, but it didn't quite work the way I expected it to), but my guess is that
HAS_TEST_AND_SET is not defined.
---
Locutiones in Latinum conversae multo sapientes videntur.

Browse pgsql-patches by date

  From Date Subject
Next Message Christof Petig 2000-10-03 19:28:36 Small patch to replace 'idle' by 'trans' if transaction is still open
Previous Message Bruce Momjian 2000-10-03 03:18:14 Re: BeOS Diff Take 3