Skip to content

protect::function compile error with clang #87

Closed
@romainfrancois

Description

@romainfrancois
cpp11::cpp_source(code = '
#include <cpp11.hpp>

[[cpp11::register]]
int fun() {
  cpp11::stop("b");
  cpp11::warning("c");
}
', quiet = FALSE)
#> clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Users/romainfrancois/.R/library/4.0/cpp11/include  -I/usr/local/include   -fPIC  -Wall -O3 -Wall -Wimplicit-int-float-conversion -c /private/var/folders/4b/hn4fq98s6810s4ccv2f9hm2h0000gn/T/RtmpDqea6R/file15b0939b498b1/src/code_0.cpp -o /private/var/folders/4b/hn4fq98s6810s4ccv2f9hm2h0000gn/T/RtmpDqea6R/file15b0939b498b1/src/code_0.o
#> In file included from /private/var/folders/4b/hn4fq98s6810s4ccv2f9hm2h0000gn/T/RtmpDqea6R/file15b0939b498b1/src/code_0.cpp:2:
#> In file included from /Users/romainfrancois/.R/library/4.0/cpp11/include/cpp11.hpp:5:
#> In file included from /Users/romainfrancois/.R/library/4.0/cpp11/include/cpp11/as.hpp:9:
#> /Users/romainfrancois/.R/library/4.0/cpp11/include/cpp11/protect.hpp:236:10: error: definition with same mangled name '_ZNK5cpp117protect8functionIFvPKczEEclIJRS3_EEEDTclsr6detailE5applyclL_ZNSt3__17declvalIPS4_EEDTclsr3std3__1E9__declvalIT_ELi0EEEvEEclsr3stdE16forward_as_tuplespclsr3stdE7forwardIT_Efp_EEEEDpOSD_' as another definition
#>     auto operator()(A&&... a) const
#>          ^
#> /Users/romainfrancois/.R/library/4.0/cpp11/include/cpp11/protect.hpp:236:10: note: previous definition is here
#> 1 error generated.
#> make: *** [/private/var/folders/4b/hn4fq98s6810s4ccv2f9hm2h0000gn/T/RtmpDqea6R/file15b0939b498b1/src/code_0.o] Error 1
#> Error in dyn.load(shared_lib, local = TRUE, now = TRUE): unable to load shared object '/var/folders/4b/hn4fq98s6810s4ccv2f9hm2h0000gn/T//RtmpDqea6R/file15b0939b498b1/src/code_0.so':
#>   dlopen(/var/folders/4b/hn4fq98s6810s4ccv2f9hm2h0000gn/T//RtmpDqea6R/file15b0939b498b1/src/code_0.so, 6): image not found

Created on 2020-08-10 by the reprex package (v0.3.0.9001)

ping @bkietz

This failed to compile array.cpp iin arrow, which looks like:

void arrow::r::validate_slice_length(R_xlen_t length, int64_t available) {
  if (length == NA_INTEGER) {
    cpp11::stop("Slice 'length' cannot be NA");
  }
  if (length < 0) {
    cpp11::stop("Slice 'length' cannot be negative");
  }
  if (length > available) {
    cpp11::warning("Slice 'length' greater than available length");
  }
}

@jimhester can we try to fix this before #84 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions