facebookresearch / fastText

Library for fast text representation and classification.
https://fasttext.cc/
MIT License
25.83k stars 4.71k forks source link

FTBFS with GCC 13 #1281

Open marxin opened 2 years ago

marxin commented 2 years ago

Fails with:

[   13s] c++ -pthread -std=c++11 -O3 -funroll-loops -DNDEBUG -c src/args.cc
[   13s] src/args.cc: In member function 'int64_t fasttext::Args::getAutotuneModelSize() const':
[   13s] src/args.cc:468:3: error: 'uint64_t' was not declared in this scope
[   13s]   468 |   uint64_t multiplier = 1;
[   13s]       |   ^~~~~~~~
[   13s] src/args.cc:17:1: note: 'uint64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
[   13s]    16 | #include <unordered_map>
[   13s]   +++ |+#include <cstdint>
[   13s]    17 | 
[   13s] src/args.cc:471:5: error: 'multiplier' was not declared in this scope
[   13s]   471 |     multiplier = units[lastCharacter];
[   13s]       |     ^~~~~~~~~~
[   13s] src/args.cc:474:11: error: expected ';' before 'size'
[   13s]   474 |   uint64_t size = 0;
[   13s]       |           ^~~~~
[   13s]       |           ;

due to: https://gcc.gnu.org/gcc-13/porting_to.html#header-dep-changes

marxin commented 1 year ago

May I please ping this?

CyberTailor commented 1 year ago

GCC 13 is now default in some distros

colonelwatch commented 1 year ago

GCC 13 is now default in some distros

Just encountered this on my Arch Linux distribution myself, and they had switched a week ago. Until this issue gets resolved, the workaround is to install GCC 12 (might be labelled as the gcc-12 or gcc12 package depending on the distro) and override the default compiler with env CC=gcc-12 <MAKE COMMAND>. With that, I was able to get fasttext Python package.

mid1221213 commented 6 months ago

The change in the PR (#1340) supposed to fix this "bug" is not correct (anymore?) : while compiling src/args.cc using make, I get: src/args.h:16:1: note: 'int64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?

This is probably because args.h is included before cstdint.

mid1221213 commented 6 months ago

Maybe better with the log of the commands used and their output, they are part of a Dockerfile build:

 > [ftbuild 3/5] RUN git clone https://github.com/facebookresearch/fastText.git /tmp/fastText &&   rm -rf /tmp/fastText/.git* &&   mv /tmp/fastText/* / &&   cd / &&   make:                                                                                                                          
0.184 Cloning into '/tmp/fastText'...                                                                                                                                                                                                                                                                 
1.368 c++ -pthread -std=c++17 -march=native -O3 -funroll-loops -DNDEBUG -c src/args.cc                                                                                                                                                                                                                
1.608 In file included from src/args.cc:9:                                                                                                                                                                                                                                                            
1.608 src/args.h:92:3: error: 'int64_t' does not name a type                                                                                                                                                                                                                                          
1.608    92 |   int64_t getAutotuneModelSize() const;
1.608       |   ^~~~~~~
1.608 src/args.h:16:1: note: 'int64_t' is defined in header '<cstdint>'; did you forget to '#include <cstdint>'?
1.608    15 | #include <vector>
1.608   +++ |+#include <cstdint>
1.608    16 | 
1.642 src/args.cc:456:9: error: no declaration matches 'int64_t fasttext::Args::getAutotuneModelSize() const'
1.642   456 | int64_t Args::getAutotuneModelSize() const {
1.642       |         ^~~~
1.642 src/args.cc:456:9: note: no functions named 'int64_t fasttext::Args::getAutotuneModelSize() const'
1.642 src/args.h:30:7: note: 'class fasttext::Args' defined here
1.642    30 | class Args {
1.642       |       ^~~~
1.688 make: *** [Makefile:30: args.o] Error 1