Cc1plus все предупреждения считаются ошибками

Компилирую вот по этому ману.
Вылетает такая ошибка:

[ 25%] Building CXX object libsolidity/CMakeFiles/solidity.dir/codegen/CompilerUtils.cpp.o
/home/dar/solidity/libsolidity/codegen/CompilerUtils.cpp: В функции-члене «void dev::solidity::CompilerUtils::convertType(const dev::solidity::Type&, const dev::solidity::Type&, bool, bool, bool)»:
/home/dar/solidity/libsolidity/codegen/CompilerUtils.cpp:788:3: ошибка: this statement may fall through [-Werror=implicit-fallthrough=]
   }
   ^
/home/dar/solidity/libsolidity/codegen/CompilerUtils.cpp:790:2: замечание: here
  default:
  ^~~~~~~
cc1plus: все предупреждения считаются ошибками
make[2]: *** [libsolidity/CMakeFiles/solidity.dir/build.make:543: libsolidity/CMakeFiles/solidity.dir/codegen/CompilerUtils.cpp.o] Ошибка 1
make[1]: *** [CMakeFiles/Makefile2:275: libsolidity/CMakeFiles/solidity.dir/all] Ошибка 2
make: *** [Makefile:130: all] Ошибка 2

Что могло пойти не так?

retorta's user avatar

retorta

2,60812 серебряных знаков20 бронзовых знаков

задан 28 июн 2017 в 13:16

dar's user avatar

3

Скорее всего, у вас включён флаг -Werror. Его можно отключить целиком (найти поиском в CMakeList), или отключить конкретную проверку, добавив -Wno-error=implicit-fallthrough к флагам компиляции. Ну или можно подправить исходники, чтобы для каждого case был свой break.

Кроме того, если я правильно понял, это только на gcc-7 работает, разработчики добавили флаг в основном в связи с добавлением в C++17 атрибута [[fallthrough]]. Из-за этого добавление -Wno-error=implicit-fallthrough приведет к сбою для более старых версий gcc.

ответ дан 28 июн 2017 в 21:11

Ariox's user avatar

ArioxAriox

2,9801 золотой знак7 серебряных знаков8 бронзовых знаков

Проблема в том, что тот же код, который хорошо компилируется в Windows, не может скомпилироваться на Ubuntu. Каждый раз, когда я получаю эту ошибку:

cc1: warnings being treated as errors

Теперь это большая база кода, и мне не нравятся исправления всех предупреждений.

Можно ли успешно скомпилировать, несмотря на предупреждения?

4b9b3361

Ответ 1

Спасибо за все полезные предложения. Наконец, я убедился, что в моем коде нет предупреждений, но снова получил это предупреждение от sqlite3:

Assuming signed overflow does not occur when assuming that (X - c) <= X is always true

который я исправил добавлением следующего CFLAG:

-fno-strict-overflow

Ответ 2

Конечно, найдите, где -Werror установлен и удалите этот флаг. Тогда предупреждения будут только предупреждениями.

Ответ 3

Вы можете сделать все предупреждения обработаны как таковые, используя -Wno-error. Вы можете сделать конкретные предупреждения как таковые, используя -Wno-error=<warning name>, где <warning name> — это имя предупреждения, которое вы не хотите рассматривать как ошибку.

Если вы хотите полностью отключить все предупреждения, используйте -w (не рекомендуется).


Источник: http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Warning-Options.html

Ответ 4

Если вы компилируете ядро ​​Linux. Например, если вы хотите отключить предупреждение, которое является «unused-but-set-variable», оно рассматривается как ошибка. Вы можете добавить выражение:

KBUILD_CFLAGS += $(call cc-option,-Wno-error=unused-but-set-variable,)

в файле Makefile

Ответ 5

-Wall и -Werror параметры компилятора могут вызвать его, проверьте, используются ли они в настройках компилятора.

Ответ 6

Удалите -Werror из ваших файлов Make или CMake, как предложено в этом сообщении

In system:
Fedora 21
Ruby 2.1.7
GCC 4.9.2

I follow the instructions for installing simstring but afer

$ruby extconf.rb

when trying to make and make install, I got an error:

cc1plus: some warnings being treated as errors
Makefile:217: recipe for target 'export_wrap.o' failed
make: *** [export_wrap.o] Error 1

And the entire log of this error is bellow

Error Log

