Re: PostgreSQL cannot be compiled on RISC-V - Mailing list pgsql-bugs

From Richard W.M. Jones
Subject Re: PostgreSQL cannot be compiled on RISC-V
Date
Msg-id 20161120103652.GN11243@redhat.com
Whole thread Raw
In response to Re: PostgreSQL cannot be compiled on RISC-V  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: PostgreSQL cannot be compiled on RISC-V
Re: PostgreSQL cannot be compiled on RISC-V
List pgsql-bugs
On Sat, Nov 19, 2016 at 10:08:07PM -0500, Tom Lane wrote:
> "Richard W.M. Jones" <rjones@redhat.com> writes:
> > ../../../src/include/storage/s_lock.h:890: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.
Pleasereport this to pgsql-bugs@postgresql.org. 
>
> Hi Richard,
>
> What's a RISC-V, and can you provide some gcc assembler implementing
> spinlocks for it?  See commentary and code for other platforms in
> src/include/storage/s_lock.h.

The answer to the first question is a lot easier than the second :-)

RISC-V is an open source instruction set architecture.  https://riscv.org/
I'm currently compiling Fedora for RISC-V and this was the thing
that stops PostgreSQL from being compiled.
https://fedoraproject.org/wiki/Architectures/RISC-V

I looked at the file you pointed to.  I believe it should be possible
to follow the ARM implementation and call __sync_lock_test_and_set (a
GCC builtin).  I will try this out, but note that compiling anything
on RISC-V by hand is currently a very tedious process that can take
many hours.

    - - -

Yesterday I added --disable-spinlocks and built PostgreSQL again
overnight, and it compiles fine but fails in the tests:

  https://fedorapeople.org/groups/risc-v/logs/postgresql/9.5.5-1.fc25.0.riscv64/build.log

The errors mostly seem to be:

  ERROR:  unexpected EOF on client connection with an open transaction

This is *probably* because our kernel lacks networking support, but
I didn't look at this in great detail yet.

Rich.

--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/

pgsql-bugs by date:

Previous
From: John R Pierce
Date:
Subject: Re: PostgreSQL cannot be compiled on RISC-V
Next
From: "Richard W.M. Jones"
Date:
Subject: Re: PostgreSQL cannot be compiled on RISC-V