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

Update vendored S2 version #257

Merged
merged 19 commits into from
Sep 25, 2024
Merged

Update vendored S2 version #257

merged 19 commits into from
Sep 25, 2024

Conversation

paleolimbot
Copy link
Collaborator

It turns out that getting CMake to do the right thing is hard (#249)! I think we still need it for Abseil, and unfortunately updating S2 requries an Abseil update too. I'll put this here and do the Abseil update separately 🙂

@paleolimbot paleolimbot marked this pull request as draft June 2, 2024 03:14
paleolimbot and others added 3 commits June 17, 2024 13:45
* copy some prior art

* remove previous absl files

* renove abseil files

* add vendor in tools/

* it works!

* fix some initial check issues

* lazier config

* remove r 3.6 on windows

* see if removing the braces helps

* maybe fix substitution

* just link it all

* try again

* helppers

* slight updates

* better flags

* more cmake

* just hard code it

* pkg-config

* add gnu make to makefile

* don't link rt

* ignore windows dir

* possible progress for R 4.2

* more win checks

* don't use configure.win

* maybe working on R 4.2

* also use cxx17

* check for absl

* maybe with quotes

* version and news

* maybe the right flags

* maybe try unifying makevars

* maybe work on R 4.2/4/1

* maybe fix makevars.win

* maybe fix for R 4.2

* maybe fix R 4.1

* see if we're getting the right if statement

* temp fix for old s2 warnings

* maybe fix again

* try again

* document configure.win

* maybe fix R 4.2 warning

* try again for globals

* maybe use different namespace

* use pkg-config abseil

* fix comment

* maybe fix

* quality of life improvements

* clean news

* better cleanup/configure

* reasonable path to not awful dev setup without system abseil

* enforce minimum version in pkg-config check
@paleolimbot
Copy link
Collaborator Author

Ok, we're down to some warnings on Windows:

Found the following significant warnings:
  ../src/s2/util/coding/coder.h:499:55: warning: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'class Decoder'; use assignment or value-initialization instead [-Wclass-memaccess]

❯ checking compiled code ... NOTE
  File 's2/libs/x64/s2.dll':
    Found '_ZSt4cout', possibly from 'std::cout' (C++)
      Objects: 's2/s2boolean_operation.o', 's2/s2builder.o'

...and a few undefined symbols on Rtools40:

2024-07-22T02:23:27.6498950Z c:/rtools40/mingw64/bin/g++ -shared -s -static-libgcc -o s2.dll tmp.def s2/encoded_s2cell_id_vector.o s2/encoded_s2point_vector.o s2/encoded_s2shape_index.o s2/encoded_string_vector.o s2/id_set_lexicon.o s2/mutable_s2shape_index.o s2/r2rect.o s2/s1angle.o s2/s1chord_angle.o s2/s1interval.o s2/s2boolean_operation.o s2/s2buffer_operation.o s2/s2builder_graph.o s2/s2builder.o s2/s2builderutil_closed_set_normalizer.o s2/s2builderutil_find_polygon_degeneracies.o s2/s2builderutil_get_snapped_winding_delta.o s2/s2builderutil_lax_polygon_layer.o s2/s2builderutil_lax_polyline_layer.o s2/s2builderutil_s2point_vector_layer.o s2/s2builderutil_s2polygon_layer.o s2/s2builderutil_s2polyline_layer.o s2/s2builderutil_s2polyline_vector_layer.o s2/s2builderutil_snap_functions.o s2/s2cap.o s2/s2cell_id.o s2/s2cell_index.o s2/s2cell_union.o s2/s2cell.o s2/s2centroids.o s2/s2closest_cell_query.o s2/s2closest_edge_query.o s2/s2closest_point_query.o s2/s2contains_vertex_query.o s2/s2convex_hull_query.o s2/s2coords.o s2/s2crossing_edge_query.o s2/s2debug.o s2/s2earth.o s2/s2edge_clipping.o s2/s2edge_crosser.o s2/s2edge_crossings.o s2/s2edge_distances.o s2/s2edge_tessellator.o s2/s2error.o s2/s2furthest_edge_query.o s2/s2hausdorff_distance_query.o s2/s2latlng_rect_bounder.o s2/s2latlng_rect.o s2/s2latlng.o s2/s2lax_loop_shape.o s2/s2lax_polygon_shape.o s2/s2lax_polyline_shape.o s2/s2loop_measures.o s2/s2loop.o s2/s2max_distance_targets.o s2/s2measures.o s2/s2memory_tracker.o s2/s2metrics.o s2/s2min_distance_targets.o s2/s2padded_cell.o s2/s2point_compression.o s2/s2point_region.o s2/s2pointutil.o s2/s2polygon.o s2/s2polyline_alignment.o s2/s2polyline_measures.o s2/s2polyline_simplifier.o s2/s2polyline.o s2/s2predicates.o s2/s2projections.o s2/s2r2rect.o s2/s2region_coverer.o s2/s2region_intersection.o s2/s2region_term_indexer.o s2/s2region_union.o s2/s2region.o s2/s2shape_index_buffered_region.o s2/s2shape_index_measures.o s2/s2shape_index.o s2/s2shape_measures.o s2/s2shape_nesting_query.o s2/s2shapeutil_build_polygon_boundaries.o s2/s2shapeutil_coding.o s2/s2shapeutil_contains_brute_force.o s2/s2shapeutil_conversion.o s2/s2shapeutil_edge_iterator.o s2/s2shapeutil_get_reference_point.o s2/s2shapeutil_visit_crossing_edge_pairs.o s2/s2text_format.o s2/s2wedge_relations.o s2/s2winding_operation.o s2/util/bits/bit-interleave.o s2/util/coding/coder.o s2/util/coding/varint.o s2/util/math/exactfloat/exactfloat.o s2/util/math/mathutil.o s2/util/units/length-units.o cpp-compat.o s2-accessors.o s2-bounds.o s2-cell.o s2-cell-union.o s2-constructors-formatters.o s2-predicates.o s2-transformers.o init.o RcppExports.o s2-geography.o s2-lnglat.o s2-matrix.o wk-impl.o s2geography/accessors-geog.o s2geography/accessors.o s2geography/build.o s2geography/coverings.o s2geography/distance.o s2geography/geography.o s2geography/linear-referencing.o s2geography/predicates.o -L../tools/dist/lib -labsl_flags_internal -labsl_flags_marshalling -labsl_flags_reflection -labsl_flags_private_handle_accessor -labsl_flags_commandlineflag -labsl_flags_commandlineflag_internal -labsl_flags_config -labsl_flags_program_name -labsl_raw_hash_set -labsl_hashtablez_sampler -labsl_log_internal_check_op -labsl_log_internal_conditions -labsl_log_internal_message -labsl_examine_stack -labsl_log_internal_format -labsl_log_internal_proto -labsl_log_internal_nullguard -labsl_log_internal_log_sink_set -labsl_log_internal_globals -labsl_log_globals -labsl_hash -labsl_city -labsl_bad_variant_access -labsl_low_level_hash -labsl_log_sink -labsl_log_entry -labsl_status -labsl_cord -labsl_cordz_info -labsl_cord_internal -labsl_cordz_functions -labsl_exponential_biased -labsl_cordz_handle -labsl_synchronization -labsl_graphcycles_internal -labsl_kernel_timeout_internal -labsl_time -labsl_civil_time -labsl_time_zone -labsl_crc_cord_state -labsl_crc32c -labsl_crc_internal -labsl_crc_cpu_detect -labsl_bad_optional_access -labsl_stacktrace -labsl_strerror -labsl_str_format_internal -labsl_symbolize -ldbghelp -labsl_debugging_internal -labsl_demangle_internal -labsl_malloc_internal -labsl_strings -labsl_strings_internal -labsl_string_view -labsl_base -ladvapi32 -labsl_spinlock_wait -labsl_int128 -labsl_throw_delegate -labsl_raw_logging_internal -labsl_log_severity -limagehlp -L../windows/openssl/lib -lssl -lcrypto -lz -lws2_32 -lgdi32 -lcrypt32 -LC:/R/bin/x64 -lR
2024-07-22T02:23:27.6501502Z C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../tools/dist/lib/libabsl_log_internal_message.a(log_message.cc.obj):log_message.cc:(.rdata$_ZTVN4absl15s2_lts_2023080212log_internal10LogMessage11OstreamViewE[_ZTVN4absl15s2_lts_2023080212log_internal10LogMessage11OstreamViewE]+0x38): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::seekpos(std::fpos<_Mbstatet>, std::_Ios_Openmode)'
2024-07-22T02:23:27.6502700Z C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../tools/dist/lib/libabsl_log_internal_globals.a(globals.cc.obj):globals.cc:(.text+0x50): undefined reference to `__imp___acrt_iob_func'

@edzer
Copy link
Member

edzer commented Jul 22, 2024

Looks like you've visited the warning earlier: https://github.com/r-spatial/s2/blob/main/src/s2/util/coding/coder.h#L465

@paleolimbot paleolimbot marked this pull request as ready for review September 12, 2024 21:10
@paleolimbot
Copy link
Collaborator Author

@edzer I think the best way forward on here is to merge this and attempt to fix the missing symbol on R/Windows 4.0 and 4.1 separately (in parallel with some testing against Abseil provided in various distributions to ensure the install works smoothly).

@paleolimbot paleolimbot merged commit ece75d4 into main Sep 25, 2024
9 checks passed
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.

2 participants