-
Notifications
You must be signed in to change notification settings - Fork 25
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
[c++] Remove spdlog
requirement
#1852
Conversation
#include "utils/carrow.h" | ||
#include "utils/logger.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why were these headers added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.h
is used for the LOG_*
macros and fmt
. carrow.h
is used for ArrowSchema
. soma_array.h
use to include logger.h
but that has now been removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But soma_array.h
includes logger_public.h
. Isn't it enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, logger_public.h
does not expose fmt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW one can (somewhat poorly) drop in tinyfmt
which is a less powerful than fmt
but a single-header C++11 library. The key is, as @nguyenv points out, that the public logger only takes a string (or const char*
, I forgot) to 'report' and does no formatting whatsoever itself.
libtiledbsoma/src/soma/soma_array.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move the generic method definitions to the .cc
file and add explicit instantiations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you talking about separating implemention of the templated functions in the cc
? I considered doing that, but I feel very ambivalent about having a long list of explicit instantiations for multiple functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something that we do in core?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eddelbuettel, if you don't mind, could you take a look at the R failures and push the necessary changes to this branch? Today I'd like to focus on getting the necessary Python stuff working for 1.5.0. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Of course if this doesn't land in |
These are compilation errors coming from the header re-arrangement: using C++17
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I. -I../inst/include/ -I../inst/tiledb/include -I../inst/tiledbsoma/include -I'/usr/lib/R/site-library/Rcpp/include' -I'/usr/lib/R/site-library/RcppSpdlog/include' -I'/usr/local/lib/R/site-library/RcppInt64/include' -fpic -g -O2 -ffile-prefix-map=/build/r-base-MHXHhT/r-base-4.3.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c RcppExports.cpp -o RcppExports.o
In file included from ../inst/tiledbsoma/include/tiledbsoma/utils/arrow_adapter.h:10,
from ../inst/tiledbsoma/include/tiledbsoma/tiledbsoma:45,
from ../inst/include/tiledbsoma_types.h:21,
from RcppExports.cpp:4:
../inst/tiledbsoma/include/tiledbsoma/utils/carrow.h:16:8: error: redefinition of ‘struct ArrowSchema’
16 | struct ArrowSchema {
| ^~~~~~~~~~~
In file included from ../inst/include/tiledbsoma_types.h:18,
from RcppExports.cpp:4:
./nanoarrow.h:83:8: note: previous definition of ‘struct ArrowSchema’
83 | struct ArrowSchema {
| ^~~~~~~~~~~
In file included from ../inst/tiledbsoma/include/tiledbsoma/utils/arrow_adapter.h:10,
from ../inst/tiledbsoma/include/tiledbsoma/tiledbsoma:45,
from ../inst/include/tiledbsoma_types.h:21,
from RcppExports.cpp:4:
../inst/tiledbsoma/include/tiledbsoma/utils/carrow.h:32:8: error: redefinition of ‘struct ArrowArray’
32 | struct ArrowArray {
| ^~~~~~~~~~
In file included from ../inst/include/tiledbsoma_types.h:18,
from RcppExports.cpp:4:
./nanoarrow.h:99:8: note: previous definition of ‘struct ArrowArray’
99 | struct ArrowArray {
| ^~~~~~~~~~
make: *** [/usr/lib/R/etc/Makeconf:200: RcppExports.o] Error 1
ERROR: compilation failed for package ‘tiledbsoma’
* removing ‘/tmp/RtmpPq5dYB/Rinst[192](https://github.com/single-cell-data/TileDB-SOMA/actions/runs/6746709009/job/18341227889?pr=1852#step:10:193)9110b964d/tiledbsoma’ Any chance we can keep changess local? The idea was less spill not more? |
Oh opps... I think that's happening because I removed these lines https://github.com/single-cell-data/TileDB-SOMA/pull/1852/files#diff-e419a62446641fa84b7b42a6ab37141a624cb49a0784add4f49823cd1abef3d5L7-L9. I didn't know what that macro was for or where it was being set, and my tests were passing without it so just kept the change in🤦🏻♀️ |
@nguyenv Per your last comment making that |
Codecov ReportAll modified and coverable lines are covered by tests ✅ ❗ Your organization needs to install the Codecov GitHub app to enable full functionality. see 40 files with indirect coverage changes 📢 Thoughts on this report? Let us know!. |
~ColumnBuffer() { | ||
LOG_TRACE(fmt::format("[ColumnBuffer] release '{}'", name_)); | ||
} | ||
~ColumnBuffer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? While trace
is super-voluminous it can be helpful to see that dtors have been reached.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because of fmt::format
. I've moved it into column_buffer.cc
, so we still do a get a log trace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot of changes here and my head is a little dizzy but I take your word for it that things will work with fmt
only in src/
and not the public interface. Thanks for cleaning this up.
A fix was applied upstream to libtiledbsoma, so this is no longer required. It also fixed the runtime error related to a missing symbol from `fmt` single-cell-data/TileDB-SOMA#1852
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release-1.5 release-1.5
# Navigate to the new working tree
cd .worktrees/backport-release-1.5
# Create a new branch
git switch --create backport-1852-to-release-1.5
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick --mainline 1 98d30c7380a47b3a2c597630293638c78d0fc7dd
# Push it to GitHub
git push --set-upstream origin backport-1852-to-release-1.5
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release-1.5 Then, create a pull request where the |
1 similar comment
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-release-1.5 release-1.5
# Navigate to the new working tree
cd .worktrees/backport-release-1.5
# Create a new branch
git switch --create backport-1852-to-release-1.5
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick --mainline 1 98d30c7380a47b3a2c597630293638c78d0fc7dd
# Push it to GitHub
git push --set-upstream origin backport-1852-to-release-1.5
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-release-1.5 Then, create a pull request where the |
* Keep logger.h internal; do not install * Restore conditional include of carrow.h --------- Co-authored-by: Dirk Eddelbuettel <[email protected]>
* Keep logger.h internal; do not install * Restore conditional include of carrow.h --------- Co-authored-by: nguyenv <[email protected]> Co-authored-by: Dirk Eddelbuettel <[email protected]>
Issue and/or context:
libtiledbsoma
still erroneously requiredspdlog
as a dependency due to exposinglogger.h
in the public API headers. This was reported in a channel internal to TileDB here.Changes:
logger.h
have been replaced bylogger_public.h
fmt
library is a part ofspdlog
which means it cannot be used or accessed except internallyfmt
in the public headers have now been moved into thecc
source code which may continue to use the internallogger.h
fmt
usage in templated functions, unit tests, andpytiledbsoma.cc
, string formatting has been refactored to use eitherstd::ostringstream
or basicstd::string
appending with+
for compatibility with C++17. In C++20, we can switch to usingstd::format
. TODO comments have been left in these areasNotes for Reviewer: