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

Improve the MinGW builds and simplify bundling the static library dependencies. #4448

Merged
merged 8 commits into from
Oct 30, 2023

Conversation

teo-tsirpanis
Copy link
Member

@teo-tsirpanis teo-tsirpanis commented Oct 23, 2023

SC-35901

As a preparation towards stopping bundling our static library dependencies (which would lead to significant simplifications in the build system), this PR updates the MinGW builds (which supply the binaries the R API uses on Windows) to stop relying on that automatic bundling. Our approach becomes more blunt, just copying the contents of the build directory's vcpkg_installed directory, where vcpkg places all libraries we might need.

Nothing (fingers crossed) should change on the side of the R API. These are the libraries that are bundled before and after this PR:

Before
-rw-r--r--  0 root   root   267222 Οκτ 19 16:08 ucrt64/lib/libaws-c-common.a
-rw-r--r--  0 root   root    28638 Οκτ 19 16:08 ucrt64/lib/libaws-c-event-stream.a
-rw-r--r--  0 root   root    47078 Οκτ 19 16:08 ucrt64/lib/libaws-checksums.a
-rw-r--r--  0 root   root  1540524 Οκτ 19 16:08 ucrt64/lib/libaws-cpp-sdk-cognito-identity.a
-rw-r--r--  0 root   root  2315096 Οκτ 19 16:08 ucrt64/lib/libaws-cpp-sdk-core.a
-rw-r--r--  0 root   root   319782 Οκτ 19 16:08 ucrt64/lib/libaws-cpp-sdk-identity-management.a
-rw-r--r--  0 root   root  5501212 Οκτ 19 16:08 ucrt64/lib/libaws-cpp-sdk-s3.a
-rw-r--r--  0 root   root   676178 Οκτ 19 16:08 ucrt64/lib/libaws-cpp-sdk-sts.a
-rw-r--r--  0 root   root    69652 Οκτ 19 16:08 ucrt64/lib/libbz2.a
-rw-r--r--  0 root   root   452820 Οκτ 19 16:08 ucrt64/lib/libfmt.a
-rw-r--r--  0 root   root   241756 Οκτ 19 16:08 ucrt64/lib/liblibmagic.a
-rw-r--r--  0 root   root   121288 Οκτ 19 16:08 ucrt64/lib/liblz4.a
-rw-r--r--  0 root   root   785406 Οκτ 19 16:08 ucrt64/lib/libpcre2-8.a
-rw-r--r--  0 root   root     3934 Οκτ 19 16:08 ucrt64/lib/libpcre2-posix.a
-rw-r--r--  0 root   root    33576 Οκτ 19 16:08 ucrt64/lib/libsharpyuv.a
-rw-r--r--  0 root   root  1404130 Οκτ 19 16:08 ucrt64/lib/libspdlog.a
-rw-r--r--  0 root   root   340224 Οκτ 19 16:08 ucrt64/lib/libtiledb.dll.a
-rw-r--r--  0 root   root 41120496 Οκτ 19 16:08 ucrt64/lib/libtiledbstatic.a
-rw-r--r--  0 root   root   881632 Οκτ 19 16:08 ucrt64/lib/libwebp.a
-rw-r--r--  0 root   root   485960 Οκτ 19 16:08 ucrt64/lib/libwebpdecoder.a
-rw-r--r--  0 root   root    14684 Οκτ 19 16:08 ucrt64/lib/libwebpdemux.a
-rw-r--r--  0 root   root    46538 Οκτ 19 16:08 ucrt64/lib/libwebpmux.a
-rw-r--r--  0 root   root   102320 Οκτ 19 16:08 ucrt64/lib/libz.a
-rw-r--r--  0 root   root   814174 Οκτ 19 16:08 ucrt64/lib/libzstd.a
After
-rw-r--r--  0 root   root   321018 Οκτ 20 14:33 ucrt64/lib/libaws-c-auth.a
-rw-r--r--  0 root   root    78040 Οκτ 20 14:33 ucrt64/lib/libaws-c-cal.a
-rw-r--r--  0 root   root   356172 Οκτ 20 14:33 ucrt64/lib/libaws-c-common.a
-rw-r--r--  0 root   root     8570 Οκτ 20 14:33 ucrt64/lib/libaws-c-compression.a
-rw-r--r--  0 root   root   121990 Οκτ 20 14:33 ucrt64/lib/libaws-c-event-stream.a
-rw-r--r--  0 root   root   539052 Οκτ 20 14:33 ucrt64/lib/libaws-c-http.a
-rw-r--r--  0 root   root   417204 Οκτ 20 14:33 ucrt64/lib/libaws-c-io.a
-rw-r--r--  0 root   root   415280 Οκτ 20 14:33 ucrt64/lib/libaws-c-mqtt.a
-rw-r--r--  0 root   root   242642 Οκτ 20 14:33 ucrt64/lib/libaws-c-s3.a
-rw-r--r--  0 root   root   130632 Οκτ 20 14:33 ucrt64/lib/libaws-c-sdkutils.a
-rw-r--r--  0 root   root    39962 Οκτ 20 14:33 ucrt64/lib/libaws-checksums.a
-rw-r--r--  0 root   root   448814 Οκτ 20 14:33 ucrt64/lib/libaws-cpp-sdk-access-management.a
-rw-r--r--  0 root   root   849090 Οκτ 20 14:33 ucrt64/lib/libaws-cpp-sdk-cognito-identity.a
-rw-r--r--  0 root   root  3630884 Οκτ 20 14:33 ucrt64/lib/libaws-cpp-sdk-core.a
-rw-r--r--  0 root   root  4055126 Οκτ 20 14:33 ucrt64/lib/libaws-cpp-sdk-iam.a
-rw-r--r--  0 root   root   346146 Οκτ 20 14:33 ucrt64/lib/libaws-cpp-sdk-identity-management.a
-rw-r--r--  0 root   root  3799166 Οκτ 20 14:33 ucrt64/lib/libaws-cpp-sdk-s3.a
-rw-r--r--  0 root   root   495284 Οκτ 20 14:33 ucrt64/lib/libaws-cpp-sdk-sts.a
-rw-r--r--  0 root   root  1237918 Οκτ 20 14:33 ucrt64/lib/libaws-crt-cpp.a
-rw-r--r--  0 root   root    98636 Οκτ 20 14:33 ucrt64/lib/libbz2.a
-rw-r--r--  0 root   root   452820 Οκτ 20 14:33 ucrt64/lib/libfmt.a
-rw-r--r--  0 root   root   241756 Οκτ 20 14:33 ucrt64/lib/liblibmagic.a
-rw-r--r--  0 root   root   212328 Οκτ 20 14:33 ucrt64/lib/liblz4.a
-rw-r--r--  0 root   root   304626 Οκτ 20 14:33 ucrt64/lib/liblzma.a
-rw-r--r--  0 root   root   719352 Οκτ 20 14:33 ucrt64/lib/libpcre2-16.a
-rw-r--r--  0 root   root   689066 Οκτ 20 14:33 ucrt64/lib/libpcre2-32.a
-rw-r--r--  0 root   root   785406 Οκτ 20 14:33 ucrt64/lib/libpcre2-8.a
-rw-r--r--  0 root   root     3934 Οκτ 20 14:33 ucrt64/lib/libpcre2-posix.a
-rw-r--r--  0 root   root    33576 Οκτ 20 14:33 ucrt64/lib/libsharpyuv.a
-rw-r--r--  0 root   root  1404130 Οκτ 20 14:33 ucrt64/lib/libspdlog.a
-rw-r--r--  0 root   root   340224 Οκτ 20 14:33 ucrt64/lib/libtiledb.dll.a
-rw-r--r--  0 root   root 41075680 Οκτ 20 14:33 ucrt64/lib/libtiledbstatic.a
-rw-r--r--  0 root   root   881632 Οκτ 20 14:33 ucrt64/lib/libwebp.a
-rw-r--r--  0 root   root   485960 Οκτ 20 14:33 ucrt64/lib/libwebpdecoder.a
-rw-r--r--  0 root   root    14684 Οκτ 20 14:33 ucrt64/lib/libwebpdemux.a
-rw-r--r--  0 root   root    46538 Οκτ 20 14:33 ucrt64/lib/libwebpmux.a
-rw-r--r--  0 root   root   123968 Οκτ 20 14:33 ucrt64/lib/libzlib.a
-rw-r--r--  0 root   root  1227472 Οκτ 20 14:33 ucrt64/lib/libzstd.a

Notice that no libraries have stoppped from being bundled. Because we now bundle libraries we don't actually need, the package's size increased:

Uncompressed Compressed
Before 73.1MB 9.5MB
After 112.5MB 13.1MB

Also the package now includes some useless files like around one thousand headers for the AWS SDK, but they seem to be excluded from being uploaded.

I also made some improvement that should speed-up the MinGW builds (build dependencies in Release mode only, cache them and disable tests).


TYPE: IMPROVEMENT
DESC: Improve building the Windows binaries for the R API.

It now flows through the superbuild and gets respected when overridden in the command line.
Dependencies provided by MinGW packages are not placed in the `vcpkg_installed` folder, requiring logic in the build script to have them bundled, which logic we want to remove.
@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #35901: Copy the vcpkg_installed directory to the MinGW package..

Copy link
Member

@ihnorton ihnorton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as @eddelbuettel confirms this, LGTM.

Copy link
Contributor

@eddelbuettel eddelbuettel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"I abstain, your honor."

I have no Windows system to test. I could test this if the artifacts from the PR were piled up somewhere where I could access them. I could then try modify the build and overwrite the once we download by default, and use these.

That said, given the recent test under 2.18.0-rc0 I am confident we can make this work. I just cannot assert that this works.

@teo-tsirpanis
Copy link
Member Author

