Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add roaring64 to amalgamation script #545

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

SLieve
Copy link
Contributor

@SLieve SLieve commented Jan 9, 2024

Follow-up from PR #534. Fixes #543.

Tested:

$ ./amalgamation.sh
We are about to amalgamate all CRoaring files into one source file.
For rationale, see: https://www.sqlite.org/amalgamation.html
and: https://en.wikipedia.org/wiki/Single_Compilation_Unit

Creating roaring.h...
Creating roaring.c...
Creating amalgamation_demo.c...
Creating roaring.hh...
Creating amalgamation_demo.cpp...

Files have been written to current directory: /home/soerian/repos/CRoaring
-rw-rw-r-- 1 soerian soerian    825 Jan  9 09:28 amalgamation_demo.c
-rw-rw-r-- 1 soerian soerian   2526 Jan  9 09:28 amalgamation_demo.cpp
-rw-rw-r-- 1 soerian soerian 951998 Jan  9 09:28 roaring.c
-rw-rw-r-- 1 soerian soerian  85995 Jan  9 09:28 roaring.h
-rw-rw-r-- 1 soerian soerian 105913 Jan  9 09:28 roaring.hh

The interface is found in the file 'include/roaring/roaring.h'.

For C, try:
cc -O3 -std=c11  -o amalgamation_demo amalgamation_demo.c  && ./amalgamation_demo

For C++, try:
c++ -O3 -std=c++11 -o amalgamation_demo amalgamation_demo.cpp  && ./amalgamation_demo

You can build a shared library with the following command:
cc -O3 -std=c11 -shared -o libroaring.so -fPIC roaring.c

$ cc -O3 -std=c11  -o amalgamation_demo amalgamation_demo.c  && ./amalgamation_demo
cardinality = 900
cardinality (64-bit) = 900
1000

@lemire
Copy link
Member

lemire commented Jan 9, 2024

!!! Great.

@lemire lemire merged commit f747551 into RoaringBitmap:master Jan 9, 2024
25 checks passed
@Dr-Emann
Copy link
Member

Dr-Emann commented Jan 9, 2024

@SLieve Seems like the build for the C++ example for the amalgamation demo is broken with these changes. Looks like all places where C++ requires casting from void *

Output
$ ./amalgamation.sh
We are about to amalgamate all CRoaring files into one source file.
For rationale, see: https://www.sqlite.org/amalgamation.html
and: https://en.wikipedia.org/wiki/Single_Compilation_Unit

Creating roaring.h...
Creating roaring.c...
Creating amalgamation_demo.c...
Creating roaring.hh...
Creating amalgamation_demo.cpp...

Files have been written to current directory: /Users/zach/Development/CRoaring
-rw-r--r--  1 zach  staff     587 Jan  8 20:44 amalgamation_demo.c
-rw-r--r--  1 zach  staff    2526 Jan  8 20:44 amalgamation_demo.cpp
-rw-r--r--  1 zach  staff  951998 Jan  8 20:44 roaring.c
-rw-r--r--  1 zach  staff   85995 Jan  8 20:44 roaring.h
-rw-r--r--  1 zach  staff  105913 Jan  8 20:44 roaring.hh

The interface is found in the file 'include/roaring/roaring.h'.

For C, try:
cc -O3 -std=c11  -o amalgamation_demo amalgamation_demo.c  && ./amalgamation_demo

For C++, try:
c++ -O3 -std=c++11 -o amalgamation_demo amalgamation_demo.cpp  && ./amalgamation_demo

You can build a shared library with the following command:
cc  -O3 -std=c11 -shared -o libroaring.dylib -fPIC roaring.c

$ c++ -O3 -std=c++11 -o amalgamation_demo amalgamation_demo.cpp && ./amalgamation_demo
./roaring.c:9206:18: error: cannot initialize a variable of type 'art_node4_t *' (aka 'roaring::internal::art_node4_s *') with an rvalue of type 'void *'
    art_node4_t *node = roaring_malloc(sizeof(art_node4_t));
                 ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./roaring.c:9368:19: error: cannot initialize a variable of type 'art_node16_t *' (aka 'roaring::internal::art_node16_s *') with an rvalue of type 'void *'
    art_node16_t *node = roaring_malloc(sizeof(art_node16_t));
                  ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./roaring.c:9517:19: error: cannot initialize a variable of type 'art_node48_t *' (aka 'roaring::internal::art_node48_s *') with an rvalue of type 'void *'
    art_node48_t *node = roaring_malloc(sizeof(art_node48_t));
                  ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./roaring.c:9660:20: error: cannot initialize a variable of type 'art_node256_t *' (aka 'roaring::internal::art_node256_s *') with an rvalue of type 'void *'
    art_node256_t *node = roaring_malloc(sizeof(art_node256_t));
                   ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./roaring.c:22046:13: error: cannot initialize a variable of type 'leaf_t *' (aka 'roaring::api::roaring64_leaf_s *') with an rvalue of type 'void *'
    leaf_t *leaf = roaring_malloc(sizeof(leaf_t));
            ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./roaring.c:22053:13: error: cannot initialize a variable of type 'leaf_t *' (aka 'roaring::api::roaring64_leaf_s *') with an rvalue of type 'void *'
    leaf_t *result_leaf = roaring_malloc(sizeof(leaf_t));
            ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./roaring.c:22069:25: error: cannot initialize a variable of type 'roaring64_bitmap_t *' (aka 'roaring::api::roaring64_bitmap_s *') with an rvalue of type 'void *'
    roaring64_bitmap_t *r = roaring_malloc(sizeof(roaring64_bitmap_t));
                        ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./roaring.c:22750:21: error: cannot initialize a variable of type 'leaf_t *' (aka 'roaring::api::roaring64_leaf_s *') with an rvalue of type 'void *'
            leaf_t *result_leaf = roaring_malloc(sizeof(leaf_t));
                    ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./roaring.c:22948:25: error: cannot initialize a variable of type 'leaf_t *' (aka 'roaring::api::roaring64_leaf_s *') with an rvalue of type 'void *'
                leaf_t *result_leaf = roaring_malloc(sizeof(leaf_t));
                        ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./roaring.c:23064:25: error: cannot initialize a variable of type 'leaf_t *' (aka 'roaring::api::roaring64_leaf_s *') with an rvalue of type 'void *'
                leaf_t *result_leaf = roaring_malloc(sizeof(leaf_t));
                        ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./roaring.c:23199:25: error: cannot initialize a variable of type 'leaf_t *' (aka 'roaring::api::roaring64_leaf_s *') with an rvalue of type 'void *'
                leaf_t *result_leaf = roaring_malloc(sizeof(leaf_t));
                        ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 errors generated.

@SLieve
Copy link
Contributor Author

SLieve commented Jan 9, 2024

@Dr-Emann thanks! #547

@SLieve SLieve deleted the r64_amalgamation branch January 22, 2024 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include ART-based 64-bit roaring to the amalgamated files
3 participants