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

Can not build in Alpine linux #304

Open
javieriserte-at-calice opened this issue Sep 19, 2024 · 0 comments
Open

Can not build in Alpine linux #304

javieriserte-at-calice opened this issue Sep 19, 2024 · 0 comments

Comments

@javieriserte-at-calice
Copy link

javieriserte-at-calice commented Sep 19, 2024

I'm trying to install in Alpine linux 3.20 but it fails, trying to use fseeko64.

I think that fseeko64 is provided by glibc, but alpine uses Musl instead.

g++ -std=gnu++17 -I"/usr/include/R" -DNDEBUG  -I'/usr/lib/R/library/Rcpp/include' -I'/usr/lib/R/library/systemfonts/include'     -fpic  -O2 -fstack-clash-protection -Wformat -Werror=format-security -D_GLIBCXX_ASSERTIONS=1 -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS=1 -D_LIBCPP_ENABLE_HARDENED_MODE=1 -fno-plt -D__MUSL__   -c tinyxml2.cpp -o tinyxml2.o
tinyxml2.cpp: In member function 'tinyxml2::XMLError tinyxml2::XMLDocument::LoadFile(FILE*)':
tinyxml2.cpp:110:29: error: 'fseeko64' was not declared in this scope; did you mean 'fseeko'?
  110 |         #define TIXML_FSEEK fseeko64
      |                             ^~~~~~~~
tinyxml2.cpp:2335:5: note: in expansion of macro 'TIXML_FSEEK'
 2335 |     TIXML_FSEEK( fp, 0, SEEK_SET );
      |     ^~~~~~~~~~~
tinyxml2.cpp:111:29: error: 'ftello64' was not declared in this scope; did you mean 'ftello'?
  111 |         #define TIXML_FTELL ftello64
      |                             ^~~~~~~~
tinyxml2.cpp:2345:44: note: in expansion of macro 'TIXML_FTELL'
 2345 |         const long long fileLengthSigned = TIXML_FTELL( fp );
      |                                            ^~~~~~~~~~~
make: *** [/usr/lib/R/etc/Makeconf:204: tinyxml2.o] Error 1
ERROR: compilation failed for package ‘ggiraph’

Changing fseeko64 to fseeko in src/tinyxml2.cpp allows to compile in Alpine.

Maybe this can fix it:

    #if defined(__GLIBC__)  // Use fseeko64 if glibc is present
        #define TIXML_FSEEK fseeko64
        #define TIXML_FTELL ftello64
    #else  // If using musl (like Alpine Linux), fall back to fseeko/ftello
        #define TIXML_FSEEK fseeko
        #define TIXML_FTELL ftello
    #endif
    
    #Chatgpt generated by the way
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

No branches or pull requests

1 participant