Cmake building error,trying to install gnuradio-mediatools.amodule in GNURadio - cmake

The module can be find Here
I think maybe some dependencies errors occured,anyone who has an idea will be great~
What I find important is
lib/CMakeFiles/gnuradio-mediatools.dir/build.make:86: recipe for target 'lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_impl.cc.o' failed
The whole list as follow:
imatrix#Zero:~/下载/GNU/ 模块/gr-mediatools-master/build$ make -j4
Scanning dependencies of target mediatools_swig_swig_doc
Scanning dependencies of target pygen_python_aead6
Scanning dependencies of target pygen_apps_9a6dd
Scanning dependencies of target gnuradio-mediatools
[ 0%] Built target mediatools_swig_swig_doc
[ 5%] Generating __init__.pyc
[ 5%] Built target pygen_apps_9a6dd
Scanning dependencies of target _mediatools_swig_swig_tag
[ 11%] Generating __init__.pyo
[ 17%] Building CXX object swig/CMakeFiles/_mediatools_swig_swig_tag.dir/_mediatools_swig_swig_tag.cpp.o
[ 23%] Building CXX object lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_s.cc.o
[ 29%] Building CXX object lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_impl.cc.o
[ 35%] Linking CXX executable _mediatools_swig_swig_tag
[ 35%] Built target pygen_python_aead6
[ 35%] Built target _mediatools_swig_swig_tag
[ 41%] Generating mediatools_swig.tag
Scanning dependencies of target mediatools_swig_swig_2d0df
[ 47%] Building CXX object swig/CMakeFiles/mediatools_swig_swig_2d0df.dir/mediatools_swig_swig_2d0df.cpp.o
[ 52%] Linking CXX executable mediatools_swig_swig_2d0df
Swig source
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc: In member function ‘bool mediatools_audiosource_impl::open(std::__cxx11::string)’:
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:42:58: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
d_codec_ctx = d_format_ctx->streams[stream_idx]->codec;
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:11:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavformat/avformat.h:893:21: note: declared here
AVCodecContext *codec;
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:42:58: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
d_codec_ctx = d_format_ctx->streams[stream_idx]->codec;
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:11:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavformat/avformat.h:893:21: note: declared here
AVCodecContext *codec;
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:42:58: warning: ‘AVStream::codec’ is deprecated [-Wdeprecated-declarations]
d_codec_ctx = d_format_ctx->streams[stream_idx]->codec;
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:11:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavformat/avformat.h:893:21: note: declared here
AVCodecContext *codec;
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc: In member function ‘void mediatools_audiosource_impl::readData(std::vector<short int>&)’:
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:91:39: error: ‘avcodec_alloc_frame’ was not declared in this scope
d_frame = avcodec_alloc_frame();
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:95:14: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
int rc = avcodec_decode_audio4(d_codec_ctx, d_frame, &got_frame, &d_packet);
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:10:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavcodec/avcodec.h:4817:5: note: declared here
int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:95:14: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
int rc = avcodec_decode_audio4(d_codec_ctx, d_frame, &got_frame, &d_packet);
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:10:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavcodec/avcodec.h:4817:5: note: declared here
int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
^
/home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:95:79: warning: ‘int avcodec_decode_audio4(AVCodecContext*, AVFrame*, int*, const AVPacket*)’ is deprecated [-Wdeprecated-declarations]
int rc = avcodec_decode_audio4(d_codec_ctx, d_frame, &got_frame, &d_packet);
^
In file included from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/include/mediatools_audiosource_impl.h:10:0,
from /home/imatrix/下载/GNU/ 模块/gr-mediatools-master/lib/mediatools_audiosource_impl.cc:1:
/usr/local/include/libavcodec/avcodec.h:4817:5: note: declared here
int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame,
^
lib/CMakeFiles/gnuradio-mediatools.dir/build.make:86: recipe for target 'lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_impl.cc.o' failed
make[2]: *** [lib/CMakeFiles/gnuradio-mediatools.dir/mediatools_audiosource_impl.cc.o] Error 1
make[2]: *** 正在等待未完成的任务....
[ 52%] Built target mediatools_swig_swig_2d0df
Scanning dependencies of target pygen_swig_d4ca7
[ 64%] Generating mediatools_swig.pyc
[ 64%] Generating mediatools_swig.pyo
[ 70%] Built target pygen_swig_d4ca7
CMakeFiles/Makefile2:135: recipe for target 'lib/CMakeFiles/gnuradio-mediatools.dir/all' failed
make[1]: *** [lib/CMakeFiles/gnuradio-mediatools.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

Your error stems from here:
gr-mediatools-master/lib/mediatools_audiosource_impl.cc:91:39: error: ‘avcodec_alloc_frame’ was not declared in this scope
d_frame = avcodec_alloc_frame();
That's because avcodec_alloc_frame has been deprecated in recent versions of ffmpeg. The gr-mediatools repository is quite old now.
Replacing avcodec_alloc_frame with av_frame_alloc in lib/mediatools_audiosource_impl.cc on line 91 might just do the trick.

Related

flatbuffers - unable to compile with cygwin

I am trying to compile flatbuffers with cygwin.
Here is what I do:
git clone https://github.com/google/flatbuffers.git && cd ./flatbuffers
Than:
cmake .
-- The C compiler identification is GNU 10.2.0
-- The CXX compiler identification is GNU 10.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++.exe
-- Check for working CXX compiler: /usr/bin/c++.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for strtof_l
-- Looking for strtof_l - not found
-- Looking for strtoull_l
-- Looking for strtoull_l - not found
-- `tests/monster_test.fbs`: add generation of C++ code with '--no-includes;--gen-compare'
-- `tests/monster_test.fbs`: add generation of binary (.bfbs) schema
-- `tests/namespace_test/namespace_test1.fbs`: add generation of C++ code with '--no-includes;--gen-compare'
-- `tests/namespace_test/namespace_test2.fbs`: add generation of C++ code with '--no-includes;--gen-compare'
-- `tests/union_vector/union_vector.fbs`: add generation of C++ code with '--no-includes;--gen-compare'
-- `tests/optional_scalars.fbs`: add generation of C++ code with '--no-includes;--gen-compare'
-- `tests/native_type_test.fbs`: add generation of C++ code with ''
-- `tests/arrays_test.fbs`: add generation of C++ code with '--scoped-enums;--gen-compare'
-- `tests/arrays_test.fbs`: add generation of binary (.bfbs) schema
-- `tests/monster_test.fbs`: add generation of C++ embedded binary schema code with '--no-includes;--gen-compare'
-- `tests/monster_extra.fbs`: add generation of C++ code with '--no-includes;--gen-compare'
-- `samples/monster.fbs`: add generation of C++ code with '--no-includes;--gen-compare'
-- `samples/monster.fbs`: add generation of binary (.bfbs) schema
Proceeding with version: 1.12.0.177
-- Configuring done
-- Generating done
-- Build files have been written to: /home/Vivas/flatbuffers
And when I run:
$ make
Scanning dependencies of target flatbuffers
[ 1%] Building CXX object CMakeFiles/flatbuffers.dir/src/idl_parser.cpp.o
[ 2%] Building CXX object CMakeFiles/flatbuffers.dir/src/idl_gen_text.cpp.o
[ 3%] Building CXX object CMakeFiles/flatbuffers.dir/src/reflection.cpp.o
[ 4%] Building CXX object CMakeFiles/flatbuffers.dir/src/util.cpp.o
[ 5%] Linking CXX static library libflatbuffers.a
[ 5%] Built target flatbuffers
Scanning dependencies of target flatc
[ 6%] Building CXX object CMakeFiles/flatc.dir/src/idl_parser.cpp.o
[ 7%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_text.cpp.o
[ 9%] Building CXX object CMakeFiles/flatc.dir/src/reflection.cpp.o
[ 10%] Building CXX object CMakeFiles/flatc.dir/src/util.cpp.o
[ 11%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_cpp.cpp.o
[ 12%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_csharp.cpp.o
[ 13%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_dart.cpp.o
[ 14%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_kotlin.cpp.o
[ 15%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_go.cpp.o
[ 17%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_java.cpp.o
[ 18%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_js_ts.cpp.o
[ 19%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_php.cpp.o
[ 20%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_python.cpp.o
[ 21%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_lobster.cpp.o
[ 22%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_lua.cpp.o
[ 23%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_rust.cpp.o
[ 25%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_fbs.cpp.o
[ 26%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_grpc.cpp.o
[ 27%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_json_schema.cpp.o
[ 28%] Building CXX object CMakeFiles/flatc.dir/src/idl_gen_swift.cpp.o
[ 29%] Building CXX object CMakeFiles/flatc.dir/src/flatc.cpp.o
[ 30%] Building CXX object CMakeFiles/flatc.dir/src/flatc_main.cpp.o
[ 31%] Building CXX object CMakeFiles/flatc.dir/src/code_generators.cpp.o
[ 32%] Building CXX object CMakeFiles/flatc.dir/grpc/src/compiler/cpp_generator.cc.o
[ 34%] Building CXX object CMakeFiles/flatc.dir/grpc/src/compiler/go_generator.cc.o
[ 35%] Building CXX object CMakeFiles/flatc.dir/grpc/src/compiler/java_generator.cc.o
[ 36%] Building CXX object CMakeFiles/flatc.dir/grpc/src/compiler/python_generator.cc.o
[ 37%] Building CXX object CMakeFiles/flatc.dir/grpc/src/compiler/swift_generator.cc.o
[ 38%] Building CXX object CMakeFiles/flatc.dir/grpc/src/compiler/ts_generator.cc.o
[ 39%] Linking CXX executable flatc.exe
[ 39%] Built target flatc
Scanning dependencies of target generated_code
[ 40%] Run generation: 'samples/monster.bfbs'
[ 42%] Run generation: 'tests/monster_test_generated.h'
[ 43%] Run generation: 'tests/monster_test.bfbs'
[ 44%] Run generation: 'tests/namespace_test/namespace_test1_generated.h'
[ 45%] Run generation: 'tests/namespace_test/namespace_test2_generated.h'
[ 46%] Run generation: 'tests/union_vector/union_vector_generated.h'
[ 47%] Run generation: 'tests/optional_scalars_generated.h'
[ 48%] Run generation: 'tests/native_type_test_generated.h'
[ 50%] Run generation: 'tests/arrays_test_generated.h'
[ 51%] Run generation: 'tests/arrays_test.bfbs'
[ 52%] Run generation: 'tests/monster_test_bfbs_generated.h'
[ 53%] Run generation: 'tests/monster_extra_generated.h'
[ 54%] Run generation: 'samples/monster_generated.h'
[ 55%] All generated files were updated.
[ 55%] Built target generated_code
Scanning dependencies of target flatsamplebfbs
[ 56%] Building CXX object CMakeFiles/flatsamplebfbs.dir/src/idl_parser.cpp.o
[ 57%] Building CXX object CMakeFiles/flatsamplebfbs.dir/src/idl_gen_text.cpp.o
[ 59%] Building CXX object CMakeFiles/flatsamplebfbs.dir/src/reflection.cpp.o
[ 60%] Building CXX object CMakeFiles/flatsamplebfbs.dir/src/util.cpp.o
[ 61%] Building CXX object CMakeFiles/flatsamplebfbs.dir/samples/sample_bfbs.cpp.o
[ 62%] Linking CXX executable flatsamplebfbs.exe
[ 63%] Built target flatsamplebfbs
Scanning dependencies of target flatsampletext
[ 64%] Building CXX object CMakeFiles/flatsampletext.dir/src/idl_parser.cpp.o
[ 65%] Building CXX object CMakeFiles/flatsampletext.dir/src/idl_gen_text.cpp.o
[ 67%] Building CXX object CMakeFiles/flatsampletext.dir/src/reflection.cpp.o
[ 68%] Building CXX object CMakeFiles/flatsampletext.dir/src/util.cpp.o
[ 69%] Building CXX object CMakeFiles/flatsampletext.dir/samples/sample_text.cpp.o
[ 70%] Linking CXX executable flatsampletext.exe
[ 71%] Built target flatsampletext
Scanning dependencies of target flathash
[ 72%] Building CXX object CMakeFiles/flathash.dir/src/flathash.cpp.o
[ 73%] Linking CXX executable flathash.exe
[ 73%] Built target flathash
Scanning dependencies of target flattests
[ 75%] Building CXX object CMakeFiles/flattests.dir/src/idl_parser.cpp.o
[ 76%] Building CXX object CMakeFiles/flattests.dir/src/idl_gen_text.cpp.o
[ 77%] Building CXX object CMakeFiles/flattests.dir/src/reflection.cpp.o
[ 78%] Building CXX object CMakeFiles/flattests.dir/src/util.cpp.o
[ 79%] Building CXX object CMakeFiles/flattests.dir/src/idl_gen_fbs.cpp.o
[ 80%] Building CXX object CMakeFiles/flattests.dir/tests/test.cpp.o
/home/Vivas/flatbuffers/tests/test.cpp:66:19: error: ‘const auto infinityf’ redeclared as different kind of entity
66 | static const auto infinityf = std::numeric_limits<float>::infinity();
| ^~~~~~~~~
In file included from /usr/lib/gcc/x86_64-pc-cygwin/10/include/c++/cmath:45,
from /home/Vivas/flatbuffers/tests/test.cpp:16:
/usr/include/math.h:398:14: note: previous declaration ‘float infinityf()’
398 | extern float infinityf (void);
| ^~~~~~~~~
In file included from /home/Vivas/flatbuffers/tests/test.cpp:45:
/home/Vivas/flatbuffers/tests/test.cpp: In function ‘void TestMonsterExtraFloats()’:
/home/Vivas/flatbuffers/tests/test.cpp:702:25: error: wrong type argument to unary minus
702 | TEST_EQ(is_quiet_nan(-infinityf), false);
| ^~~~~~~~~
/home/Vivas/flatbuffers/tests/test_assert.h:19:34: note: in definition of macro ‘TEST_EQ’
19 | #define TEST_EQ(exp, val) TestEq(exp, val, "'" #exp "' != '" #val "'", __FILE__, __LINE__, "")
| ^~~
/home/Vivas/flatbuffers/tests/test.cpp:731:29: error: wrong type argument to unary minus
731 | TEST_EQ(def_extra->f3(), -infinityf);
| ^~~~~~~~~
/home/Vivas/flatbuffers/tests/test_assert.h:19:39: note: in definition of macro ‘TEST_EQ’
19 | #define TEST_EQ(exp, val) TestEq(exp, val, "'" #exp "' != '" #val "'", __FILE__, __LINE__, "")
| ^~~
/home/Vivas/flatbuffers/tests/test.cpp:762:25: error: wrong type argument to unary minus
762 | TEST_EQ(extra->f3(), -infinityf);
| ^~~~~~~~~
/home/Vivas/flatbuffers/tests/test_assert.h:19:39: note: in definition of macro ‘TEST_EQ’
19 | #define TEST_EQ(exp, val) TestEq(exp, val, "'" #exp "' != '" #val "'", __FILE__, __LINE__, "")
| ^~~
/home/Vivas/flatbuffers/tests/test.cpp:770:35: error: wrong type argument to unary minus
770 | TEST_EQ(extra->fvec()->Get(1), -infinityf);
| ^~~~~~~~~
/home/Vivas/flatbuffers/tests/test_assert.h:19:39: note: in definition of macro ‘TEST_EQ’
19 | #define TEST_EQ(exp, val) TestEq(exp, val, "'" #exp "' != '" #val "'", __FILE__, __LINE__, "")
| ^~~
/home/Vivas/flatbuffers/tests/test.cpp: In function ‘void ValidFloatTest()’:
/home/Vivas/flatbuffers/tests/test.cpp:1971:60: error: wrong type argument to unary minus
1971 | TEST_EQ(TestValue<float>("{ y:-3.4029e+38 }", "float"), -infinityf);
| ^~~~~~~~~
/home/Vivas/flatbuffers/tests/test_assert.h:19:39: note: in definition of macro ‘TEST_EQ’
19 | #define TEST_EQ(exp, val) TestEq(exp, val, "'" #exp "' != '" #val "'", __FILE__, __LINE__, "")
| ^~~
/home/Vivas/flatbuffers/tests/test.cpp:2015:53: error: wrong type argument to unary minus
2015 | TEST_EQ(TestValue<float>("{ y:-inf }", "float"), -infinityf);
| ^~~~~~~~~
/home/Vivas/flatbuffers/tests/test_assert.h:19:39: note: in definition of macro ‘TEST_EQ’
19 | #define TEST_EQ(exp, val) TestEq(exp, val, "'" #exp "' != '" #val "'", __FILE__, __LINE__, "")
| ^~~
/home/Vivas/flatbuffers/tests/test.cpp:2017:53: error: wrong type argument to unary minus
2017 | TEST_EQ(TestValue<float>(nullptr, "float=-inf"), -infinityf);
| ^~~~~~~~~
/home/Vivas/flatbuffers/tests/test_assert.h:19:39: note: in definition of macro ‘TEST_EQ’
19 | #define TEST_EQ(exp, val) TestEq(exp, val, "'" #exp "' != '" #val "'", __FILE__, __LINE__, "")
| ^~~
/home/Vivas/flatbuffers/tests/test_assert.h: In instantiation of ‘void TestEq(T, U, const char*, const char*, int, const char*) [with T = float; U = float (*)()]’:
/home/Vivas/flatbuffers/tests/test.cpp:730:3: required from here
/home/Vivas/flatbuffers/tests/test_assert.h:92:7: error: invalid ‘static_cast’ from type ‘float’ to type ‘float (*)()’
92 | if (static_cast<U>(expval) != val) {
| ^~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/flattests.dir/build.make:184: CMakeFiles/flattests.dir/tests/test.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:247: CMakeFiles/flattests.dir/all] Error 2
make: *** [Makefile:161: all] Error 2
Why is that, and how can I fix it?
Easiest would be to rename infinityf (at tests/test.cpp:66:19) and its uses to something different. If that makes it compile, open a PR on https://github.com/google/flatbuffers with your changes.
It seems like it is clashing with things declared in the cmath header. I am not sure why this happens with cygwin and not on other platform we build for gcc?
Also note this is in the tests, which you don't strictly need to build. Invoking CMake with -DFLATBUFFERS_BUILD_TESTS=OFF would likely also work.

CMake 3.16.x not building gRPC 1.23/1.26 anymore on Windows 10 (VS 2017)

My team and I are building gRPC using CMake. We have been building gRPC v1.26 (and v1.23 too) just fine with CMake 3.15.6, but since CMake 3.16.x is not building anymore.
This is the log of the tools we are using:
[29/32 0.2/sec] Performing configure step for 'grpc'
loading initial cache file C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/_deps/grpc_src-build/grpc/tmp/grpc-cache-Debug.cmake
-- The C compiler identification is MSVC 19.16.27034.0
-- The CXX compiler identification is MSVC 19.16.27034.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Protobuf: C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/install/external/lib/libprotobufd.lib (found version "3.8.0")
-- Found OpenSSL: optimized;C:/Program Files/OpenSSL-Win64/lib/VC/libcrypto64MD.lib;debug;C:/Program Files/OpenSSL-Win64/lib/VC/libcrypto64MDd.lib (found version "1.1.1d")
-- Found ZLIB: C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/install/external/lib/zlibd.lib (found version "1.2.11")
-- Configuring done
-- Generating done
-- Build files have been written to: C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/_deps/grpc_src-build/grpc/src/grpc-build
After configure step, something fails in the build step. However as it can be seen the building process does not stop.
[30/32 0.1/sec] Performing build step for 'grpc'
FAILED: C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/_deps/grpc_src-build/grpc/src/grpc-stamp/grpc-build
cmd.exe /C "cd /D C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\_deps\grpc_src-build\grpc\src\grpc-build && "C:\Program Files\CMake\bin\cmake.exe" --build . && "C:\Program Files\CMake\bin\cmake.exe" -E touch C:/TCSoftware/build-frontend-Qt5132_MSVC17_cmake-Debug/_deps/grpc_src-build/grpc/src/grpc-stamp/grpc-build"
[1/1580 1.3/sec] Building CXX object CMakeFiles\grpc_cronet.dir\src\core\lib\iomgr\udp_server.cc.obj
[2/1580 2.5/sec] Building CXX object CMakeFiles\grpc_cronet.dir\src\core\lib\iomgr\timer_heap.cc.obj
[3/1580 3.3/sec] Building CXX object CMakeFiles\grpc_cronet.dir\src\core\lib\iomgr\timer.cc.obj
It builds a lot of objects until it starts showing strange warnings as follows, but it still keeps building.
[975/1580 5.8/sec] Linking CXX static library gpr.lib
[976/1580 5.8/sec] Linking C static library address_sorting.lib
[977/1580 5.8/sec] Building CXX object CMakeFiles\grpc.dir\src\core\lib\backoff\backoff.cc.obj
...
[982/1580 5.8/sec] Building CXX object CMakeFiles\grpc_ruby_plugin.dir\src\compiler\ruby_plugin.cc.obj
C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\include\google/protobuf/stubs/logging.h(102): warning C4251: 'google::protobuf::internal::LogMessage::message_': class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'google::protobuf::internal::LogMessage'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xstring(4373): note: see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\include\google/protobuf/arena_impl.h(251): warning C4251: 'google::protobuf::internal::ArenaImpl::lifecycle_id_generator_': struct 'std::atomic<__int64>' needs to have dll-interface to be used by clients of class 'google::protobuf::internal::ArenaImpl'
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include\xxatomic(162): note: see declaration of 'std::atomic<__int64>'
More warnings are shown as follows:
[1531/1580 5.5/sec] Building CXX object CMakeFiles\grpc_print_google_default_creds_token.dir\test\core\security\print_google_default_creds_token.cc.obj
[1532/1580 5.5/sec] Linking CXX static library grpc++.lib
server_posix.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
rpc_method.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
create_channel_posix.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
[1533/1580 5.5/sec] Linking CXX static library grpc_plugin_support.lib
[1534/1580 5.5/sec] Building CXX object CMakeFiles\grpc_create_jwt.dir\test\core\security\create_jwt.cc.obj
[1535/1580 5.5/sec] Linking CXX static library grpc++_unsecure.lib
server_posix.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
rpc_method.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
create_channel_posix.cc.obj : warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
[1536/1580 5.5/sec] Building CXX object CMakeFiles\grpc_create_jwt.dir\test\core\util\cmdline.cc.obj
[1537/1580 5.5/sec] Linking CXX executable grpc_ruby_plugin.exe
FAILED: grpc_ruby_plugin.exe
cmd.exe /C "cd . && "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\grpc_ruby_plugin.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100177~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100177~1.0\x64\mt.exe --manifests -- C:\PROGRA~2\MICROS~1\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\Hostx64\x64\link.exe /nologo CMakeFiles\grpc_ruby_plugin.dir\src\compiler\ruby_plugin.cc.obj /out:grpc_ruby_plugin.exe /implib:grpc_ruby_plugin.lib /pdb:grpc_ruby_plugin.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotocd.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotobufd.lib grpc_plugin_support.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotocd.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotobufd.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
LINK Pass 1: command "C:\PROGRA~2\MICROS~1\2017\COMMUN~1\VC\Tools\MSVC\1416~1.270\bin\Hostx64\x64\link.exe /nologo CMakeFiles\grpc_ruby_plugin.dir\src\compiler\ruby_plugin.cc.obj /out:grpc_ruby_plugin.exe /implib:grpc_ruby_plugin.lib /pdb:grpc_ruby_plugin.pdb /version:0.0 /machine:x64 /debug /INCREMENTAL /subsystem:console C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotocd.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotobufd.lib grpc_plugin_support.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotocd.lib C:\TCSoftware\build-frontend-Qt5132_MSVC17_cmake-Debug\install\external\lib\libprotobufd.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\grpc_ruby_plugin.dir/intermediate.manifest CMakeFiles\grpc_ruby_plugin.dir/manifest.res" failed (exit code 1120) with the following output:
ruby_plugin.cc.obj : warning LNK4217: locally defined symbol ?name#FileDescriptor#protobuf#google##QEBAAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ (public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __cdecl google::protobuf::FileDescriptor::name(void)const ) imported in function "bool __cdecl grpc_ruby_generator::ServicesFilename(class google::protobuf::FileDescriptor const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)" (?ServicesFilename#grpc_ruby_generator##YA_NPEBVFileDescriptor#protobuf#google##PEAV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
grpc_plugin_support.lib(ruby_generator.cc.obj) : warning LNK4049: locally defined symbol ?name#FileDescriptor#protobuf#google##QEBAAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ (public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __cdecl google::protobuf::FileDescriptor::name(void)const ) imported
ruby_plugin.cc.obj : warning LNK4217: locally defined symbol ??0CodedOutputStream#io#protobuf#google##QEAA#PEAVZeroCopyOutputStream#123##Z (public: __cdecl google::protobuf::io::CodedOutputStream::CodedOutputStream(class google::protobuf::io::ZeroCopyOutputStream *)) imported in function "public: virtual bool __cdecl RubyGrpcGenerator::Generate(class google::protobuf::FileDescriptor const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class google::protobuf::compiler::GeneratorContext *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)const " (?Generate#RubyGrpcGenerator##UEBA_NPEBVFileDescriptor#protobuf#google##AEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PEAVGeneratorContext#compiler#34#PEAV56##Z)
Build stops after a lot of the above warnings with the following log:
ruby_plugin.cc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public:
__cdecl google::protobuf::compiler::CodeGenerator::CodeGenerator(void)" (__imp_??0CodeGenerator#compiler#protobuf#google##QEAA#XZ) referenced in function "public: __cdecl RubyGrpcGenerator::RubyGrpcGenerator(void)" (??0RubyGrpcGenerator##QEAA#XZ)
ruby_plugin.cc.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) int __cdecl google::protobuf::compiler::PluginMain(int,char * * const,class google::protobuf::compiler::CodeGenerator const *)" (__imp_?PluginMain#compiler#protobuf#google##YAHHQEAPEADPEBVCodeGenerator#123##Z) referenced in function "int __cdecl grpc::protobuf::compiler::PluginMain(int,char * * const,class google::protobuf::compiler::CodeGenerator const *)" (?PluginMain#compiler#protobuf#grpc##YAHHQEAPEADPEBVCodeGenerator#12google###Z)
grpc_plugin_support.lib(ruby_generator.cc.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __cdecl google::protobuf::Descriptor::name(void)const " (__imp_?name#Descriptor#protobuf#google##QEBAAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl grpc_ruby_generator::RubyTypeOf(class google::protobuf::Descriptor const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?RubyTypeOf#grpc_ruby_generator##YA?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PEBVDescriptor#protobuf#google##AEBV23##Z)
The only thing changed between working build and not working one is: removing build folder, uninstall CMake 3.15.x, reboot, install CMake 3.16.0, build grpc all over again.
Anyone faced something like this? Thank you

cmake not linking my class I think, mistakes in cmakelists.text likely culprit

I think, I may have improperly set up cmake wrong,(or improperly set up cmake for that matter) or I'm bad and rusty at C++ or both and possibly more. I just want to add a header and separate code into a class that loads images for opengl. I also put them in another directory parallel to other libraries in my linux file tree.
The main project folder has the main cmakelists.text file in it it's called "maficengine". Inside it are also a "build" file a "common" file and "external" file and a file called "Mafic", "maficGuiSourceFiles" file and one called "distrib." I think we can just focus on 2. "mafic" and "external". Inside mafic I have one called mafic.cpp which has my main function and is the entry point. Inside external, there is another folder called "myCustomHeaders".. therein lies a file called "loadTexture.cpp" It contains the loadTexture class declaration and definition. Also inside "myCustomHeaders" there is an "include" file which contains "loadTexture.h"... I cannot seem to instanciate an instance of LoadTexture lt; and call the function of loadtexture(); I expect it to at line 187 in mafic.cpp
#cmakelists.text file from main project folder
# CMake entry point
cmake_minimum_required (VERSION 3.0)
project (maficengine )
find_package(OpenGL REQUIRED)
add_library(loaders
external/myCustomHeaders/loadTexture.cpp
external/myCustomHeaders/include/loadTexture.h
)
set(SOURCES external/myCustomHeaders/loadTexture.cpp )
# Compile external dependencies
add_subdirectory (external)
# On Visual 2005 and above, this module can set the debug working directory
cmake_policy(SET CMP0026 OLD)
cmake_policy(SET CMP0079 NEW)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/external/rpavlik-cmake-modules-fe2273")
include(CreateLaunchers)
include(MSVCMultipleProcessCompile) # /MP
if(INCLUDE_DISTRIB)
add_subdirectory(distrib)
endif(INCLUDE_DISTRIB)
include_directories(
external/AntTweakBar-1.16/include/
external/glfw-3.1.2/include/
external/glm-0.9.7.1/
external/glew-1.13.0/include/
external/assimp-3.0.1270/include/
external/bullet-2.81-rev2613/src/
external/myCustomHeaders/include
common/
)
set(ALL_LIBS
${OPENGL_LIBRARY}
glfw
GLEW_1130
loaders
)
add_definitions(
-DTW_STATIC
-DTW_NO_LIB_PRAGMA
-DTW_NO_DIRECT3D
-DGLEW_STATIC
-D_CRT_SECURE_NO_WARNINGS
)
# Tutorial 17
add_executable(mageengine
Mafic/mafic.cpp
common/shader.cpp
common/shader.hpp
common/controls.cpp
common/controls.hpp
common/texture.cpp
common/texture.hpp
common/objloader.cpp
common/objloader.hpp
common/vboindexer.cpp
common/vboindexer.hpp
common/quaternion_utils.cpp
common/quaternion_utils.hpp
#Mafic/loadTexture.h
#Mafic/loadTexture.cpp
Mafic/StandardShading.vertexshader
Mafic/StandardShading.fragmentshader
)
target_link_libraries(mageengine
${ALL_LIBS}
ANTTWEAKBAR_116_OGLCORE_GLFW
loaders
)
here's mafic.cpp
#include <loadTexture.h>
int main( void )
{
loadTexture lt;
lt.loadtexture();
}
here's my loadTexture.cpp
class loadTexture
{
public:
loadTexture();
~loadTexture();
void loadtexture(){
fprintf(stdout, "loadtexture does something, that's a positive result for this test");
}
};
and finally my loadTexture.h
[code]
#pragma once
#include <GL/glew.h>
//GLuint image;
void loadtexture();
[/code]
Hoping it would build with no errors but I get ...
aaron#Zog:~/Desktop/maficengine/build$ make
[ 2%] Built target ANTTWEAKBAR_116_OGLCORE_GLFW
[ 2%] Built target GLEW_1130
[ 2%] Built target loaders
[ 6%] Built target glfw
[ 7%] Building CXX object CMakeFiles/mageengine.dir/Mafic/mafic.cpp.o
/home/aaron/Desktop/maficengine/Mafic/mafic.cpp:1:9: warning: #pragma once in main file
#pragma once
^~~~
/home/aaron/Desktop/maficengine/Mafic/mafic.cpp: In function ‘int main()’:
/home/aaron/Desktop/maficengine/Mafic/mafic.cpp:187:1: error: ‘loadTexture’ was not declared in this scope
loadTexture lt;
^~~~~~~~~~~
/home/aaron/Desktop/maficengine/Mafic/mafic.cpp:187:1: note: suggested alternative: ‘loadtexture’
loadTexture lt;
^~~~~~~~~~~
loadtexture
/home/aaron/Desktop/maficengine/Mafic/mafic.cpp:189:2: error: ‘lt’ was not declared in this scope
lt.loadtexture();
^~
CMakeFiles/mageengine.dir/build.make:62: recipe for target 'CMakeFiles/mageengine.dir/Mafic/mafic.cpp.o' failed
make[2]: *** [CMakeFiles/mageengine.dir/Mafic/mafic.cpp.o] Error 1
CMakeFiles/Makefile2:75: recipe for target 'CMakeFiles/mageengine.dir/all' failed
make[1]: *** [CMakeFiles/mageengine.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
aaron#Zog:~/Desktop/maficengine/build$

trouble building trilininos using cmake

I am trying to build trilinos in fedora25 guest (virtualbox). Followed procedure described here:
http://iltabiai.github.io/peridynamics/fedora/tips/2016/04/20/Peridigm141-Fedora23.html
I had to adapt the build script from above link so that it could find Netcdf and HDF5 on my system.
trilinos builds with these errors in CMakeError.log :
Performing C++ SOURCE FILE Test FINITE_VALUE_HAVE_GLOBAL_ISNAN failed with the following output:
Change Dir: /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_44df3/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_44df3.dir/build.make CMakeFiles/cmTC_44df3.dir/build
gmake[1]: Entering directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_44df3.dir/src.cxx.o
/usr/lib64/mpich/bin/mpicxx -O2 -ansi -pedantic -ftrapv -Wall -Wno-long-long -std=c++11 -DFINITE_VALUE_HAVE_GLOBAL_ISNAN -o CMakeFiles/cmTC_44df3.dir/src.cxx.o -c /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx: In function ‘int main()’:
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:6:10: error: ‘isnan’ was not declared in this scope
isnan(x);
^
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:6:10: note: suggested alternative:
In file included from /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:2:0:
/usr/include/c++/6.3.1/cmath:662:5: note: ‘std::isnan’
isnan(_Tp __x)
^~~~~
CMakeFiles/cmTC_44df3.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_44df3.dir/src.cxx.o' failed
gmake[1]: *** [CMakeFiles/cmTC_44df3.dir/src.cxx.o] Error 1
gmake[1]: Leaving directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_44df3/fast' failed
gmake: *** [cmTC_44df3/fast] Error 2
Source file was:
#include <cmath>
int main()
{
double x = 1.0;
isnan(x);
return 0;
}
Performing C++ SOURCE FILE Test FINITE_VALUE_HAVE_GLOBAL_ISINF failed with the following output:
Change Dir: /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_4cb6e/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_4cb6e.dir/build.make CMakeFiles/cmTC_4cb6e.dir/build
gmake[1]: Entering directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_4cb6e.dir/src.cxx.o
/usr/lib64/mpich/bin/mpicxx -O2 -ansi -pedantic -ftrapv -Wall -Wno-long-long -std=c++11 -DFINITE_VALUE_HAVE_GLOBAL_ISINF -o CMakeFiles/cmTC_4cb6e.dir/src.cxx.o -c /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx: In function ‘int main()’:
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:6:10: error: ‘isinf’ was not declared in this scope
isinf(x);
^
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:6:10: note: suggested alternative:
In file included from /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:2:0:
/usr/include/c++/6.3.1/cmath:635:5: note: ‘std::isinf’
isinf(_Tp __x)
^~~~~
CMakeFiles/cmTC_4cb6e.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_4cb6e.dir/src.cxx.o' failed
gmake[1]: *** [CMakeFiles/cmTC_4cb6e.dir/src.cxx.o] Error 1
gmake[1]: Leaving directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_4cb6e/fast' failed
gmake: *** [cmTC_4cb6e/fast] Error 2
Source file was:
#include <cmath>
int main()
{
double x = 1.0;
isinf(x);
return 0;
}
Determining if the pthread_create exist failed with the following output:
Change Dir: /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_78ecb/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_78ecb.dir/build.make CMakeFiles/cmTC_78ecb.dir/build
gmake[1]: Entering directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_78ecb.dir/CheckSymbolExists.c.o
/usr/lib64/mpich/bin/mpicc -o CMakeFiles/cmTC_78ecb.dir/CheckSymbolExists.c.o -c /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_78ecb
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_78ecb.dir/link.txt --verbose=1
/usr/lib64/mpich/bin/mpicc -rdynamic CMakeFiles/cmTC_78ecb.dir/CheckSymbolExists.c.o -o cmTC_78ecb
/usr/bin/ld: CMakeFiles/cmTC_78ecb.dir/CheckSymbolExists.c.o: undefined reference to symbol 'pthread_create##GLIBC_2.2.5'
/usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_78ecb.dir/build.make:97: recipe for target 'cmTC_78ecb' failed
gmake[1]: *** [cmTC_78ecb] Error 1
gmake[1]: Leaving directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_78ecb/fast' failed
gmake: *** [cmTC_78ecb/fast] Error 2
File /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef pthread_create
return ((int*)(&pthread_create))[argc];
#else
(void)argc;
return 0;
#endif
}
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_5fb6c/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_5fb6c.dir/build.make CMakeFiles/cmTC_5fb6c.dir/build
gmake[1]: Entering directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_5fb6c.dir/CheckFunctionExists.c.o
/usr/lib64/mpich/bin/mpicc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_5fb6c.dir/CheckFunctionExists.c.o -c /usr/share/cmake/Modules/CheckFunctionExists.c
Linking C executable cmTC_5fb6c
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_5fb6c.dir/link.txt --verbose=1
/usr/lib64/mpich/bin/mpicc -DCHECK_FUNCTION_EXISTS=pthread_create -rdynamic CMakeFiles/cmTC_5fb6c.dir/CheckFunctionExists.c.o -o cmTC_5fb6c -lpthreads
/usr/bin/ld: cannot find -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_5fb6c.dir/build.make:97: recipe for target 'cmTC_5fb6c' failed
gmake[1]: *** [cmTC_5fb6c] Error 1
gmake[1]: Leaving directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_5fb6c/fast' failed
gmake: *** [cmTC_5fb6c/fast] Error 2
Performing C++ SOURCE FILE Test HAVE_TEUCHOS_LAPACKLARND failed with the following output:
Change Dir: /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_93b6d/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_93b6d.dir/build.make CMakeFiles/cmTC_93b6d.dir/build
gmake[1]: Entering directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_93b6d.dir/src.cxx.o
/usr/lib64/mpich/bin/mpicxx -O2 -ansi -pedantic -ftrapv -Wall -Wno-long-long -std=c++11 -DHAVE_TEUCHOS_LAPACKLARND -o CMakeFiles/cmTC_93b6d.dir/src.cxx.o -c /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx: In function ‘int main()’:
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:12:38: error: narrowing conversion of ‘0.0’ from ‘double’ to ‘int’ inside { } [-Wnarrowing]
int seed[4] = { 0.0, 0.0, 0.0, 1.0 };
^
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:12:38: error: narrowing conversion of ‘0.0’ from ‘double’ to ‘int’ inside { } [-Wnarrowing]
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:12:38: error: narrowing conversion of ‘0.0’ from ‘double’ to ‘int’ inside { } [-Wnarrowing]
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:12:38: error: narrowing conversion of ‘1.0e+0’ from ‘double’ to ‘int’ inside { } [-Wnarrowing]
CMakeFiles/cmTC_93b6d.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_93b6d.dir/src.cxx.o' failed
gmake[1]: *** [CMakeFiles/cmTC_93b6d.dir/src.cxx.o] Error 1
gmake[1]: Leaving directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_93b6d/fast' failed
gmake: *** [cmTC_93b6d/fast] Error 2
Return value: 1
Source file was:
#define F77_BLAS_MANGLE(name,NAME) name ## _
#define DLARND_F77 F77_BLAS_MANGLE(dlarnd,DLARND)
extern "C" { double DLARND_F77(const int* idist, int* seed); }
int main()
{
const int idist = 1;
int seed[4] = { 0.0, 0.0, 0.0, 1.0 };
double val = DLARND_F77(&idist, seed);
return (val < 0.0 ? 1 : 0);
}
Performing C++ SOURCE FILE Test HAVE_CXX_PRAGMA_WEAK failed with the following output:
Change Dir: /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/gmake" "cmTC_21bab/fast"
/usr/bin/gmake -f CMakeFiles/cmTC_21bab.dir/build.make CMakeFiles/cmTC_21bab.dir/build
gmake[1]: Entering directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Building CXX object CMakeFiles/cmTC_21bab.dir/src.cxx.o
/usr/lib64/mpich/bin/mpicxx -O2 -ansi -pedantic -ftrapv -Wall -Wno-long-long -std=c++11 -DHAVE_CXX_PRAGMA_WEAK -o CMakeFiles/cmTC_21bab.dir/src.cxx.o -c /home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx: In function ‘int main()’:
/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp/src.cxx:14:22: warning: the address of ‘void A::theFunction()’ will never be NULL [-Waddress]
if (A::theFunction != NULL) {
^
Linking CXX executable cmTC_21bab
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_21bab.dir/link.txt --verbose=1
/usr/lib64/mpich/bin/mpicxx -O2 -ansi -pedantic -ftrapv -Wall -Wno-long-long -std=c++11 -DHAVE_CXX_PRAGMA_WEAK -rdynamic CMakeFiles/cmTC_21bab.dir/src.cxx.o -o cmTC_21bab
CMakeFiles/cmTC_21bab.dir/src.cxx.o: In function `main':
src.cxx:(.text.startup+0x25): undefined reference to `A::theFunction()'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_21bab.dir/build.make:97: recipe for target 'cmTC_21bab' failed
gmake[1]: *** [cmTC_21bab] Error 1
gmake[1]: Leaving directory '/home/peri/packages/trilinos-12.10.1-Source/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_21bab/fast' failed
gmake: *** [cmTC_21bab/fast] Error 2
Source file was:
#include <iostream>
namespace A {
// theFunction never gets defined, because we
// don't link with a library that defines it.
// That's OK, because it's weak linkage.
#pragma weak theFunction
extern void theFunction ();
}
int main() {
std::cout << "Hi! I am main." << std::endl;
if (A::theFunction != NULL) {
// Should never be called, since we don't link
// with a library that defines A::theFunction.
A::theFunction ();
}
return 0;
}
how can these errors be eliminated?

undefined reference to `png_set_longjmp_fn' when compiling PCL source file

I am trying to install PCL from source file, but I have this error " undefined reference to `png_set_longjmp_fn'". I have searched a lot but can't find a solution.
Other info.: Now, in my computer, I have installed both libpng1.6 and libpng1.2. I can't remove libpng1.2 because other application depends on it.
Scanning dependencies of target pcl_io_ply
Scanning dependencies of target pcl_pcd_convert_NaN_nan
Scanning dependencies of target pcl_people
Scanning dependencies of target pcl_octree
Scanning dependencies of target pcl_common
[ 1%] Building CXX object io/CMakeFiles/pcl_io_ply.dir/src/ply/ply_parser.cpp.o
[ 1%] [ 1%] Building CXX object io/tools/CMakeFiles/pcl_pcd_convert_NaN_nan.dir/pcd_convert_NaN_nan.cpp.o
Building CXX object people/CMakeFiles/pcl_people.dir/src/hog.cpp.o
[ 1%] Building CXX object octree/CMakeFiles/pcl_octree.dir/src/octree_inst.cpp.o
[ 2%] [ 2%] [ 2%] [ 2%] Building CXX object common/CMakeFiles/pcl_common.dir/src/io.cpp.o
Building CXX object common/CMakeFiles/pcl_common.dir/src/common.cpp.o
Building CXX object common/CMakeFiles/pcl_common.dir/src/pcl_base.cpp.o
Building CXX object common/CMakeFiles/pcl_common.dir/src/point_types.cpp.o
Linking CXX executable ../../bin/pcl_pcd_convert_NaN_nan
[ 2%] Built target pcl_pcd_convert_NaN_nan
[ 3%] Building CXX object common/CMakeFiles/pcl_common.dir/src/correspondence.cpp.o
Linking CXX shared library ../lib/libpcl_people.so
[ 3%] Built target pcl_people
[ 3%] Building CXX object common/CMakeFiles/pcl_common.dir/src/distances.cpp.o
[ 3%] Building CXX object common/CMakeFiles/pcl_common.dir/src/parse.cpp.o
[ 3%] Building CXX object common/CMakeFiles/pcl_common.dir/src/poses_from_matches.cpp.o
[ 4%] Building CXX object common/CMakeFiles/pcl_common.dir/src/print.cpp.o
[ 4%] Building CXX object common/CMakeFiles/pcl_common.dir/src/projection_matrix.cpp.o
[ 4%] Building CXX object common/CMakeFiles/pcl_common.dir/src/time_trigger.cpp.o
[ 5%] Building CXX object common/CMakeFiles/pcl_common.dir/src/gaussian.cpp.o
[ 5%] Building CXX object common/CMakeFiles/pcl_common.dir/src/bearing_angle_image.cpp.o
[ 5%] Building CXX object common/CMakeFiles/pcl_common.dir/src/range_image.cpp.o
[ 5%] Building CXX object common/CMakeFiles/pcl_common.dir/src/range_image_planar.cpp.o
[ 6%] Building C object common/CMakeFiles/pcl_common.dir/src/fft/kiss_fft.c.o
[ 6%] Building C object common/CMakeFiles/pcl_common.dir/src/fft/kiss_fftr.c.o
Linking CXX shared library ../lib/libpcl_io_ply.so
[ 6%] Built target pcl_io_ply
Scanning dependencies of target pcl_ply2obj
Scanning dependencies of target pcl_ply2raw
Scanning dependencies of target pcl_ply2ply
Scanning dependencies of target pcl_plyheader
[ 7%] [ 7%] [ 7%] [ 7%] Building CXX object io/tools/ply/CMakeFiles/pcl_ply2obj.dir/ply2obj.cpp.o
Building CXX object io/tools/ply/CMakeFiles/pcl_ply2raw.dir/ply2raw.cpp.o
Building CXX object io/tools/ply/CMakeFiles/pcl_ply2ply.dir/ply2ply.cpp.o
Building CXX object io/tools/ply/CMakeFiles/pcl_plyheader.dir/plyheader.cpp.o
Linking CXX executable ../../../bin/pcl_plyheader
[ 7%] Built target pcl_plyheader
Linking CXX shared library ../lib/libpcl_common.so
[ 7%] Built target pcl_common
Scanning dependencies of target pcl_kdtree
Scanning dependencies of target pcl_sample_consensus
Scanning dependencies of target pcl_io
Scanning dependencies of target pcl_example_check_if_point_is_valid
[ 7%] [ 7%] Building CXX object kdtree/CMakeFiles/pcl_kdtree.dir/src/kdtree_flann.cpp.o
Building CXX object examples/common/CMakeFiles/pcl_example_check_if_point_is_valid.dir/example_check_if_point_is_valid.cpp.o
[ 7%] Building CXX object sample_consensus/CMakeFiles/pcl_sample_consensus.dir/src/sac.cpp.o
[ 7%] Building CXX object io/CMakeFiles/pcl_io.dir/src/debayer.cpp.o
[ 7%] Building CXX object io/CMakeFiles/pcl_io.dir/src/pcd_grabber.cpp.o
Linking CXX executable ../../../bin/pcl_ply2obj
[ 7%] Built target pcl_ply2obj
Scanning dependencies of target pcl_example_copy_point_cloud
[ 7%] Building CXX object examples/common/CMakeFiles/pcl_example_copy_point_cloud.dir/example_copy_point_cloud.cpp.o
Linking CXX executable ../../bin/pcl_example_check_if_point_is_valid
Linking CXX executable ../../../bin/pcl_ply2raw
[ 7%] Built target pcl_example_check_if_point_is_valid
Scanning dependencies of target pcl_example_organized_point_cloud
[ 7%] Built target pcl_ply2raw
[ 7%] [ 8%] Building CXX object examples/common/CMakeFiles/pcl_example_organized_point_cloud.dir/example_organized_point_cloud.cpp.o
Building CXX object io/CMakeFiles/pcl_io.dir/src/pcd_io.cpp.o
Linking CXX executable ../../bin/pcl_example_copy_point_cloud
[ 8%] Built target pcl_example_copy_point_cloud
Scanning dependencies of target pcl_example_scope_time
[ 9%] Building CXX object examples/common/CMakeFiles/pcl_example_scope_time.dir/example_scope_time.cpp.o
Linking CXX executable ../../../bin/pcl_ply2ply
[ 9%] Built target pcl_ply2ply
[ 10%] Building CXX object sample_consensus/CMakeFiles/pcl_sample_consensus.dir/src/sac_model_circle.cpp.o
Linking CXX executable ../../bin/pcl_example_organized_point_cloud
[ 10%] Built target pcl_example_organized_point_cloud
Scanning dependencies of target pcl_example_half_edge_mesh
[ 10%] Building CXX object examples/geometry/CMakeFiles/pcl_example_half_edge_mesh.dir/example_half_edge_mesh.cpp.o
Linking CXX executable ../../bin/pcl_example_scope_time
[ 10%] Built target pcl_example_scope_time
[ 10%] Building CXX object io/CMakeFiles/pcl_io.dir/src/vtk_io.cpp.o
Linking CXX executable ../../bin/pcl_example_half_edge_mesh
[ 10%] Built target pcl_example_half_edge_mesh
[ 10%] Building CXX object io/CMakeFiles/pcl_io.dir/src/ply_io.cpp.o
[ 11%] Building CXX object io/CMakeFiles/pcl_io.dir/src/ascii_io.cpp.o
[ 11%] Building CXX object io/CMakeFiles/pcl_io.dir/src/compression.cpp.o
[ 11%] Building CXX object io/CMakeFiles/pcl_io.dir/src/lzf.cpp.o
[ 11%] Building CXX object io/CMakeFiles/pcl_io.dir/src/lzf_image_io.cpp.o
[ 12%] Building CXX object io/CMakeFiles/pcl_io.dir/src/obj_io.cpp.o
Linking CXX shared library ../lib/libpcl_octree.so
[ 12%] Built target pcl_octree
[ 12%] Building CXX object io/CMakeFiles/pcl_io.dir/src/ifs_io.cpp.o
[ 12%] Building CXX object io/CMakeFiles/pcl_io.dir/src/image_grabber.cpp.o
[ 12%] Building CXX object io/CMakeFiles/pcl_io.dir/src/hdl_grabber.cpp.o
[ 13%] Building CXX object io/CMakeFiles/pcl_io.dir/src/robot_eye_grabber.cpp.o
[ 13%] Building CXX object sample_consensus/CMakeFiles/pcl_sample_consensus.dir/src/sac_model_circle3d.cpp.o
[ 13%] Building CXX object io/CMakeFiles/pcl_io.dir/src/file_io.cpp.o
[ 13%] Building CXX object io/CMakeFiles/pcl_io.dir/src/io_exception.cpp.o
Linking CXX shared library ../lib/libpcl_kdtree.so
[ 14%] Building CXX object io/CMakeFiles/pcl_io.dir/src/vtk_lib_io.cpp.o
[ 14%] Built target pcl_kdtree
Scanning dependencies of target pcl_search
[ 14%] Building CXX object search/CMakeFiles/pcl_search.dir/src/search.cpp.o
[ 14%] Building CXX object sample_consensus/CMakeFiles/pcl_sample_consensus.dir/src/sac_model_cylinder.cpp.o
[ 14%] Building CXX object io/CMakeFiles/pcl_io.dir/src/png_io.cpp.o
[ 14%] Building CXX object io/CMakeFiles/pcl_io.dir/src/image_rgb24.cpp.o
[ 14%] Building CXX object io/CMakeFiles/pcl_io.dir/src/image_yuv422.cpp.o
[ 15%] Building CXX object io/CMakeFiles/pcl_io.dir/src/image_ir.cpp.o
[ 15%] Building CXX object io/CMakeFiles/pcl_io.dir/src/image_depth.cpp.o
[ 15%] Building CXX object io/CMakeFiles/pcl_io.dir/src/dinast_grabber.cpp.o
[ 15%] Building CXX object io/CMakeFiles/pcl_io.dir/src/libpng_wrapper.cpp.o
[ 15%] Building CXX object search/CMakeFiles/pcl_search.dir/src/kdtree.cpp.o
[ 15%] Building CXX object search/CMakeFiles/pcl_search.dir/src/brute_force.cpp.o
[ 16%] Building CXX object search/CMakeFiles/pcl_search.dir/src/organized.cpp.o
[ 16%] Building CXX object search/CMakeFiles/pcl_search.dir/src/octree.cpp.o
[ 16%] Building CXX object sample_consensus/CMakeFiles/pcl_sample_consensus.dir/src/sac_model_cone.cpp.o
Linking CXX shared library ../lib/libpcl_io.so
[ 17%] Building CXX object sample_consensus/CMakeFiles/pcl_sample_consensus.dir/src/sac_model_line.cpp.o
[ 17%] Built target pcl_io
Scanning dependencies of target pcl_convert_pcd_ascii_binary
[ 17%] Building CXX object io/tools/CMakeFiles/pcl_convert_pcd_ascii_binary.dir/convert_pcd_ascii_binary.cpp.o
Scanning dependencies of target pcl_hdl_grabber
[ 17%] Building CXX object io/tools/CMakeFiles/pcl_hdl_grabber.dir/hdl_grabber_example.cpp.o
[ 17%] Building CXX object sample_consensus/CMakeFiles/pcl_sample_consensus.dir/src/sac_model_stick.cpp.o
[ 17%] Building CXX object sample_consensus/CMakeFiles/pcl_sample_consensus.dir/src/sac_model_normal_parallel_plane.cpp.o
Linking CXX executable ../../bin/pcl_convert_pcd_ascii_binary
../../lib/libpcl_io.so.1.7.2: undefined reference to `png_set_longjmp_fn'
collect2: error: ld returned 1 exit status
io/tools/CMakeFiles/pcl_convert_pcd_ascii_binary.dir/build.make:215: recipe for target 'bin/pcl_convert_pcd_ascii_binary' failed
make[2]: *** [bin/pcl_convert_pcd_ascii_binary] Error 1
CMakeFiles/Makefile2:565: recipe for target 'io/tools/CMakeFiles/pcl_convert_pcd_ascii_binary.dir/all' failed
make[1]: *** [io/tools/CMakeFiles/pcl_convert_pcd_ascii_binary.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 18%] Building CXX object sample_consensus/CMakeFiles/pcl_sample_consensus.dir/src/sac_model_normal_plane.cpp.o
Linking CXX executable ../../bin/pcl_hdl_grabber
../../lib/libpcl_io.so.1.7.2: undefined reference to `png_set_longjmp_fn'
collect2: error: ld returned 1 exit status
io/tools/CMakeFiles/pcl_hdl_grabber.dir/build.make:215: recipe for target 'bin/pcl_hdl_grabber' failed
make[2]: *** [bin/pcl_hdl_grabber] Error 1
CMakeFiles/Makefile2:602: recipe for target 'io/tools/CMakeFiles/pcl_hdl_grabber.dir/all' failed
make[1]: *** [io/tools/CMakeFiles/pcl_hdl_grabber.dir/all] Error 2
[ 18%] Building CXX object sample_consensus/CMakeFiles/pcl_sample_consensus.dir/src/sac_model_normal_sphere.cpp.o
Linking CXX shared library ../lib/libpcl_search.so
[ 18%] Building CXX object sample_consensus/CMakeFiles/pcl_sample_consensus.dir/src/sac_model_plane.cpp.o
[ 18%] Built target pcl_search
[ 18%] Building CXX object sample_consensus/CMakeFiles/pcl_sample_consensus.dir/src/sac_model_registration.cpp.o
[ 19%] Building CXX object sample_consensus/CMakeFiles/pcl_sample_consensus.dir/src/sac_model_sphere.cpp.o
Linking CXX shared library ../lib/libpcl_sample_consensus.so
[ 19%] Built target pcl_sample_consensus
Makefile:146: recipe for target 'all' failed
make: *** [all] Error 2
This modification in CMakeLists.txt(check PCL source folder) have worked in my case. (which is from CMake compile options for libpng). You should use below cmake configuration instead of original one.
# LibPNG
option(WITH_PNG "PNG file support" TRUE)
if(WITH_PNG)
# search for pkg-config
include (FindPkgConfig)
if (NOT PKG_CONFIG_FOUND)
message (FATAL_ERROR "pkg-config not found")
endif ()
# check for libpng
pkg_check_modules (LIBPNG libpng16 REQUIRED)
if (NOT LIBPNG_FOUND)
message(FATAL_ERROR "You don't seem to have libpng16 development libraries installed")
else ()
include_directories (${LIBPNG_INCLUDE_DIRS})
link_directories (${LIBPNG_LIBRARY_DIRS})
link_libraries (${LIBPNG_LIBRARIES})
endif ()
endif(WITH_PNG)