You could make a branch in rwinlib-tiledb, another branch in TileDB-R that points to the former branch, and run CI.

@eddelbuettel
Copy link
Contributor

Might be easier to just borrow a few minutes from a colleague using Windows and R, and I have a "volunteer" in mind.

Does the PR produce artifacts someone can access?

@teo-tsirpanis
Copy link
Member Author

Yes.

@eddelbuettel
Copy link
Contributor

Sweet, thanks. I missed that. There are too many builds triggered by you :) so I missed this.

@eddelbuettel
Copy link
Contributor

@mojaveazure was kind enough to give it a whirl but seems to have uncovered that this build was up to date with some recent merges in dev and some of the enumerations extensions we need in the current version of the R package are missing -- so a build attempt failed. Another try with the released version of the R package should shed more light.

@eddelbuettel
Copy link
Contributor

@teo-tsirpanis : There is a lot of 'shrapnel' @mojaveazure is seeing in AWS linkage. Example undefined reference to aws_mqtt_library_init'`. We never needed an MQTT library (as that is AFAIK a messaging service). Any idea if the set of libraries could be reduced? Else we have to link with 'all of them' and given the possible link order permutations that could be tedious to sort out.

@teo-tsirpanis
Copy link
Member Author

2.18 has updated the AWS SDK and the new version unconditionally calls aws_mqtt_library_init when initializing the aws-crt-cpp library.

You will have to update the linked libraries in Makevars.win. Here's the list of imported AWS SDK targets in the installed CMake config, to help you with the ordering:

aws-cpp-sdk-identity-management
aws-cpp-sdk-cognito-identity
aws-cpp-sdk-sts
aws-cpp-sdk-s3
aws-cpp-sdk-core
AWS::aws-crt-cpp
AWS::aws-c-auth
AWS::aws-c-cal
AWS::aws-c-common
AWS::aws-c-compression
AWS::aws-c-event-stream
AWS::aws-c-http
AWS::aws-c-io
AWS::aws-c-mqtt
AWS::aws-c-s3
AWS::aws-checksums
AWS::aws-c-sdkutils

@eddelbuettel
Copy link
Contributor

We will try to work it out. On Linux cmake hides that from me.

Copy link
Contributor

@eddelbuettel eddelbuettel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Group approving" as @mojaveazure @teo-tsirpanis and I were able to ascertain that the artifacts produced allow the R packages both from the most recent release as well as from HEAD build, install, and test cleanly.

mojaveazure added a commit to TileDB-Inc/TileDB-R that referenced this pull request Oct 27, 2023
Includes updated linking directories and libraries for
expanded/simplified mingw build of tiledb-core
@KiterLuc KiterLuc merged commit 9921fc6 into TileDB-Inc:dev Oct 30, 2023
51 checks passed
@teo-tsirpanis teo-tsirpanis deleted the mingw-static-deps branch November 6, 2023 12:27
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.

4 participants