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 compiling gamedevframework on ArchLinux ARM with gcc-6.1.1 glibc-2.23-5 #4

Closed
Popolon opened this issue Aug 16, 2016 · 6 comments
Labels

Comments

@Popolon
Copy link

Popolon commented Aug 16, 2016

I'm not sure about the part of the system that could be related to this issue ?

The system uses

  • gcc 6.1.1
  • glibc 2.23-5

[alarm@alarm build]$ make
[ 0%] Building CXX object library/CMakeFiles/gf0.dir/Range.cc.o
/home/alarm/misc/gf/library/Range.cc:31:19: error: duplicate explicit instantiation of 'struct gf::v1::Range' [-fpermissive]
template struct Rangestd::size_t;
^~~~~~~~~~~~~~~~~~
make[2]: *** [library/CMakeFiles/gf0.dir/build.make:327: library/CMakeFiles/gf0.dir/Range.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:118: library/CMakeFiles/gf0.dir/all] Error 2
make: *** [Makefile:128: all] Error 2

@jube
Copy link
Member

jube commented Aug 16, 2016

I think size_t is the same as unsigned on this architecture. Not easy to fix.

@Popolon
Copy link
Author

Popolon commented Aug 16, 2016

Is there a test that I can made to confirm this ? I use ARMv7 (32 bits), I know that for example, default float format is float not double in QT tool-kit on this platform, and double on x86 and ARMv8 (64 bits).

This can be tested like with this on linux, for both ARM 32bit (v5/v6/v7 I suppose) and ARM 64bit (found in libjpeg-turbo), probably a test for each case is better here. I could at least provide some test/debug on ARMv7, and very probably soon on ARMv8

#if defined GNUC && (defined arm || defined aarch64)

There is some explanation about difference in types on both platforms here:
http://malideveloper.arm.com/downloads/ARMv8_64_bit_migration.pdf

@jube
Copy link
Member

jube commented Aug 16, 2016

You can try to compile something like:

#include <iostream>
#include <type_traits>

int main() {
  std::cout << std::boolalpha;
  std::cout << std::is_same<unsigned, std::size_t>::value << '\n';
  return 0;
}

Compile with gcc -std=c++11 file.cc. If it prints true, then it's the same type.

I see two possible solutions for this bug:

  • easy: remove the explicit instantiation for std::size_t (same for Vector, Rect, etc)
  • difficult: make a check at build time with CheckTypeSize

I do not really like the preprocessor condition based on architecture because this error may happen on other architectures.

@Popolon
Copy link
Author

Popolon commented Aug 16, 2016

Answered true. So that's the problem :(.

I didn't coded in C++ since long time and discover lot of evolutions since last time.

@Popolon
Copy link
Author

Popolon commented Aug 16, 2016

gcc -o test_validation2 -std=c++11 -lstdc++ test_validation.cpp
I needed to type this to compile it, using or not -std=c++11 give the same result.

@jube
Copy link
Member

jube commented Aug 17, 2016

OK. So I will remove the explicit instantiations with std::size_t. Anyway, they are not used in the library. Will come in the next push.

@jube jube closed this as completed Aug 17, 2016
@jube jube added the bug label Aug 17, 2016
jube added a commit that referenced this issue Aug 17, 2016
the problem is with architectures where std::size_t is the same as unsigned, there is a duplicate explicit instantiation that prevents the files to compile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants