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

Error when compiling (Ubuntu 24.04) #2

Open
pat-s opened this issue Sep 15, 2024 · 4 comments
Open

Error when compiling (Ubuntu 24.04) #2

pat-s opened this issue Sep 15, 2024 · 4 comments

Comments

@pat-s
Copy link

pat-s commented Sep 15, 2024

Any idea?

using C++ compiler: 'g++ (Ubuntu 13.2.0-23ubuntu4) 13.2.0'
using C++17
ccache gcc -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -I./gdx/src -Igdx/src/rtl -I. -I'/opt/R/4.4.1/lib/R/library/Rcpp/include' -I/usr/local/include    -fPIC  -g -O2  -flax-vector-conversions -c gdx/src/rtl/dtoaLoc.c -o gdx/src/rtl/dtoaLoc.o
ccache g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -I./gdx/src -Igdx/src/rtl -I. -I'/opt/R/4.4.1/lib/R/library/Rcpp/include' -I/usr/local/include   -DNDEBUG -fPIC  -g -O2   -c gdx/src/rtl/p3io.cpp -o gdx/src/rtl/p3io.o
ccache g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -I./gdx/src -Igdx/src/rtl -I. -I'/opt/R/4.4.1/lib/R/library/Rcpp/include' -I/usr/local/include   -DNDEBUG -fPIC  -g -O2   -c gdx/src/rtl/p3utils.cpp -o gdx/src/rtl/p3utils.o
ccache g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -I./gdx/src -Igdx/src/rtl -I. -I'/opt/R/4.4.1/lib/R/library/Rcpp/include' -I/usr/local/include   -DNDEBUG -fPIC  -g -O2   -c gdx/src/rtl/sysutils_p3.cpp -o gdx/src/rtl/sysutils_p3.o
ccache g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -I./gdx/src -Igdx/src/rtl -I. -I'/opt/R/4.4.1/lib/R/library/Rcpp/include' -I/usr/local/include   -DNDEBUG -fPIC  -g -O2   -c gdx/src/rtl/p3platform.cpp -o gdx/src/rtl/p3platform.o
ccache g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -I./gdx/src -Igdx/src/rtl -I. -I'/opt/R/4.4.1/lib/R/library/Rcpp/include' -I/usr/local/include   -DNDEBUG -fPIC  -g -O2   -c gdx/src/rtl/math_p3.cpp -o gdx/src/rtl/math_p3.o
ccache g++ -std=gnu++17 -I"/opt/R/4.4.1/lib/R/include" -DNDEBUG -I./gdx/src -Igdx/src/rtl -I. -I'/opt/R/4.4.1/lib/R/library/Rcpp/include' -I/usr/local/include   -DNDEBUG -fPIC  -g -O2   -c gdx/src/gdlib/gmsstrm.cpp -o gdx/src/gdlib/gmsstrm.o
gdx/src/gdlib/gmsstrm.cpp:85:70: error: narrowing conversion of '-1' from 'std::char_traits<char>::int_type' {aka 'int'} to 'char' [-Wnarrowing]
   85 | constexpr static char substChar {/*0x1A*/ std::char_traits<char>::eof()};
      |                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
make: *** [/opt/R/4.4.1/lib/R/etc/Makeconf:204: gdx/src/gdlib/gmsstrm.o] Error 1
@0x17
Copy link
Member

0x17 commented Sep 16, 2024

Thanks for reporting. You compile on an ARM CPU? Anyways, I can't thoroughly investigate right now. As a quick fix I would recommend assigning 255 or 0xFF to "substChar" to make the build pass. I will take a closer look on Wednesday and see if our code should be modified for machines where char is unsigned by default.

@pat-s
Copy link
Author

pat-s commented Sep 16, 2024

You compile on an ARM CPU?

Yes, sorry for missing that initially.

As a quick fix I would recommend assigning 255 or 0xFF to "substChar" to make the build pass.

I am building binaries from CRAN sources, so making local modifications is not an option. Not urgent, but would be great to resolve this error in the build chain :)

@0x17
Copy link
Member

0x17 commented Sep 16, 2024

Thank you for confirming the platform. I will look into getting the reported compilation failure resolved with the next GDX release. It might take a couple days as I am afk until Wednesday but @abhosekar and I should be able to quickly deploy afterwards.

Thank you for reporting again. I will also comb the rest of GDX (and other projects I maintain) for usages of char that were assuming it to always be signed and test compile with GCC on arm, to make sure you won't get another follow up error.

I am not 100% sure why this didn't show up before on the arm64 macOS builds we do with AppleClang. Something else to look into. 😀

@pat-s
Copy link
Author

pat-s commented Sep 16, 2024

I am not 100% sure why this didn't show up before on the arm64 macOS builds we do with AppleClang. Something else to look into. 😀

arm64 macOS uses clang instead of gcc and both operate differently in some ways, the reported cased being one of them.

Thanks for fixing it!

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

2 participants