OpenSC / OpenSC

Open source smart card tools and middleware. PKCS#11/MiniDriver/Tokend
https://github.com/OpenSC/OpenSC/wiki
GNU Lesser General Public License v2.1
2.55k stars 733 forks source link

Compilation error #3134

Closed connermemory closed 5 months ago

connermemory commented 5 months ago

I encountered an issue while compiling on Ubuntu 16.04, and I looked up previous issues. This issue has solved this problem, but I don't know why it has been restored now. The gcc version I am using is 5.4.0.

reader-pcsc.c: In function ‘detect_reader_features’:
reader-pcsc.c:1229:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
     PIN_PROPERTIES_STRUCTURE_v5 *caps = (PIN_PROPERTIES_STRUCTURE_v5 *) &buf;
     ^
reader-pcsc.c:1238:5: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
     PIN_PROPERTIES_STRUCTURE *caps = (PIN_PROPERTIES_STRUCTURE *) buf;
     ^
cc1: all warnings being treated as errors
frankmorgner commented 5 months ago

16.04 is not supported any longer. could it be that you're using an outdated version of OpenSC as well?

Jakuje commented 5 months ago

This was indeed fixed in #2241 but got back with a06abbf5a767a97a9627d5f786dd0d404c6cb8a0 (from #2513) addressing some coverity concerns.

I would say that this old ubuntu is certainly unsupported, the same for the old gcc version. Given that this code works ok with all the current compilers, I would say this is really an gcc bug, which can be ignored by setting some compiler switches on your side, but there is really nothing we could do with it on our side.

connermemory commented 5 months ago

Okay, thank you. I changed to Ubuntu 22.04 and it can be successfully compiled.