roaringbitmap / gocroaring Goto Github PK
View Code? Open in Web Editor NEWGo wrapper for CRoaring
Home Page: http://roaringbitmap.org/
License: Apache License 2.0
Go wrapper for CRoaring
Home Page: http://roaringbitmap.org/
License: Apache License 2.0
Dockerfile:
FROM golang:1.15-alpine as builder
RUN apk add --no-cache make gcc musl-dev linux-headers git
WORKDIR /app
ADD . .
RUN go build .
Error:
# github.com/RoaringBitmap/gocroaring
cgo-gcc-prolog: In function '_cgo_e935942c1c5f_Cmacro_stdout':
cgo-gcc-prolog:903:9: error: assignment of read-only variable '_cgo_r'
cgo-gcc-prolog:906:12: error: assignment of read-only member 'r'
Minimal reproducable project:
git clone https://github.com/RoaringBitmap/gocroaring
cd goroaring/proj
docker build .
Code:
https://github.com/RoaringBitmap/gocroaring/compare/master...AskAlexSharov:docker_test?expand=1
See PR RoaringBitmap/CRoaring#145
On macOS Sierra 10.12.1 compilation results in:
# github.com/RoaringBitmap/gocroaring
clang did not produce error at completed:1
on input:
#line 6 "/Users/maciejb/gowork/src/github.com/RoaringBitmap/gocroaring/gocroaring.go"
[…]
full error output:
clang: error: unsupported argument '-q' to option 'Wa,'
No sure if this is helpful, but
$ clang --version
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin16.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Removing the flags mentioned in the error message fixes the problem.
See RoaringBitmap/roaring#73 for the rationale.
I ran some modified version of test code mentioned in README.md. From time to time(not always), it gave the following error. I included the test go code in the below. I used go1.10.1 and it ran on Ubuntu 16 (4.4.0-119-generic)/Intel(R) Core(TM) i7-6700T CPU @ 2.80GHz.
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x16851f0 pc=0x47297a]
runtime stack:
runtime.throw(0x4b3964, 0x2a)
/opt/go/src/runtime/panic.go:616 +0x81
runtime.sigpanic()
/opt/go/src/runtime/signal_unix.go:372 +0x28e
goroutine 1 [syscall]:
runtime.cgocall(0x46a720, 0xc420050e70, 0x151e550)
/opt/go/src/runtime/cgocall.go:128 +0x64 fp=0xc420050e40 sp=0xc420050e08 pc=0x4088e4
github.com/RoaringBitmap/gocroaring._Cfunc_roaring_bitmap_portable_serialize(0x151e550, 0xc420500000, 0x0)
_cgo_gotypes.go:589 +0x4e fp=0xc420050e70 sp=0xc420050e40 pc=0x468f3e
github.com/RoaringBitmap/gocroaring.(*Bitmap).Write.func1(0x151e550, 0xc420500000, 0xc420500000)
/opt/go/.go/src/github.com/RoaringBitmap/gocroaring/gocroaring.go:301 +0x60 fp=0xc420050ea8 sp=0xc420050e70 pc=0x469b50
github.com/RoaringBitmap/gocroaring.(*Bitmap).Write(0xc42000e010, 0xc420500000, 0x14ab70, 0x14ab70, 0x14ab70, 0x14ab70)
/opt/go/.go/src/github.com/RoaringBitmap/gocroaring/gocroaring.go:301 +0x62 fp=0xc420050ed0 sp=0xc420050ea8 pc=0x469492
main.T()
/home/test/gocroaring0.go:26 +0x120 fp=0xc420050f28 sp=0xc420050ed0 pc=0x469fb0
main.main()
/home/test/gocroaring0.go:13 +0x10d fp=0xc420050f88 sp=0xc420050f28 pc=0x469e4d
runtime.main()
/opt/go/src/runtime/proc.go:198 +0x212 fp=0xc420050fe0 sp=0xc420050f88 pc=0x42cbe2
runtime.goexit()
/opt/go/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc420050fe8 sp=0xc420050fe0 pc=0x451321
exit status 2
package main
import (
"math/rand"
"time"
"github.com/RoaringBitmap/gocroaring"
)
func main() {
rand.Seed(time.Now().UTC().UnixNano())
for i := 0; i < 1000; i++ {
T()
}
}
func T() {
r0 := gocroaring.New()
var j uint32
for i := 0; i < 10000000; i++ {
j = uint32(rand.Intn(10000000))
r0.Add(j)
}
r0.RunOptimize() // improves compression
buf0 := make([]byte, r0.SerializedSizeInBytes()+100000)
r0.Write(buf0) // we omit error handling
}
We have a new function that can quickly add a range of values.
following the usual go naming conventions, New
is the preferred name. https://golang.org/doc/effective_go.html#package-names
package main
import "github.com/RoaringBitmap/gocroaring"
func main() {
gocroaring.New(1,2,3).String()
}
The above code prints {1,2,3}
. The returned string is empty.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.