I searched about this error but all of replies are about how to disable Werrors and configure with ignoring werrors.
Is there any solution?I think something not mentioned but i don’t know what..

asked May 6, 2016 at 12:31

Ali mahdi's user avatar

Ответ 1

Спасибо за все полезные предложения. Наконец, я убедился, что в моем коде нет предупреждений, но снова получил это предупреждение от sqlite3:

Assuming signed overflow does not occur when assuming that (X - c) <= X is always true

который я исправил добавлением следующего CFLAG:

-fno-strict-overflow

Ответ 2

Конечно, найдите, где -Werror установлен и удалите этот флаг. Тогда предупреждения будут только предупреждениями.

Ответ 3

Вы можете сделать все предупреждения обработаны как таковые, используя -Wno-error. Вы можете сделать конкретные предупреждения как таковые, используя -Wno-error=<warning name>, где <warning name> — это имя предупреждения, которое вы не хотите рассматривать как ошибку.

Если вы хотите полностью отключить все предупреждения, используйте -w (не рекомендуется).


Источник: http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gcc/Warning-Options.html

Ответ 4

Если вы компилируете ядро ​​Linux. Например, если вы хотите отключить предупреждение, которое является «unused-but-set-variable», оно рассматривается как ошибка. Вы можете добавить выражение:

KBUILD_CFLAGS += $(call cc-option,-Wno-error=unused-but-set-variable,)

в файле Makefile

Ответ 5

-Wall и -Werror параметры компилятора могут вызвать его, проверьте, используются ли они в настройках компилятора.

Ответ 6

Удалите -Werror из ваших файлов Make или CMake, как предложено в этом сообщении

In system:
Fedora 21
Ruby 2.1.7
GCC 4.9.2

I follow the instructions for installing simstring but afer

$ruby extconf.rb

when trying to make and make install, I got an error:

cc1plus: some warnings being treated as errors
Makefile:217: recipe for target 'export_wrap.o' failed
make: *** [export_wrap.o] Error 1

And the entire log of this error is bellow

Error Log

I searched about this error but all of replies are about how to disable Werrors and configure with ignoring werrors.
Is there any solution?I think something not mentioned but i don’t know what..

asked May 6, 2016 at 12:31

Ali mahdi's user avatar

2

I searched about this error

That’s not an error. It’s a notification. It notifies that some warnings have been treated as errors.

I searched about this error but all of replies are about how to disable Werrors and configure with ignoring werrors. Is there any solution?

You answered your own question. If the source code of the program generates warnings, and if the compiler is asked to treat warnings as errors, then the compiler will refuse to compile the program. Complete list of possible solutions are:

  • Fix the source code to not generate warnings. This is a very good idea.
  • Stop asking the compiler to treat warnings as errors (this is the solution that you already found). You should still fix the code to not generate a warning.
  • Ask the compiler to ignore the warnings entirely. This is usually a bad idea unless you understand the warning and know what you’re doing.

answered May 6, 2016 at 12:52

eerorika's user avatar

eerorikaeerorika

231k12 gold badges195 silver badges321 bronze badges

1

If you are compiling some C program or open source package using Makefile which is written by someone else, there are chances you may encounter error as “cc1: all warnings being treated as errors” and you will not be able to compile the program or package.

So this error, tells us that there are some “warnings” in the program and those are getting considered as “errors” forcing you to fist fix those errors to proceed with the compilation, so there are following ways to proceed,

1. Its always better to resolve those errors if you have time.
2. If you dont have time, and can ignore “warnings” for a while, just search the code as,

 grep -r Werror * 

to identify which Makefile is enabling “Werror”
3. remove/delete this completely from that Makefile or Change it to “-wno-error”
4. save this makefile and recompile the code. This will show the warnings but will not stop compilation reporting those as errors.

Now, let me show how this works with the simple program.

Create a helloworld.c as below,

#include <stdio.h>

int main(int argc, char **argv) {
        void *p;
        printf("Hello Worldn");
        p = 10;
        return 0;
}

Above program purposefully creates a warning in which we are trying to set integer number to void pointer.
Now, lets try to compile this program as it is,

$ gcc helloworld.c
helloworld.c: In function ‘main’:
helloworld.c:6:4: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  p = 10;
    ^

This actually went ahead to create a.out by showing one warning as above. But in case of big programs, we dont know how many actual warnings will be,
hence we will enable “show all warnings” macro “-Wall” during command line,

 $ gcc helloworld.c -Wall
helloworld.c: In function ‘main’:
helloworld.c:6:4: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  p = 10;
    ^
helloworld.c:4:8: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
  void *p;
        ^

Now, lets force all those warnings as errors, so someone should not be able to create executable without resolving this errors,

$ gcc helloworld.c -Wall -Werror
helloworld.c: In function ‘main’:
helloworld.c:6:4: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
  p = 10;
    ^
helloworld.c:4:8: error: variable ‘p’ set but not used [-Werror=unused-but-set-variable]
  void *p;
        ^
cc1: all warnings being treated as errors

And now the ultimate workaround to temporarily proceed with creating executable without resolving these error, if you just need to get it compiled somehow since your boss has asked to get it done asap. 🙂

$ gcc -o helloworld helloworld.c -Wall -Wno-error 
helloworld.c: In function ‘main’:
helloworld.c:6:4: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  p = 10;
    ^
helloworld.c:4:8: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
  void *p;
        ^

And this is how it will create the executable without resolving this warnings.

$ ls
helloworld  helloworld.c

Same things can be done in Makefiles by passing CFLAGS=-Wno-error & CFLAGS=-Werror

System information
-PaddlePaddle version: Latest Develop branch
-CPU: MKLDNN, CLX
-GPU: Irrelevant/not used
-OS Platform: Ubuntu 18.04
-Python version: 2.7.12
-Install method: building from source, gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
To Reproduce
Steps to reproduce the behavior:
cmake .. -DCMAKE_BUILD_TYPE=Release -DWITH_GPU=OFF -DWITH_MKLDNN=ON -DWITH_TESTING=ON -DWITH_PROFILER=ON -DWITH_STYLE_CHECK=OFF -DON_INFER=ON -DWITH_INFERENCE_API_TEST=ON
Describe your current behavior
During make:
cc1plus: all warnings being treated as errors
(…)
Makefile:138: recipe for target ‘all’ failed
make: *** [all] Error 2
Other info / logs
make -j 20
[ 0%] Built target extern_pybind
[ 0%] Built target extern_warpctc
[ 0%] Built target extern_gflags
[ 0%] Built target extern_dlpack
[ 0%] Built target extern_xbyak
[ 0%] Built target extern_zlib
[ 0%] Built target extern_inference_download_pascalvoc_small_tar_gz
[ 1%] Built target extern_eigen3
[ 1%] Built target extern_boost
[ 1%] Built target extern_inference_download_bert_data_len20_txt_tar_gz
[ 1%] Built target extern_inference_download_pascalvoc_val_head_300_tar_gz
[ 1%] Built target extern_inference_download_word2vec_inference_model_tar_gz
[ 1%] Built target framework_py_proto_init
[ 2%] Built target extern_xxhash
[ 2%] Built target extern_threadpool
[ 2%] Built target extern_inference_download_ResNet50_qat_perf_int8_tar_gz
[ 2%] Built target extern_mklml
[ 2%] Built target extern_inference_download_Res101_int8_model_tar_gz
[ 2%] Built target profiler_py_proto_init
[ 2%] Built target extern_inference_download_GoogleNet_int8_model_tar_gz
[ 2%] Built target extern_inference_download_resnet50_int8_model_tar_gz
[ 2%] Built target extern_inference_download_temp_2Ftransformer_data_txt_tar_gz
[ 2%] Built target extern_inference_download_mobilenet_v2_int8_model_tar_gz
[ 2%] Built target extern_inference_download_lac_data_txt_tar_gz
[ 2%] Built target extern_inference_download_chinese_ner_model_tar_gz
[ 2%] Built target extern_inference_download_dam_small_data_txt_tar_gz
[ 2%] Built target extern_inference_download_dam_small_model_tar_gz
[ 3%] Built target extern_inference_download_Ernie_result_txt_tar_gz
[ 3%] Built target extern_inference_download_chinese_ner_data_txt_tar_gz
[ 3%] Built target extern_inference_download_lac_model_tar_gz
[ 3%] Built target extern_inference_download_rnn1_2Fmodel_tar_gz
[ 3%] Built target extern_inference_download_rnn1_2Fdata_txt_tar_gz
[ 3%] Built target extern_inference_download_PyramidDNN_model_tar_gz
[ 3%] Built target extern_inference_download_Ernie_model_tar_gz
[ 3%] Built target extern_inference_download_VGG16_int8_model_tar_gz
[ 3%] Built target extern_inference_download_seq_pool1_data_txt_tar_gz
[ 3%] Built target extern_inference_download_DAM_data_txt_tar_gz
[ 3%] Built target extern_inference_download_rnn2_model_tar_gz
[ 3%] Built target extern_inference_download_DAM_model_tar_gz
[ 3%] Built target extern_inference_download_PyramidDNN_data_txt_tar_gz
[ 3%] Built target extern_inference_download_rnn2_data_txt_tar_gz
[ 3%] Built target extern_inference_download_temp_2Ftransformer_model_tar_gz
[ 4%] Built target extern_inference_download_resnet50_model_tar_gz
[ 6%] Built target extern_inference_download_text_classification_Senta_tar_gz
[ 6%] Built target extern_inference_download_Ernie_data_txt_tar_gz
[ 7%] Built target extern_inference_download_seq_conv1_data_txt_tar_gz
[ 7%] Built target extern_inference_download_inference_vis_demos_2Focr_tar_gz
[ 7%] Built target extern_inference_download_mobilenetv1_int8_model_tar_gz
[ 7%] Built target extern_inference_download_seq_pool1_model__tar_gz
[ 7%] Built target extern_inference_download_seq_conv1_model_tar_gz
[ 7%] Built target extern_inference_download_bert_emb128_model_tar_gz
[ 8%] Built target extern_inference_download_inference_vis_demos_2Fmobilenet_tar_gz
[ 8%] Built target extern_inference_download_text_classification_data_txt_tar_gz
[ 9%] Built target extern_inference_download_mobilenet_ssd_int8_model_tar_gz
[ 9%] Built target extern_inference_download_googlenet_tar_gz
[ 9%] Built target extern_inference_download_ResNet50_qat_perf_tar_gz
[ 9%] Built target extern_inference_download_mobilenet_model_tar_gz
[ 9%] Built target extern_inference_download_VGG19_int8_model_tar_gz
[ 9%] Built target extern_inference_download_imagenet_val_100_tail_tar_gz
[ 10%] Built target extern_inference_download_MobileNetV1_qat_model_tar_gz
[ 10%] Built target extern_inference_download_ResNet50_qat_model_tar_gz
[ 10%] Built target extern_inference_download_MobileNetV2_qat_model_tar_gz
[ 11%] Built target extern_inference_download_VGG16_qat_model_tar_gz
[ 12%] Built target extern_inference_download_ResNet101_qat_model_tar_gz
[ 12%] Built target extern_inference_download_VGG19_qat_model_tar_gz
[ 12%] Built target extern_inference_download_GoogleNet_qat_model_tar_gz
[ 12%] Built target extern_inference_download_MobileNet_qat_perf_tar_gz
[ 13%] Built target extern_glog
[ 13%] Built target extern_protobuf
[ 13%] Built target extern_gtest
[ 13%] Built target flags
[ 13%] Built target extern_mkldnn
Copy generated python proto into directory paddle/fluid/proto/profiler.
Copy generated python proto into directory paddle/fluid/proto.
[ 13%] Built target framework_proto
[ 13%] Built target version
[ 13%] Built target error_codes_proto
[ 13%] Built target timer
[ 13%] Built target imperative_flag
[ 13%] Built target data_feed_proto
[ 13%] Built target boost
[ 13%] Built target activation_functions
[ 13%] Built target paddle_pass_builder
[ 13%] Built target imperative_profiler
[ 13%] Built target trainer_py_proto
[ 14%] Built target zero_copy_tensor_dummy
[ 14%] Built target stringpiece
[ 14%] Built target pretty_log
[ 14%] Built target profiler_py_proto
[ 14%] Built target framework_py_proto
[ 15%] Built target mkldnn
[ 15%] Built target third_party
[ 15%] Built target profiler_proto
[ 16%] Built target cudnn_workspace_helper
[ 16%] Built target trainer_desc_proto
[ 16%] Built target errors
[ 16%] Built target string_helper
[ 16%] Built target attribute
[ 16%] Built target prune
[ 16%] Built target enforce
[ 16%] Built target device_tracer
[ 16%] Built target fs
[ 16%] Built target shell
[ 16%] Built target cpu_info
[ 16%] Built target dynamic_loader
[ 16%] Built target op_proto_maker
[ 16%] Built target ddim
[ 16%] Built target threadpool
[ 16%] Built target benchmark
[ 16%] Built target place
[ 16%] Built target profiler
[ 16%] Built target dynload_mklml
[ 16%] Built target dynload_warpctc
[ 16%] Built target memory_block
[ 16%] Built target op_call_stack
[ 16%] Built target system_allocator
[ 16%] Built target memcpy
[ 16%] Built target allocator
[ 16%] Built target device_memory_aligment
[ 16%] Built target cblas
[ 17%] Built target buddy_allocator
[ 17%] Built target cpu_helper
[ 17%] Built target aligned_allocator
[ 17%] Built target retry_allocator
[ 17%] Built target locked_allocator
[ 17%] Built target cpu_allocator
[ 17%] Built target buffered_allocator
[ 17%] Built target best_fit_allocator
[ 17%] Built target naive_best_fit_allocator
[ 17%] Built target jit_kernel_base
[ 17%] Built target auto_growth_best_fit_allocator
[ 17%] Built target allocator_strategy
[ 17%] Built target jit_kernel_refer
[ 18%] Built target jit_kernel_mix
[ 18%] Built target jit_kernel_mkl
[ 18%] Built target jit_kernel_intrinsic
[ 18%] Built target allocator_facade
[ 18%] Built target jit_kernel_jitcode
[ 18%] Built target malloc
[ 18%] Built target jit_kernel_helper
[ 18%] Built target memory
[ 18%] Built target mask_util
[ 18%] Built target device_context
[ 18%] Built target sampler
[ 18%] Built target data_type
[ 18%] Built target garbage_collector
[ 18%] Built target blas
[ 18%] Built target op_kernel_type
[ 18%] Built target device_code
[ 18%] Built target vol2col
[ 19%] Built target no_need_buffer_vars_inference
[ 19%] Built target shape_inference
[ 19%] Built target lstm_compute
[ 19%] Built target sample_prob
[ 19%] Built target unpooling
[ 19%] Built target pooling
[ 20%] Built target concat_and_split
[ 20%] Built target maxouting
[ 20%] Built target im2col
[ 20%] Built target cross_entropy
[ 20%] Built target nccl_context
[ 20%] Built target sequence_scale
[ 20%] Built target sequence_padding
[ 20%] Built target sequence2batch
[ 20%] Built target cos_sim_functor
[ 20%] Built target paddle_gtest_main
[ 20%] Built target op_info
[ 20%] Built target matrix_bit_code
[ 20%] Built target math_function
[ 20%] Built target fc
[ 21%] Built target unused_var_check
[ 21%] Built target tensor
[ 21%] Built target selected_rows
[ 21%] Built target dlpack_tensor
[ 21%] Built target data_device_transform
[ 22%] Built target lod_tensor
[ 22%] Built target data_type_transform
[ 22%] Built target jit_kernel_benchmark
[ 22%] Built target mkldnn_quantizer_config
[ 22%] Built target buddy_allocator_test
[ 23%] Built target system_allocator_test
[ 23%] Built target buffered_allocator_test
[ 23%] Built target reader
[ 23%] Building CXX object paddle/fluid/memory/allocation/CMakeFiles/test_aligned_allocator.dir/test_aligned_allocator.cc.o
[ 23%] Built target variable_visitor
[ 23%] Built target var_type_traits
[ 23%] Built target variable_helper
[ 23%] Built target lod_rank_table
Scanning dependencies of target softmax
[ 23%] Building CXX object paddle/fluid/memory/allocation/CMakeFiles/best_fit_allocator_test.dir/best_fit_allocator_test.cc.o
[ 23%] Built target box_wrapper
[ 23%] Built target auto_growth_best_fit_allocator_facade_test
Scanning dependencies of target beam_search
[ 23%] Built target retry_allocator_test
Scanning dependencies of target tree2col
Scanning dependencies of target gru_compute
Scanning dependencies of target context_project
[ 23%] Building CXX object paddle/fluid/platform/CMakeFiles/enforce_test.dir/enforce_test.cc.o
Scanning dependencies of target sequence_pooling
Scanning dependencies of target data_layout_transform
[ 23%] Built target cpu_helper_test
[ 23%] Built target allocator_facade_abs_flags_test
[ 23%] Built target allocator_facade_frac_flags_test
Scanning dependencies of target errors_test
[ 23%] Building CXX object paddle/fluid/operators/math/CMakeFiles/softmax.dir/softmax.cc.o
[ 23%] Built target profiler_test
Scanning dependencies of target cpu_info_test
[ 23%] Building CXX object paddle/fluid/operators/math/CMakeFiles/beam_search.dir/beam_search.cc.o
[ 23%] Building CXX object paddle/fluid/platform/CMakeFiles/errors_test.dir/errors_test.cc.o
[ 23%] Building CXX object paddle/fluid/operators/math/CMakeFiles/tree2col.dir/tree2col.cc.o
[ 23%] Building CXX object paddle/fluid/platform/CMakeFiles/cpu_info_test.dir/cpu_info_test.cc.o
[ 23%] Building CXX object paddle/fluid/operators/math/CMakeFiles/gru_compute.dir/gru_compute.cc.o
[ 23%] Built target float16_test
[ 23%] Building CXX object paddle/fluid/operators/math/CMakeFiles/sequence_pooling.dir/sequence_pooling.cc.o
[ 23%] Building CXX object paddle/fluid/operators/math/CMakeFiles/context_project.dir/context_project.cc.o
[ 23%] Building CXX object paddle/fluid/framework/CMakeFiles/data_layout_transform.dir/data_layout_transform.cc.o
Scanning dependencies of target timer_test
Scanning dependencies of target cow_ptr_tests
Scanning dependencies of target selected_rows_functor
Scanning dependencies of target rw_lock_test
Scanning dependencies of target inlined_vector_test
[ 23%] Building CXX object paddle/fluid/platform/CMakeFiles/timer_test.dir/timer_test.cc.o
[ 23%] Building CXX object paddle/fluid/framework/CMakeFiles/cow_ptr_tests.dir/details/cow_ptr_test.cc.o
[ 23%] Building CXX object paddle/fluid/framework/CMakeFiles/rw_lock_test.dir/rw_lock_test.cc.o
Scanning dependencies of target place_test
[ 23%] Building CXX object paddle/fluid/framework/CMakeFiles/inlined_vector_test.dir/inlined_vector_test.cc.o
[ 23%] Building CXX object paddle/fluid/operators/math/CMakeFiles/selected_rows_functor.dir/selected_rows_functor.cc.o
[ 23%] Building CXX object paddle/fluid/platform/CMakeFiles/place_test.dir/place_test.cc.o
Scanning dependencies of target init_test
Scanning dependencies of target op_kernel_type_test
[ 23%] Building CXX object paddle/fluid/platform/CMakeFiles/init_test.dir/init_test.cc.o
[ 23%] Building CXX object paddle/fluid/framework/CMakeFiles/op_kernel_type_test.dir/op_kernel_type_test.cc.o
[ 23%] Linking CXX executable timer_test
[ 23%] Linking CXX executable cpu_info_test
[ 23%] Linking CXX executable cow_ptr_tests
[ 23%] Built target timer_test
Scanning dependencies of target threadpool_test
[ 23%] Building CXX object paddle/fluid/framework/CMakeFiles/threadpool_test.dir/threadpool_test.cc.o
[ 23%] Built target cpu_info_test
Scanning dependencies of target op_proto_maker_test
[ 23%] Building CXX object paddle/fluid/framework/CMakeFiles/op_proto_maker_test.dir/op_proto_maker_test.cc.o
[ 23%] Built target cow_ptr_tests
[ 23%] Linking CXX executable inlined_vector_test
Scanning dependencies of target copy_same_tensor_test
[ 23%] Building CXX object paddle/fluid/framework/CMakeFiles/copy_same_tensor_test.dir/copy_same_tensor_test.cc.o
[ 23%] Built target inlined_vector_test
In file included from /repos/paddle_paddle/paddle/fluid/memory/allocation/test_aligned_allocator.cc:15:0:
/repos/paddle_paddle/build/third_party/install/gtest/include/gtest/gtest.h: In instantiation of ‘testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int]’:
/repos/paddle_paddle/build/third_party/install/gtest/include/gtest/gtest.h:1472:23: required from ‘static testing::AssertionResult testing::internal::EqHelper<lhs_is_null_literal>::Compare(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int; bool lhs_is_null_literal = false]’
/repos/paddle_paddle/paddle/fluid/memory/allocation/test_aligned_allocator.cc:23:266: required from here
/repos/paddle_paddle/build/third_party/install/gtest/include/gtest/gtest.h:1444:11: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
​if (lhs == rhs) {
​^
cc1plus: all warnings being treated as errors
paddle/fluid/memory/allocation/CMakeFiles/test_aligned_allocator.dir/build.make:62: recipe for target ‘paddle/fluid/memory/allocation/CMakeFiles/test_aligned_allocator.dir/test_aligned_allocator.cc.o’ failed
make[2]: *** [paddle/fluid/memory/allocation/CMakeFiles/test_aligned_allocator.dir/test_aligned_allocator.cc.o] Error 1
CMakeFiles/Makefile2:2105: recipe for target ‘paddle/fluid/memory/allocation/CMakeFiles/test_aligned_allocator.dir/all’ failed
make[1]: *** [paddle/fluid/memory/allocation/CMakeFiles/test_aligned_allocator.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs….
Scanning dependencies of target tuple_test
[ 23%] Building CXX object paddle/fluid/framework/CMakeFiles/tuple_test.dir/tuple_test.cc.o
[ 23%] Linking CXX executable place_test
[ 23%] Built target place_test
In file included from /repos/paddle_paddle/paddle/fluid/memory/allocation/best_fit_allocator_test.cc:21:0:
/repos/paddle_paddle/build/third_party/install/gtest/include/gtest/gtest.h: In instantiation of ‘testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int]’:
/repos/paddle_paddle/build/third_party/install/gtest/include/gtest/gtest.h:1472:23: required from ‘static testing::AssertionResult testing::internal::EqHelper<lhs_is_null_literal>::Compare(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int; bool lhs_is_null_literal = false]’
/repos/paddle_paddle/paddle/fluid/memory/allocation/best_fit_allocator_test.cc:48:330: required from here
/repos/paddle_paddle/build/third_party/install/gtest/include/gtest/gtest.h:1444:11: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
​if (lhs == rhs) {
​^
cc1plus: all warnings being treated as errors
paddle/fluid/memory/allocation/CMakeFiles/best_fit_allocator_test.dir/build.make:62: recipe for target ‘paddle/fluid/memory/allocation/CMakeFiles/best_fit_allocator_test.dir/best_fit_allocator_test.cc.o’ failed
make[2]: *** [paddle/fluid/memory/allocation/CMakeFiles/best_fit_allocator_test.dir/best_fit_allocator_test.cc.o] Error 1
CMakeFiles/Makefile2:1743: recipe for target ‘paddle/fluid/memory/allocation/CMakeFiles/best_fit_allocator_test.dir/all’ failed
make[1]: *** [paddle/fluid/memory/allocation/CMakeFiles/best_fit_allocator_test.dir/all] Error 2
[ 23%] Linking CXX executable rw_lock_test
In file included from /repos/paddle_paddle/paddle/fluid/platform/enforce_test.cc:18:0:
/repos/paddle_paddle/build/third_party/install/gtest/include/gtest/gtest.h: In instantiation of ‘testing::AssertionResult testing::internal::CmpHelperNE(const char*, const char*, const T1&, const T2&) [with T1 = long unsigned int; T2 = int]’:
/repos/paddle_paddle/paddle/fluid/platform/enforce_test.cc:55:207: required from here
/repos/paddle_paddle/build/third_party/install/gtest/include/gtest/gtest.h:1573:145: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
cc1plus: all warnings being treated as errors
paddle/fluid/platform/CMakeFiles/enforce_test.dir/build.make:62: recipe for target ‘paddle/fluid/platform/CMakeFiles/enforce_test.dir/enforce_test.cc.o’ failed
make[2]: *** [paddle/fluid/platform/CMakeFiles/enforce_test.dir/enforce_test.cc.o] Error 1
CMakeFiles/Makefile2:3103: recipe for target ‘paddle/fluid/platform/CMakeFiles/enforce_test.dir/all’ failed
make[1]: *** [paddle/fluid/platform/CMakeFiles/enforce_test.dir/all] Error 2
[ 23%] Linking CXX executable errors_test
[ 23%] Built target rw_lock_test
[ 23%] Built target errors_test
[ 23%] Linking CXX executable init_test
[ 23%] Built target init_test
[ 23%] Linking CXX executable op_kernel_type_test
[ 23%] Built target op_kernel_type_test
[ 23%] Linking CXX executable threadpool_test
[ 23%] Linking CXX static library libgru_compute.a
[ 23%] Built target gru_compute
[ 23%] Built target threadpool_test
[ 23%] Linking CXX static library libcontext_project.a
[ 23%] Built target context_project
[ 23%] Linking CXX executable op_proto_maker_test
[ 23%] Linking CXX static library libbeam_search.a
[ 23%] Built target beam_search
[ 23%] Built target op_proto_maker_test
[ 23%] Linking CXX static library libtree2col.a
[ 23%] Built target tree2col
[ 24%] Linking CXX executable copy_same_tensor_test
[ 24%] Linking CXX static library libdata_layout_transform.a
[ 24%] Built target data_layout_transform
[ 24%] Built target copy_same_tensor_test
[ 24%] Linking CXX executable tuple_test
[ 24%] Linking CXX static library libsoftmax.a
[ 24%] Built target softmax
[ 24%] Built target tuple_test
[ 24%] Linking CXX static library libselected_rows_functor.a
[ 24%] Built target selected_rows_functor
[ 24%] Linking CXX static library libsequence_pooling.a
[ 24%] Built target sequence_pooling
Makefile:138: recipe for target ‘all’ failed
make: *** [all] Error 2

References:

Internet is a lot to say in the makefile «-Werror» removed, but no makefile NS3, can not be modified options to find the build in the root directory of NS3 / c4che / cache.py file, NS3 build process through the script file configure, and delete -werror option in the file (there are several, by looking to find and delete).

[Supplement] Someone mentioned the presence of «-Werror» will repeat the question again, indeed! run./waf configureAfter the command to reconfigure, delete «-Werror» will be repeated again. The solution is to use this project without frequent configuration command, after the initial run some configuration, behind the basic need for a big change.

Solution 2:

Reference 1:
Reference 2:
Reference 1 explains waf configure setup options, Reference 2 describes how to set the C / C ++ compiler to ignore the warning. It can be used in combination.

Firstly configure settings before running ./waf:

CXXFLAGS="-Wno-error" ./waf configure  // Note that there are no spaces around the equal sign

Then the compiler can ignore the warning after // to carry out the configuration

Note: You can use method 1 in the effectiveness of case 2, (because I use in another project 1 failure ha ha ha). Recently, continuously updated, the welcome discussions and exchange.


0

1

сколько времени я потратил на сборку этого — неизвестно даже мне самому,
у всех это так легко получается..

ближе к сути,
при сборке ядра андроида всячески вылезают ошибки, ответы на которые в гугле не навалом, хотелось бы разобрать их в компании с вами, и забыть весь этот ужас с мучениями как страшный сон.
я начну.

root@WitheringCorp:~/Xiaomi_Kernel_OpenSource# make
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     scripts/mod/devicetable-offsets.h
  CHK     include/generated/compile.h
  CHK     kernel/config_data.h
  CHK     kernel/kheaders_data.tar.xz
  GEN     kernel/kheaders_data.tar.xz
./kernel/gen_kheaders.sh: строка 61: /tools/build/cpio: Нет такого файла или каталога
make[1]: *** [kernel/Makefile:142: kernel/kheaders_data.tar.xz] Ошибка 127
make: *** [Makefile:1163: kernel] Ошибка 2

7 ответов

Лучший ответ

Конечно, найдите, где установлен -Werror, и удалите этот флаг. Тогда предупреждения будут только предупреждениями.


96

Peter Mortensen
7 Авг 2022 в 22:53

Удалите -Werror из ваших файлов Make или CMake, как предложено в этом сообщении.


12

Peter Mortensen
8 Авг 2022 в 00:00

Если вы компилируете ядро ​​Linux:

Например, если вы хотите отключить предупреждение, которое «неиспользуемая, но заданная переменная» рассматривается как ошибка. Вы можете добавить заявление:

KBUILD_CFLAGS += $(call cc-option,-Wno-error=unused-but-set-variable,)

В вашем Makefile.


4

Peter Mortensen
7 Авг 2022 в 23:30

Решение:

CFLAGS=-Wno-error ./configure


20

Zibri
13 Мар 2020 в 16:41

-Wall и -Werror. Пожалуйста, проверьте, используются ли они в настройках компилятора.


4

Peter Mortensen
7 Авг 2022 в 23:09

Понравилась статья? Поделить с друзьями:
  • Cc id 608 bmw x1 ошибка
  • Cc id 415 bmw x1 код ошибки
  • Cc id 385 bmw ошибка
  • Cc id 307 bmw ошибка
  • Cc id 275 ошибка бмв