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

Fails to build from source with upcoming gcc-6 #47

Open
LocutusOfBorg opened this issue Jan 20, 2016 · 5 comments
Open

Fails to build from source with upcoming gcc-6 #47

LocutusOfBorg opened this issue Jan 20, 2016 · 5 comments

Comments

@LocutusOfBorg
Copy link

Hi, this is the error:

> [ 29%] Building CXX object CMakeFiles/cld2_full.dir/internal/cld_generated_cjk_delta_bi_32.cc.o
> /usr/bin/c++  -Dcld2_full_EXPORTS  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2  -fPIC  -o CMakeFiles/cld2_full.dir/internal/cld_generated_cjk_delta_bi_32.cc.o -c /<<PKGBUILDDIR>>/internal/cld_generated_cjk_delta_bi_32.cc
> /<<PKGBUILDDIR>>/internal/scoreonescriptspan.cc: In function 'void CLD2::ScoreEntireScriptSpan(const CLD2::LangSpan&, CLD2::ScoringContext*, CLD2::DocTote*, CLD2::ResultChunkVector*)':
> /<<PKGBUILDDIR>>/internal/scoreonescriptspan.cc:1149:5: warning: narrowing conversion of 'score' from 'int' to 'CLD2::uint16 {aka short unsigned int}' inside { } [-Wnarrowing]
>      };
>      ^
>
> /<<PKGBUILDDIR>>/internal/scoreonescriptspan.cc:1149:5: warning: narrowing conversion of 'bytes' from 'int' to 'CLD2::uint16 {aka short unsigned int}' inside { } [-Wnarrowing]
> /<<PKGBUILDDIR>>/internal/scoreonescriptspan.cc:1149:5: warning: narrowing conversion of 'reliability' from 'int' to 'CLD2::uint8 {aka unsigned char}' inside { } [-Wnarrowing]
[snip]
> /<<PKGBUILDDIR>>/internal/scoreonescriptspan.cc:1149:5: warning: narrowing conversion of 'reliability' from 'int' to 'CLD2::uint8 {aka unsigned char}' inside { } [-Wnarrowing]
> /<<PKGBUILDDIR>>/internal/cld_generated_cjk_uni_prop_80.cc:7089:1: error: narrowing conversion of '-14' from 'int' to 'CLD2::uint8 {aka unsigned char}' inside { } [-Wnarrowing]
[snip]
>  };
>  ^
>
conversion of '-30' from 'int' to 'CLD2::uint8 {aka unsigned char}' inside { } [-Wnarrowing]conversion of '-30' from 'int' to 'CLD2::uint8 {aka unsigned char}' inside { } [-Wnarrowing]

of course uint8 can't handle negative numbers, and if you change to int8 you can't handle numbers over 127.

How can I fix it?
thanks

@LocutusOfBorg
Copy link
Author

ping @CLD2 :)

@alc-privacore
Copy link

Setting std to c++98 works for me.

CPPFLAGS="-std=c++98" ./compile_libs.sh

@LocutusOfBorg
Copy link
Author

@alc-privacore while this might be good as a workaround, it doesn't change the fact that the code seems wrong anyway

@LocutusOfBorg
Copy link
Author

uploaded in Debian, with credits to you @alc-privacore :)

@LocutusOfBorg LocutusOfBorg reopened this Jun 29, 2016
@jmhodges jmhodges mentioned this issue Oct 23, 2016
jmhodges added a commit to jmhodges/cld2 that referenced this issue Oct 23, 2016
Use a bunch of static_cast<uint8> to get around the c++11-narrowing
errors when building as C++0x.

This hack is necessary because the source files and generation code has
not been released.

See CLD2Owners#33 on the source file
check-in.

See CLD2Owners#47
CLD2Owners#51
CLD2Owners#26 and I'm sure there are
others for the C++0x problem.
jmhodges added a commit to jmhodges/cld2 that referenced this issue Oct 23, 2016
hack up generated files to compile as c++0x

Use a bunch of static_cast<uint8> to get around the c++11-narrowing
errors when building as C++0x.
    
This hack is necessary because the source files and generation code has
not been released.
    
See CLD2Owners#33 on the source file
check-in.
    
See CLD2Owners#47
CLD2Owners#51
CLD2Owners#26 and I'm sure there are
others for the C++0x problem.
mjankowski referenced this issue in mastodon/mastodon May 6, 2017
* add failing en specs

* add cld2 gem

* Replace WhatLanguage with CLD
@pickfire
Copy link

pickfire commented Apr 4, 2019

This seems to fix the build issue in Arch Linux.

Hugmeir added a commit to Hugmeir/p5-Lingua-Identify-CLD2 that referenced this issue Nov 18, 2020
There is a long-standing isuse in cld2: CLD2Owners/cld2#47

It just fails to compile with newer C++ standards, so reliably
compiling it requires passing -std=c++98.
jjhoughton pushed a commit to jjhoughton/cld2 that referenced this issue Jul 9, 2022
Use a bunch of static_cast<uint8> to get around the c++11-narrowing
errors when building as C++0x.

This hack is necessary because the source files and generation code has
not been released.

See CLD2Owners#33 on the source file
check-in.

See CLD2Owners#47
CLD2Owners#51
CLD2Owners#26 and I'm sure there are
others for the C++0x problem.
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

3 participants