Master doesn't build on OpenBSD (leveldb) #10670

Closed
laanwj opened this Issue Jun 26, 2017 · 6 comments

Comments

Projects
None yet
3 participants
Owner

laanwj commented Jun 26, 2017 edited

It looks like OpenBSD's eg++ which is based on 4.9.4 (or rather, the binutils based on 2.17) doesn't support the CRC32 instructions introduced with the recent leveldb upgrade:

Making all in src
gmake[1]: Entering directory '/home/user/bitcoin/src'
gmake[2]: Entering directory '/home/user/bitcoin/src'
gmake[3]: Entering directory '/home/user/bitcoin'
gmake[3]: Leaving directory '/home/user/bitcoin'
eg++ -std=c++11 -DHAVE_CONFIG_H -I. -I../src/config  -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -I./leveldb -DOS_OPENBSD -DLEVELDB_ATOMIC_PRESENT -D__STDC_LIMIT_MACROS  -DLEVELDB_PLATFORM_POSIX -I./leveldb/include -I./leveldb/helpers/memenv -DLEVELDB_PLATFORM_POSIX_SSE -DHAVE_BUILD_INFO -D__STDC_FORMAT_MACROS -Wstack-protector -fstack-protector-all  -fPIE -msse4.2 -g -O2 -Wall -Wextra -Wformat -Wvla -Wformat-security -Wno-unused-parameter -MT leveldb/port/leveldb_libleveldb_sse42_a-port_posix_sse.o -MD -MP -MF leveldb/port/.deps/leveldb_libleveldb_sse42_a-port_posix_sse.Tpo -c -o leveldb/port/leveldb_libleveldb_sse42_a-port_posix_sse.o `test -f 'leveldb/port/port_posix_sse.cc' || echo './'`leveldb/port/port_posix_sse.cc
leveldb/port/port_posix_sse.cc: In function 'uint32_t leveldb::port::AcceleratedCRC32C(uint32_t, const char*, size_t)':
leveldb/port/port_posix_sse.cc:59:15: warning: 'ecx' may be used uninitialized in this function [-Wmaybe-uninitialized]
   return (ecx & (1 << 20)) != 0;
               ^
leveldb/port/port_posix_sse.cc:57:26: note: 'ecx' was declared here
   unsigned int eax, ebx, ecx, edx;
                          ^
/tmp//ccBAimlE.s: Assembler messages:
/tmp//ccBAimlE.s:95: Error: no such instruction: `crc32b -1(%rbp),%eax'
/tmp//ccBAimlE.s:121: Error: no such instruction: `crc32q -8(%rbp),%rax'
/tmp//ccBAimlE.s:148: Error: no such instruction: `crc32b -1(%rbp),%eax'
:312: Error: no such instruction: `crc32l 0(%rbp),%eax'
gmake[2]: *** [Makefile:4921: leveldb/port/leveldb_libleveldb_sse42_a-port_posix_sse.o] Error 1
gmake[2]: Leaving directory '/home/user/bitcoin/src'
gmake[1]: *** [Makefile:9224: all-recursive] Error 1
gmake[1]: Leaving directory '/home/user/bitcoin/src'
gmake: *** [Makefile:738: all-recursive] Error 1

Likely we need to add some check in the build system whether the instruction can be used?

laanwj added the Build system label Jun 26, 2017

laanwj added this to the 0.15.0 milestone Jun 26, 2017

janstary commented Jul 7, 2017

I get the same error on 6.1-current/amd64

Member

theuni commented Jul 7, 2017

Taking this one. We just need to do a quick compiler check in configure.

theuni self-assigned this Jul 7, 2017

janstary commented Jul 8, 2017

Same error on MacOSX 10.6.8 (Intel) as well.

On the same machine, version 0.14.2 does not have this problem.

Owner

laanwj commented Jul 12, 2017

@laanwj laanwj added a commit that referenced this issue Jul 14, 2017

@laanwj laanwj Merge #10806: build: verify that the assembler can handle crc32 funct…
…ions


d34d77a build: verify that the assembler can handle crc32 functions (Cory Fields)

Pull request description:

  Also, enable crc32 even if -msse4.2 wasn't added by us, as long as it works. This allows custom flags (such as -march=native) to work as expected.

  Addresses #10670.

Tree-SHA512: e1a41a87b078d270bc645814315b229ad9c16556a4d14fb66b27a65b28d0caf9bf324f8c1e221854992aa17f53466eece06faebbf74d59b3d4ff2e6db6c614a4
db825d2
Owner

laanwj commented Jul 17, 2017

This was fixed by #10806

laanwj closed this Jul 17, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment