CMake with external projects adds LDFLAGS too early - cmake

Cmake on my project uses external projects. I want to recompile everything, but I want to pass -llikwid flag too all linking commands, including all external project. I exported LDFLAGS="-llikwid", but it's not working. The LDFLAGS gets added too early, and linking fails. If I add -llikwid manually at the end of the linking command, then linking succeeds.
Here is how the linking line looks like when linking fails:
$ /usr/bin/c++ -DLIKWID_PERFMON -O2 -g -DNDEBUG -llikwid -Wl,-z,noexecstack -Wl,-z,relro,-z,now -pie -Wl,--exclude-libs,libz.a -Wl,--exclude-libs,libzmq.a -Wl,--exclude-libs,libvtkFiltersGeneral-9.1.a -Wl,--exclude-libs,libvtkFiltersCore-9.1.a -Wl,--exclude-libs,libvtkCommonExecutionModel-9.1.a -Wl,--exclude-libs,libvtkCommonDataModel-9.1.a -Wl,--exclude-libs,libvtkCommonTransforms-9.1.a -Wl,--exclude-libs,libvtkCommonMath-9.1.a -Wl,--exclude-libs,libvtkCommonMisc-9.1.a -Wl,--exclude-libs,libvtkCommonSystem-9.1.a -Wl,--exclude-libs,libvtkCommonCore-9.1.a -Wl,--exclude-libs,libvtkkissfft-9.1.a -Wl,--exclude-libs,libvtkpugixml-9.1.a -Wl,--exclude-libs,libvtksys-9.1.a -Wl,--exclude-libs,libmkl_merged.a -Wl,--exclude-libs,libtbb_static.a -Wl,--exclude-libs,libippiw.a -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libembree3.a -Wl,--exclude-libs,libembree_avx.a -Wl,--exclude-libs,libembree_avx2.a -Wl,--exclude-libs,libsimd.a -Wl,--exclude-libs,liblexers.a -Wl,--exclude-libs,libsys.a -Wl,--exclude-libs,libmath.a -Wl,--exclude-libs,libtasking.a CMakeFiles/ManuallyCropGeometry.dir/ManuallyCropGeometry.cpp.o -o ../../bin/ManuallyCropGeometry ../../lib/RelWithDebInfo/libOpen3D.a -lstdc++fs ../../assimp/lib/libassimp.a ../../turbojpeg/lib/libturbojpeg.a ../../jsoncpp/lib/libjsoncpp.a ../../lib/RelWithDebInfo/libOpen3D_3rdparty_liblzf.a ../../curl/src/ext_curl/lib/libcurl.a ../../boringssl/src/ext_boringssl/lib/libssl.a ../../boringssl/src/ext_boringssl/lib/libcrypto.a ../../libpng/lib/libpng16.a ../../zlib/lib/libz.a ../../lib/RelWithDebInfo/libOpen3D_3rdparty_rply.a ../../lib/RelWithDebInfo/libOpen3D_3rdparty_tinyfiledialogs.a ../../lib/RelWithDebInfo/libOpen3D_3rdparty_qhullcpp.a ../../lib/RelWithDebInfo/libOpen3D_3rdparty_qhull_r.a ../../zeromq/lib/libzmq.a ../../vtk/src/ext_vtk/lib/libvtkFiltersGeneral-9.1.a ../../vtk/src/ext_vtk/lib/libvtkFiltersCore-9.1.a ../../vtk/src/ext_vtk/lib/libvtkCommonExecutionModel-9.1.a ../../vtk/src/ext_vtk/lib/libvtkCommonDataModel-9.1.a ../../vtk/src/ext_vtk/lib/libvtkCommonTransforms-9.1.a ../../vtk/src/ext_vtk/lib/libvtkCommonMath-9.1.a ../../vtk/src/ext_vtk/lib/libvtkCommonMisc-9.1.a ../../vtk/src/ext_vtk/lib/libvtkCommonSystem-9.1.a ../../vtk/src/ext_vtk/lib/libvtkCommonCore-9.1.a ../../vtk/src/ext_vtk/lib/libvtkkissfft-9.1.a ../../vtk/src/ext_vtk/lib/libvtkpugixml-9.1.a ../../vtk/src/ext_vtk/lib/libvtksys-9.1.a ../../mkl_install/lib/libtbbmalloc_static.a ../../mkl_install/lib/libmkl_merged.a ../../mkl_install/lib/libtbb_static.a ../../embree/lib/libembree3.a ../../embree/lib/libembree_avx.a ../../embree/lib/libembree_avx2.a ../../embree/lib/libsimd.a ../../embree/lib/liblexers.a ../../embree/lib/libsys.a ../../embree/lib/libmath.a ../../embree/lib/libtasking.a /usr/lib/gcc/x86_64-linux-gnu/11/libgomp.so /usr/lib/x86_64-linux-gnu/libpthread.a ../../ippicv/lib/libippiw.a ../../ippicv/lib/libippicv.a ../../lib/RelWithDebInfo/libOpen3D_3rdparty_glew.a -lstdc++fs ../../lib/RelWithDebInfo/libglfw3.a /usr/lib/x86_64-linux-gnu/librt.a -lm -ldl /usr/lib/x86_64-linux-gnu/libX11.so ../../fmt/lib/libfmt.a /usr/lib/x86_64-linux-gnu/libGL.so
/usr/bin/ld: ../../lib/RelWithDebInfo/libOpen3D.a(KDTreeFlann.cpp.o): in function `bool nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Adaptor<double, nanoflann::KDTreeEigenMatrixAdaptor<Eigen::Map<Eigen::Matrix<double, -1, -1, 0, -1, -1> const, 0, Eigen::Stride<0, 0> >, -1, nanoflann::metric_L2, false>, double>, nanoflann::KDTreeEigenMatrixAdaptor<Eigen::Map<Eigen::Matrix<double, -1, -1, 0, -1, -1> const, 0, Eigen::Stride<0, 0> >, -1, nanoflann::metric_L2, false>, -1, long>::findNeighbors<nanoflann::KNNResultSet<double, long, unsigned long> >(nanoflann::KNNResultSet<double, long, unsigned long>&, double const*, nanoflann::SearchParams const&) const':
/home/ivica/Projects/Open3D/build/nanoflann/src/ext_nanoflann/include/nanoflann.hpp:1239: undefined reference to `likwid_markerStartRegion'
/usr/bin/ld: /home/ivica/Projects/Open3D/build/nanoflann/src/ext_nanoflann/include/nanoflann.hpp:1243: undefined reference to `likwid_markerStopRegion'
/usr/bin/ld: ../../lib/RelWithDebInfo/libOpen3D.a(KDTreeFlann.cpp.o): in function `bool nanoflann::KDTreeSingleIndexAdaptor<nanoflann::L2_Adaptor<double, nanoflann::KDTreeEigenMatrixAdaptor<Eigen::Map<Eigen::Matrix<double, -1, -1, 0, -1, -1> const, 0, Eigen::Stride<0, 0> >, -1, nanoflann::metric_L2, false>, double>, nanoflann::KDTreeEigenMatrixAdaptor<Eigen::Map<Eigen::Matrix<double, -1, -1, 0, -1, -1> const, 0, Eigen::Stride<0, 0> >, -1, nanoflann::metric_L2, false>, -1, long>::findNeighbors<nanoflann::RadiusResultSet<double, long> >(nanoflann::RadiusResultSet<double, long>&, double const*, nanoflann::SearchParams const&) const':
/home/ivica/Projects/Open3D/build/nanoflann/src/ext_nanoflann/include/nanoflann.hpp:1239: undefined reference to `likwid_markerStartRegion'
/usr/bin/ld: /home/ivica/Projects/Open3D/build/nanoflann/src/ext_nanoflann/include/nanoflann.hpp:1243: undefined reference to `likwid_markerStopRegion'
/usr/bin/ld: /home/ivica/Projects/Open3D/build/nanoflann/src/ext_nanoflann/include/nanoflann.hpp:1239: undefined reference to `likwid_markerStartRegion'
/usr/bin/ld: /home/ivica/Projects/Open3D/build/nanoflann/src/ext_nanoflann/include/nanoflann.hpp:1243: undefined reference to `likwid_markerStopRegion'
Here is it when linking succeds (notice the position of -llikwid).
$ /usr/bin/c++ -DLIKWID_PERFMON -O2 -g -DNDEBUG -Wl,-z,noexecstack -Wl,-z,relro,-z,now -pie -Wl,--exclude-libs,libz.a -Wl,--exclude-libs,libzmq.a -Wl,--exclude-libs,libvtkFiltersGeneral-9.1.a -Wl,--exclude-libs,libvtkFiltersCore-9.1.a -Wl,--exclude-libs,libvtkCommonExecutionModel-9.1.a -Wl,--exclude-libs,libvtkCommonDataModel-9.1.a -Wl,--exclude-libs,libvtkCommonTransforms-9.1.a -Wl,--exclude-libs,libvtkCommonMath-9.1.a -Wl,--exclude-libs,libvtkCommonMisc-9.1.a -Wl,--exclude-libs,libvtkCommonSystem-9.1.a -Wl,--exclude-libs,libvtkCommonCore-9.1.a -Wl,--exclude-libs,libvtkkissfft-9.1.a -Wl,--exclude-libs,libvtkpugixml-9.1.a -Wl,--exclude-libs,libvtksys-9.1.a -Wl,--exclude-libs,libmkl_merged.a -Wl,--exclude-libs,libtbb_static.a -Wl,--exclude-libs,libippiw.a -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libembree3.a -Wl,--exclude-libs,libembree_avx.a -Wl,--exclude-libs,libembree_avx2.a -Wl,--exclude-libs,libsimd.a -Wl,--exclude-libs,liblexers.a -Wl,--exclude-libs,libsys.a -Wl,--exclude-libs,libmath.a -Wl,--exclude-libs,libtasking.a CMakeFiles/ManuallyCropGeometry.dir/ManuallyCropGeometry.cpp.o -o ../../bin/ManuallyCropGeometry ../../lib/RelWithDebInfo/libOpen3D.a -lstdc++fs ../../assimp/lib/libassimp.a ../../turbojpeg/lib/libturbojpeg.a ../../jsoncpp/lib/libjsoncpp.a ../../lib/RelWithDebInfo/libOpen3D_3rdparty_liblzf.a ../../curl/src/ext_curl/lib/libcurl.a ../../boringssl/src/ext_boringssl/lib/libssl.a ../../boringssl/src/ext_boringssl/lib/libcrypto.a ../../libpng/lib/libpng16.a ../../zlib/lib/libz.a ../../lib/RelWithDebInfo/libOpen3D_3rdparty_rply.a ../../lib/RelWithDebInfo/libOpen3D_3rdparty_tinyfiledialogs.a ../../lib/RelWithDebInfo/libOpen3D_3rdparty_qhullcpp.a ../../lib/RelWithDebInfo/libOpen3D_3rdparty_qhull_r.a ../../zeromq/lib/libzmq.a ../../vtk/src/ext_vtk/lib/libvtkFiltersGeneral-9.1.a ../../vtk/src/ext_vtk/lib/libvtkFiltersCore-9.1.a ../../vtk/src/ext_vtk/lib/libvtkCommonExecutionModel-9.1.a ../../vtk/src/ext_vtk/lib/libvtkCommonDataModel-9.1.a ../../vtk/src/ext_vtk/lib/libvtkCommonTransforms-9.1.a ../../vtk/src/ext_vtk/lib/libvtkCommonMath-9.1.a ../../vtk/src/ext_vtk/lib/libvtkCommonMisc-9.1.a ../../vtk/src/ext_vtk/lib/libvtkCommonSystem-9.1.a ../../vtk/src/ext_vtk/lib/libvtkCommonCore-9.1.a ../../vtk/src/ext_vtk/lib/libvtkkissfft-9.1.a ../../vtk/src/ext_vtk/lib/libvtkpugixml-9.1.a ../../vtk/src/ext_vtk/lib/libvtksys-9.1.a ../../mkl_install/lib/libtbbmalloc_static.a ../../mkl_install/lib/libmkl_merged.a ../../mkl_install/lib/libtbb_static.a ../../embree/lib/libembree3.a ../../embree/lib/libembree_avx.a ../../embree/lib/libembree_avx2.a ../../embree/lib/libsimd.a ../../embree/lib/liblexers.a ../../embree/lib/libsys.a ../../embree/lib/libmath.a ../../embree/lib/libtasking.a /usr/lib/gcc/x86_64-linux-gnu/11/libgomp.so /usr/lib/x86_64-linux-gnu/libpthread.a ../../ippicv/lib/libippiw.a ../../ippicv/lib/libippicv.a ../../lib/RelWithDebInfo/libOpen3D_3rdparty_glew.a -lstdc++fs ../../lib/RelWithDebInfo/libglfw3.a /usr/lib/x86_64-linux-gnu/librt.a -lm -ldl /usr/lib/x86_64-linux-gnu/libX11.so ../../fmt/lib/libfmt.a /usr/lib/x86_64-linux-gnu/libGL.so -llikwid
How can I fix this?

Related

gstreamer linking error (when using gstglfilter)

When I build my gstreamer project using CMake I use the following CmakeLists.txt:
cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 20)
include(FetchContent)
project(someproject)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GST REQUIRED gstreamer-1.0>=1.4
gstreamer-sdp-1.0>=1.4
gstreamer-video-1.0>=1.4
gstreamer-plugins-base-1.0>=1.4
gstreamer-app-1.0>=1.4
gstreamer-gl-1.0>=1.4)
#some other calls to find_package
add_library(someproject "")
#add source directories
target_include_directories(GUI_lib PUBLIC include "${OTHER_FIND_PACKAGE_INCLUDE_DIRS}"
"${GST_INCLUDE_DIRS}")
target_link_libraries(someproject PUBLIC "${OTHER_FIND_PACKAGE_LIBS}" "${GST_LIBRARIES}" -lGL -lepoxy)
This results in the following error:
in function `drawCallback(_GstElement*, unsigned int, unsigned int, unsigned int, void*)':
undefined reference to `gst_gl_filter_get_type'
undefined reference to `gst_gl_filter_draw_fullscreen_quad'
I have searched my gstreamer install and verified that there exists a shared library that defines these symbols using the following snippet (asterisks for emphasis):
% readelf -s --wide /usr/lib/gstreamer-1.0/libgstopengl.so | rg gl_filter
121: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gst_gl_filter_render_to_target_with_shader
* 242: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gst_gl_filter_draw_fullscreen_quad
305: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gst_gl_filter_add_rgba_pad_templates
421: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gst_gl_filter_render_to_target
* 447: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gst_gl_filter_get_type
470: 0000000000000000 0 FUNC GLOBAL DEFAULT UND gst_gl_filter_filter_texture
So, I added the following to my CMake file:
add_library(gstopenglextras SHARED IMPORTED)
set_target_properties(gstopenglextras PROPERTIES
IMPORTED_LOCATION "/usr/lib/gstreamer-1.0/libgstopengl.so")
I also changed the target_link_libraries call to:
target_link_libraries(someproject PUBLIC "${OTHER_FIND_PACKAGE_LIBS}" gstopenglextras "${GST_LIBRARIES}" -lGL -lepoxy)
Now I get the following linker error:
/usr/bin/ld: undefined reference to symbol 'gst_gl_filter_get_type'
/usr/bin/ld: /usr/lib/libgstgl-1.0.so.0: error adding symbols: DSO missing from command line
I've read some stuff on circular dependencies and I've tried adding "${GST_LIBRARIES}" before gstopenglextras. However, this does not change the error.
Any ideas?
target_link_libraries(
someproject
PUBLIC
"${OTHER_FIND_PACKAGE_LIBS}"
gstopenglextras
"${GST_LIBRARIES}"
-lGL
-lepoxy
gstgl-1.0
glib-2.0
gmodule-2.0
)
is the call you need to fix this issue.

adding gRPC dependency to Rocksdb's CMakeLists

I'm trying to use gRPC directly in rocksdb's source code
LogAndApplyClient log_and_apply_client(grpc::CreateChannel(
secondary, grpc::InsecureChannelCredentials()));
log_and_apply_client is a basically class I wrote used for making rpcs calls, and it depends on the Stub Code generated by Protobuf. And I'm adding it directly into rocksdb's source code.
To resolve the grpc dependency, I'm adding dependency into rocksdb's CMakeLists.txt file using the CMakeLists example provided by the gRPC.
I installed gRPC and protobuf in Ubuntu18.04 and this is what I added to rocksdb's CMakeLists.
This basically finds grpc and protobuf's installation
# This branch assumes that gRPC and all its dependencies are already installed
# on this system, so they can be located by find_package().
# Find Protobuf installation
# Looks for protobuf-config.cmake file installed by Protobuf's cmake installation.
set(protobuf_MODULE_COMPATIBLE TRUE)
find_package(Protobuf CONFIG REQUIRED)
message(STATUS "Using protobuf ${Protobuf_VERSION}")
set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf)
set(_REFLECTION gRPC::grpc++_reflection)
if(CMAKE_CROSSCOMPILING)
find_program(_PROTOBUF_PROTOC protoc)
else()
set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
endif()
# Find gRPC installation
# Looks for gRPCConfig.cmake file installed by gRPC's cmake installation.
find_package(gRPC CONFIG REQUIRED)
message(STATUS "Using gRPC ${gRPC_VERSION}")
set(_GRPC_GRPCPP gRPC::grpc++)
if(CMAKE_CROSSCOMPILING)
find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin)
else()
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
endif()
Linking the rocksdb with grpc, protobuf
add_library(${ROCKSDB_STATIC_LIB} STATIC ${SOURCES})
target_link_libraries(${ROCKSDB_STATIC_LIB} PRIVATE
${THIRDPARTY_LIBS} ${SYSTEM_LIBS}
${_REFLECTION}
${_GRPC_GRPCPP}
${_PROTOBUF_LIBPROTOBUF}
)
The Rocksdb compiles fine without error, but When I'm trying to use the compiled rocksdb library, It gives me a bunch of undefined reference.
mnt/sdb/my_rocksdb/librocksdb.a(version_set.cc.o): In function `__static_initialization_and_destruction_0(int, int)':
/mnt/sdb/my_rocksdb/db/version_set.cc:4325: undefined reference to `grpc::InsecureChannelCredentials()'
/mnt/sdb/my_rocksdb/db/version_set.cc:4324: undefined reference to `grpc::CreateChannel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::shared_ptr<grpc::ChannelCredentials> const&)'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o): In function `logapply::Response::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/mnt/sdb/my_rocksdb/rubble/logAndApply/logAndApply.pb.cc:468: undefined reference to `google::protobuf::internal::UnknownFieldParse(unsigned long, google::protobuf::UnknownFieldSet*, char const*, google::protobuf::internal::ParseContext*)'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o): In function `logapply::Response::_InternalSerialize(unsigned char*, google::protobuf::io::EpsCopyOutputStream*) const':
/mnt/sdb/my_rocksdb/rubble/logAndApply/logAndApply.pb.cc:497: undefined reference to `google::protobuf::UnknownFieldSet::default_instance()'
/mnt/sdb/my_rocksdb/rubble/logAndApply/logAndApply.pb.cc:497: undefined reference to `google::protobuf::internal::WireFormat::InternalSerializeUnknownFieldsToArray(google::protobuf::UnknownFieldSet const&, unsigned char*, google::protobuf::io::EpsCopyOutputStream*)'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o): In function `logapply::Response::ByteSizeLong() const':
/mnt/sdb/my_rocksdb/rubble/logAndApply/logAndApply.pb.cc:519: undefined reference to `google::protobuf::internal::ComputeUnknownFieldsSize(google::protobuf::internal::InternalMetadata const&, unsigned long, google::protobuf::internal::CachedSize*)'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o): In function `logapply::Response::MergeFrom(google::protobuf::Message const&)':
/mnt/sdb/my_rocksdb/rubble/logAndApply/logAndApply.pb.cc:534: undefined reference to `google::protobuf::internal::ReflectionOps::Merge(google::protobuf::Message const&, google::protobuf::Message*)'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o): In function `logapply::EditLists_EditList_VersionEdit::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/mnt/sdb/my_rocksdb/rubble/logAndApply/logAndApply.pb.cc:705: undefined reference to `google::protobuf::internal::UnknownFieldParse(unsigned long, google::protobuf::UnknownFieldSet*, char const*, google::protobuf::internal::ParseContext*)'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o): In function `logapply::EditLists_EditList_VersionEdit::_InternalSerialize(unsigned char*, google::protobuf::io::EpsCopyOutputStream*) const':
/mnt/sdb/my_rocksdb/rubble/logAndApply/logAndApply.pb.cc:744: undefined reference to `google::protobuf::UnknownFieldSet::default_instance()'
/mnt/sdb/my_rocksdb/rubble/logAndApply/logAndApply.pb.cc:744: undefined reference to `google::protobuf::internal::WireFormat::InternalSerializeUnknownFieldsToArray(google::protobuf::UnknownFieldSet const&, unsigned char*, google::protobuf::io::EpsCopyOutputStream*)'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o): In function `logapply::EditLists::MergeFrom(google::protobuf::Message const&)':
/mnt/sdb/my_rocksdb/rubble/logAndApply/logAndApply.pb.cc:1206: undefined reference to `google::protobuf::internal::ReflectionOps::Merge(google::protobuf::Message const&, google::protobuf::Message*)'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o): In function `logapply::NewFile_FileMetaData_FileDescriptor::_InternalParse(char const*, google::protobuf::internal::ParseContext*)':
/mnt/sdb/my_rocksdb/rubble/logAndApply/logAndApply.pb.cc:1378: undefined reference to `google::protobuf::internal::UnknownFieldParse(unsigned long, google::protobuf::UnknownFieldSet*, char const*, google::protobuf::internal::ParseContext*)'
/root/local/include/google/protobuf/unknown_field_set.h:312: undefined reference to `google::protobuf::UnknownFieldSet::ClearFallback()'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o): In function `google::protobuf::Message::Message()':
/root/local/include/google/protobuf/message.h:230: undefined reference to `vtable for google::protobuf::Message'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o): In function `google::protobuf::Message::Message(google::protobuf::Arena*)':
/root/local/include/google/protobuf/message.h:362: undefined reference to `vtable for google::protobuf::Message'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o): In function `logapply::Response::GetMetadataStatic()':
/mnt/sdb/my_rocksdb/rubble/logAndApply/logAndApply.pb.h:207: undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const*, bool)'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o): In function `logapply::EditLists_EditList_VersionEdit::GetMetadataStatic()':
/mnt/sdb/my_rocksdb/rubble/logAndApply/logAndApply.pb.h:344: undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const*, bool)'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o): In function `logapply::EditLists_EditList::GetMetadataStatic()':
/mnt/sdb/my_rocksdb/rubble/logAndApply/logAndApply.pb.h:510: undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const*, bool)'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o): In function `logapply::EditLists::GetMetadataStatic()':
/mnt/sdb/my_rocksdb/rubble/logAndApply/logAndApply.pb.h:658: undefined reference to `google::protobuf::internal::AssignDescriptors(google::protobuf::internal::DescriptorTable const*, bool)'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o):(.data.rel.ro._ZTVN8logapply20NewFile_FileMetaDataE[_ZTVN8logapply20NewFile_FileMetaDataE]+0x98): undefined reference to `google::protobuf::Message::SpaceUsedLong() const'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o):(.data.rel.ro._ZTVN8logapply35NewFile_FileMetaData_FileDescriptorE[_ZTVN8logapply35NewFile_FileMetaData_FileDescriptorE]+0x20): undefined reference to `google::protobuf::Message::GetTypeName[abi:cxx11]() const'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o):(.data.rel.ro._ZTVN8logapply35NewFile_FileMetaData_FileDescriptorE[_ZTVN8logapply35NewFile_FileMetaData_FileDescriptorE]+0x48): undefined reference to `google::protobuf::Message::InitializationErrorString[abi:cxx11]() const'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o):(.data.rel.ro._ZTVN8logapply35NewFile_FileMetaData_FileDescriptorE[_ZTVN8logapply35NewFile_FileMetaData_FileDescriptorE]+0x50): undefined reference to `google::protobuf::Message::CheckTypeAndMergeFrom(google::protobuf::MessageLite const&)'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o):(.data.rel.ro._ZTVN8logapply35NewFile_FileMetaData_FileDescriptorE[_ZTVN8logapply35NewFile_FileMetaData_FileDescriptorE]+0x90): undefined reference to `google::protobuf::Message::DiscardUnknownFields()'
(.data.rel.ro._ZTIN8logapply20NewFile_FileMetaDataE[_ZTIN8logapply20NewFile_FileMetaDataE]+0x10): undefined reference to `typeinfo for google::protobuf::Message'
/mnt/sdb/my_rocksdb/librocksdb.a(logAndApply.pb.cc.o):(.data.rel.ro._ZTIN8logapply35NewFile_FileMetaData_FileDescriptorE[_ZTIN8logapply35NewFile_FileMetaData_FileDescriptorE]+0x10): more undefined references to `typeinfo for google::protobuf::Message' follow
collect2: error: ld returned 1 exit status
CMakeFiles/primary_server.dir/build.make:143: recipe for target 'primary_server' failed
make[2]: *** [primary_server] Error 1
CMakeFiles/Makefile2:98: recipe for target 'CMakeFiles/primary_server.dir/all' failed
make[1]: *** [CMakeFiles/primary_server.dir/all] Error 2
Makefile:102: recipe for target 'all' failed
make: *** [all] Error 2
This is the CMakeLists file I wrote for my client program which uses the rocksdb library object
# Proto file
get_filename_component(kv_proto "../protos/keyvaluestore.proto" ABSOLUTE)
get_filename_component(kv_proto_path "${kv_proto}" PATH)
# Generated sources
set(kv_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/keyvaluestore.pb.cc")
set(kv_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/keyvaluestore.pb.h")
set(kv_grpc_srcs "${CMAKE_CURRENT_BINARY_DIR}/keyvaluestore.grpc.pb.cc")
set(kv_grpc_hdrs "${CMAKE_CURRENT_BINARY_DIR}/keyvaluestore.grpc.pb.h")
add_custom_command(
OUTPUT "${kv_proto_srcs}" "${kv_proto_hdrs}" "${kv_grpc_srcs}" "${kv_grpc_hdrs}"
COMMAND ${_PROTOBUF_PROTOC}
ARGS --grpc_out "${CMAKE_CURRENT_BINARY_DIR}"
--cpp_out "${CMAKE_CURRENT_BINARY_DIR}"
-I "${kv_proto_path}"
--plugin=protoc-gen-grpc="${_GRPC_CPP_PLUGIN_EXECUTABLE}"
"${kv_proto}"
DEPENDS "${kv_proto}")
# Include generated *.pb.h files
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
include_directories(/mnt/sdb/my_rocksdb/include)
link_directories(/mnt/sdb/my_rocksdb)
# kv_grpc_proto
add_library(kv_grpc_proto
${kv_grpc_srcs}
${kv_grpc_hdrs}
${kv_proto_srcs}
${kv_proto_hdrs})
target_link_libraries(kv_grpc_proto
${_REFLECTION}
${_GRPC_GRPCPP}
${_PROTOBUF_LIBPROTOBUF}
)
# Targets greeter_[async_](client|server)
foreach(_target
kv_store_client
primary_server
)
add_executable(${_target} "${_target}.cc")
target_link_libraries(${_target}
kv_grpc_proto
${_REFLECTION}
${_GRPC_GRPCPP}
${_PROTOBUF_LIBPROTOBUF}
liblog_and_apply_grpc_proto.a
librocksdb.a
)
endforeach()
I'm not quite familiar with cmake, I think I didn't get it right when I'm trying to add the dependency into rocksdb's source code and I'm really kind of stuck on this, so any suggestions will be appreciated !
The linker output seems is not linking libprotobuf.a and libgrpcpp.a
[100%] Linking CXX static library librocksdb.a
/usr/local/bin/cmake -P CMakeFiles/rocksdb.dir/cmake_clean_target.cmake
/usr/local/bin/cmake -E cmake_link_script CMakeFiles/rocksdb.dir/link.txt --verbose=1
/usr/bin/ar qc librocksdb.a CMakeFiles/rocksdb.dir/cache/cache.cc.o CMakeFiles/rocksdb.dir/cache/clock_cache.cc.o CMakeFiles/rocksdb.dir/cache/lru_cache.cc.o CMakeFiles/rocksdb.dir/cache/sharded_cache.cc.o CMakeFiles/rocksdb.dir/db/arena_wrapped_db_iter.cc.o CMakeFiles/rocksdb.dir/db/blob/blob_file_addition.cc.o CMakeFiles/rocksdb.dir/db/blob/blob_file_builder.cc.o CMakeFiles/rocksdb.dir/db/blob/blob_file_cache.cc.o CMakeFiles/rocksdb.dir/db/blob/blob_file_garbage.cc.o CMakeFiles/rocksdb.dir/db/blob/blob_file_meta.cc.o CMakeFiles/rocksdb.dir/db/blob/blob_file_reader.cc.o CMakeFiles/rocksdb.dir/db/blob/blob_log_format.cc.o CMakeFiles/rocksdb.dir/db/blob/blob_log_sequential_reader.cc.o CMakeFiles/rocksdb.dir/db/blob/blob_log_writer.cc.o CMakeFiles/rocksdb.dir/db/builder.cc.o CMakeFiles/rocksdb.dir/db/c.cc.o CMakeFiles/rocksdb.dir/db/column_family.cc.o CMakeFiles/rocksdb.dir/db/compacted_db_impl.cc.o CMakeFiles/rocksdb.dir/db/compaction/compaction.cc.o CMakeFiles/rocksdb.dir/db/compaction/compaction_iterator.cc.o CMakeFiles/rocksdb.dir/db/compaction/compaction_picker.cc.o CMakeFiles/rocksdb.dir/db/compaction/compaction_job.cc.o CMakeFiles/rocksdb.dir/db/compaction/compaction_picker_fifo.cc.o CMakeFiles/rocksdb.dir/db/compaction/compaction_picker_level.cc.o CMakeFiles/rocksdb.dir/db/compaction/compaction_picker_universal.cc.o CMakeFiles/rocksdb.dir/db/compaction/sst_partitioner.cc.o CMakeFiles/rocksdb.dir/db/convenience.cc.o CMakeFiles/rocksdb.dir/db/db_filesnapshot.cc.o CMakeFiles/rocksdb.dir/db/db_impl/db_impl.cc.o CMakeFiles/rocksdb.dir/db/db_impl/db_impl_write.cc.o CMakeFiles/rocksdb.dir/db/db_impl/db_impl_compaction_flush.cc.o CMakeFiles/rocksdb.dir/db/db_impl/db_impl_files.cc.o CMakeFiles/rocksdb.dir/db/db_impl/db_impl_open.cc.o CMakeFiles/rocksdb.dir/db/db_impl/db_impl_debug.cc.o CMakeFiles/rocksdb.dir/db/db_impl/db_impl_experimental.cc.o CMakeFiles/rocksdb.dir/db/db_impl/db_impl_readonly.cc.o CMakeFiles/rocksdb.dir/db/db_impl/db_impl_secondary.cc.o CMakeFiles/rocksdb.dir/db/db_info_dumper.cc.o CMakeFiles/rocksdb.dir/db/db_iter.cc.o CMakeFiles/rocksdb.dir/db/dbformat.cc.o CMakeFiles/rocksdb.dir/db/error_handler.cc.o CMakeFiles/rocksdb.dir/db/event_helpers.cc.o CMakeFiles/rocksdb.dir/db/experimental.cc.o CMakeFiles/rocksdb.dir/db/external_sst_file_ingestion_job.cc.o CMakeFiles/rocksdb.dir/db/file_indexer.cc.o CMakeFiles/rocksdb.dir/db/flush_job.cc.o CMakeFiles/rocksdb.dir/db/flush_scheduler.cc.o CMakeFiles/rocksdb.dir/db/forward_iterator.cc.o CMakeFiles/rocksdb.dir/db/import_column_family_job.cc.o CMakeFiles/rocksdb.dir/db/internal_stats.cc.o CMakeFiles/rocksdb.dir/db/logs_with_prep_tracker.cc.o CMakeFiles/rocksdb.dir/db/log_reader.cc.o CMakeFiles/rocksdb.dir/db/log_writer.cc.o CMakeFiles/rocksdb.dir/db/malloc_stats.cc.o CMakeFiles/rocksdb.dir/db/memtable.cc.o CMakeFiles/rocksdb.dir/db/memtable_list.cc.o CMakeFiles/rocksdb.dir/db/merge_helper.cc.o CMakeFiles/rocksdb.dir/db/merge_operator.cc.o CMakeFiles/rocksdb.dir/db/output_validator.cc.o CMakeFiles/rocksdb.dir/db/periodic_work_scheduler.cc.o CMakeFiles/rocksdb.dir/db/range_del_aggregator.cc.o CMakeFiles/rocksdb.dir/db/range_tombstone_fragmenter.cc.o CMakeFiles/rocksdb.dir/db/repair.cc.o CMakeFiles/rocksdb.dir/db/snapshot_impl.cc.o CMakeFiles/rocksdb.dir/db/table_cache.cc.o CMakeFiles/rocksdb.dir/db/table_properties_collector.cc.o CMakeFiles/rocksdb.dir/db/transaction_log_impl.cc.o CMakeFiles/rocksdb.dir/db/trim_history_scheduler.cc.o CMakeFiles/rocksdb.dir/db/version_builder.cc.o CMakeFiles/rocksdb.dir/db/version_edit.cc.o CMakeFiles/rocksdb.dir/db/version_edit_handler.cc.o CMakeFiles/rocksdb.dir/db/version_set.cc.o CMakeFiles/rocksdb.dir/db/wal_edit.cc.o CMakeFiles/rocksdb.dir/db/wal_manager.cc.o CMakeFiles/rocksdb.dir/db/write_batch.cc.o CMakeFiles/rocksdb.dir/db/write_batch_base.cc.o CMakeFiles/rocksdb.dir/db/write_controller.cc.o CMakeFiles/rocksdb.dir/db/write_thread.cc.o CMakeFiles/rocksdb.dir/env/env.cc.o CMakeFiles/rocksdb.dir/env/env_chroot.cc.o CMakeFiles/rocksdb.dir/env/env_encryption.cc.o CMakeFiles/rocksdb.dir/env/env_hdfs.cc.o CMakeFiles/rocksdb.dir/env/file_system.cc.o CMakeFiles/rocksdb.dir/env/file_system_tracer.cc.o CMakeFiles/rocksdb.dir/env/mock_env.cc.o CMakeFiles/rocksdb.dir/file/delete_scheduler.cc.o CMakeFiles/rocksdb.dir/file/file_prefetch_buffer.cc.o CMakeFiles/rocksdb.dir/file/file_util.cc.o CMakeFiles/rocksdb.dir/file/filename.cc.o CMakeFiles/rocksdb.dir/file/random_access_file_reader.cc.o CMakeFiles/rocksdb.dir/file/read_write_util.cc.o CMakeFiles/rocksdb.dir/file/readahead_raf.cc.o CMakeFiles/rocksdb.dir/file/sequence_file_reader.cc.o CMakeFiles/rocksdb.dir/file/sst_file_manager_impl.cc.o CMakeFiles/rocksdb.dir/file/writable_file_writer.cc.o CMakeFiles/rocksdb.dir/logging/auto_roll_logger.cc.o CMakeFiles/rocksdb.dir/logging/event_logger.cc.o CMakeFiles/rocksdb.dir/logging/log_buffer.cc.o CMakeFiles/rocksdb.dir/memory/arena.cc.o CMakeFiles/rocksdb.dir/memory/concurrent_arena.cc.o CMakeFiles/rocksdb.dir/memory/jemalloc_nodump_allocator.cc.o CMakeFiles/rocksdb.dir/memory/memkind_kmem_allocator.cc.o CMakeFiles/rocksdb.dir/memtable/alloc_tracker.cc.o CMakeFiles/rocksdb.dir/memtable/hash_linklist_rep.cc.o CMakeFiles/rocksdb.dir/memtable/hash_skiplist_rep.cc.o CMakeFiles/rocksdb.dir/memtable/skiplistrep.cc.o CMakeFiles/rocksdb.dir/memtable/vectorrep.cc.o CMakeFiles/rocksdb.dir/memtable/write_buffer_manager.cc.o CMakeFiles/rocksdb.dir/monitoring/histogram.cc.o CMakeFiles/rocksdb.dir/monitoring/histogram_windowing.cc.o CMakeFiles/rocksdb.dir/monitoring/in_memory_stats_history.cc.o CMakeFiles/rocksdb.dir/monitoring/instrumented_mutex.cc.o CMakeFiles/rocksdb.dir/monitoring/iostats_context.cc.o CMakeFiles/rocksdb.dir/monitoring/perf_context.cc.o CMakeFiles/rocksdb.dir/monitoring/perf_level.cc.o CMakeFiles/rocksdb.dir/monitoring/persistent_stats_history.cc.o CMakeFiles/rocksdb.dir/monitoring/statistics.cc.o CMakeFiles/rocksdb.dir/monitoring/thread_status_impl.cc.o CMakeFiles/rocksdb.dir/monitoring/thread_status_updater.cc.o CMakeFiles/rocksdb.dir/monitoring/thread_status_util.cc.o CMakeFiles/rocksdb.dir/monitoring/thread_status_util_debug.cc.o CMakeFiles/rocksdb.dir/options/cf_options.cc.o CMakeFiles/rocksdb.dir/options/configurable.cc.o CMakeFiles/rocksdb.dir/options/db_options.cc.o CMakeFiles/rocksdb.dir/options/options.cc.o CMakeFiles/rocksdb.dir/options/options_helper.cc.o CMakeFiles/rocksdb.dir/options/options_parser.cc.o CMakeFiles/rocksdb.dir/port/stack_trace.cc.o CMakeFiles/rocksdb.dir/table/adaptive/adaptive_table_factory.cc.o CMakeFiles/rocksdb.dir/table/block_based/binary_search_index_reader.cc.o CMakeFiles/rocksdb.dir/table/block_based/block.cc.o CMakeFiles/rocksdb.dir/table/block_based/block_based_filter_block.cc.o CMakeFiles/rocksdb.dir/table/block_based/block_based_table_builder.cc.o CMakeFiles/rocksdb.dir/table/block_based/block_based_table_factory.cc.o CMakeFiles/rocksdb.dir/table/block_based/block_based_table_iterator.cc.o CMakeFiles/rocksdb.dir/table/block_based/block_based_table_reader.cc.o CMakeFiles/rocksdb.dir/table/block_based/block_builder.cc.o CMakeFiles/rocksdb.dir/table/block_based/block_prefetcher.cc.o CMakeFiles/rocksdb.dir/table/block_based/block_prefix_index.cc.o CMakeFiles/rocksdb.dir/table/block_based/data_block_hash_index.cc.o CMakeFiles/rocksdb.dir/table/block_based/data_block_footer.cc.o CMakeFiles/rocksdb.dir/table/block_based/filter_block_reader_common.cc.o CMakeFiles/rocksdb.dir/table/block_based/filter_policy.cc.o CMakeFiles/rocksdb.dir/table/block_based/flush_block_policy.cc.o CMakeFiles/rocksdb.dir/table/block_based/full_filter_block.cc.o CMakeFiles/rocksdb.dir/table/block_based/hash_index_reader.cc.o CMakeFiles/rocksdb.dir/table/block_based/index_builder.cc.o CMakeFiles/rocksdb.dir/table/block_based/index_reader_common.cc.o CMakeFiles/rocksdb.dir/table/block_based/parsed_full_filter_block.cc.o CMakeFiles/rocksdb.dir/table/block_based/partitioned_filter_block.cc.o CMakeFiles/rocksdb.dir/table/block_based/partitioned_index_iterator.cc.o CMakeFiles/rocksdb.dir/table/block_based/partitioned_index_reader.cc.o CMakeFiles/rocksdb.dir/table/block_based/reader_common.cc.o CMakeFiles/rocksdb.dir/table/block_based/uncompression_dict_reader.cc.o CMakeFiles/rocksdb.dir/table/block_fetcher.cc.o CMakeFiles/rocksdb.dir/table/cuckoo/cuckoo_table_builder.cc.o CMakeFiles/rocksdb.dir/table/cuckoo/cuckoo_table_factory.cc.o CMakeFiles/rocksdb.dir/table/cuckoo/cuckoo_table_reader.cc.o CMakeFiles/rocksdb.dir/table/format.cc.o CMakeFiles/rocksdb.dir/table/get_context.cc.o CMakeFiles/rocksdb.dir/table/iterator.cc.o CMakeFiles/rocksdb.dir/table/merging_iterator.cc.o CMakeFiles/rocksdb.dir/table/meta_blocks.cc.o CMakeFiles/rocksdb.dir/table/persistent_cache_helper.cc.o CMakeFiles/rocksdb.dir/table/plain/plain_table_bloom.cc.o CMakeFiles/rocksdb.dir/table/plain/plain_table_builder.cc.o CMakeFiles/rocksdb.dir/table/plain/plain_table_factory.cc.o CMakeFiles/rocksdb.dir/table/plain/plain_table_index.cc.o CMakeFiles/rocksdb.dir/table/plain/plain_table_key_coding.cc.o CMakeFiles/rocksdb.dir/table/plain/plain_table_reader.cc.o CMakeFiles/rocksdb.dir/table/sst_file_dumper.cc.o CMakeFiles/rocksdb.dir/table/sst_file_reader.cc.o CMakeFiles/rocksdb.dir/table/sst_file_writer.cc.o CMakeFiles/rocksdb.dir/table/table_factory.cc.o CMakeFiles/rocksdb.dir/table/table_properties.cc.o CMakeFiles/rocksdb.dir/table/two_level_iterator.cc.o CMakeFiles/rocksdb.dir/test_util/sync_point.cc.o CMakeFiles/rocksdb.dir/test_util/sync_point_impl.cc.o CMakeFiles/rocksdb.dir/test_util/testutil.cc.o CMakeFiles/rocksdb.dir/test_util/transaction_test_util.cc.o CMakeFiles/rocksdb.dir/tools/block_cache_analyzer/block_cache_trace_analyzer.cc.o CMakeFiles/rocksdb.dir/tools/dump/db_dump_tool.cc.o CMakeFiles/rocksdb.dir/tools/io_tracer_parser_tool.cc.o CMakeFiles/rocksdb.dir/tools/ldb_cmd.cc.o CMakeFiles/rocksdb.dir/tools/ldb_tool.cc.o CMakeFiles/rocksdb.dir/tools/sst_dump_tool.cc.o CMakeFiles/rocksdb.dir/tools/trace_analyzer_tool.cc.o CMakeFiles/rocksdb.dir/trace_replay/trace_replay.cc.o CMakeFiles/rocksdb.dir/trace_replay/block_cache_tracer.cc.o CMakeFiles/rocksdb.dir/trace_replay/io_tracer.cc.o CMakeFiles/rocksdb.dir/util/coding.cc.o CMakeFiles/rocksdb.dir/util/compaction_job_stats_impl.cc.o CMakeFiles/rocksdb.dir/util/comparator.cc.o CMakeFiles/rocksdb.dir/util/compression_context_cache.cc.o CMakeFiles/rocksdb.dir/util/concurrent_task_limiter_impl.cc.o CMakeFiles/rocksdb.dir/util/crc32c.cc.o CMakeFiles/rocksdb.dir/util/dynamic_bloom.cc.o CMakeFiles/rocksdb.dir/util/hash.cc.o CMakeFiles/rocksdb.dir/util/murmurhash.cc.o CMakeFiles/rocksdb.dir/util/random.cc.o CMakeFiles/rocksdb.dir/util/rate_limiter.cc.o CMakeFiles/rocksdb.dir/util/slice.cc.o CMakeFiles/rocksdb.dir/util/file_checksum_helper.cc.o CMakeFiles/rocksdb.dir/util/status.cc.o CMakeFiles/rocksdb.dir/util/string_util.cc.o CMakeFiles/rocksdb.dir/util/thread_local.cc.o CMakeFiles/rocksdb.dir/util/threadpool_imp.cc.o CMakeFiles/rocksdb.dir/util/xxhash.cc.o CMakeFiles/rocksdb.dir/utilities/backupable/backupable_db.cc.o CMakeFiles/rocksdb.dir/utilities/blob_db/blob_compaction_filter.cc.o CMakeFiles/rocksdb.dir/utilities/blob_db/blob_db.cc.o CMakeFiles/rocksdb.dir/utilities/blob_db/blob_db_impl.cc.o CMakeFiles/rocksdb.dir/utilities/blob_db/blob_db_impl_filesnapshot.cc.o CMakeFiles/rocksdb.dir/utilities/blob_db/blob_dump_tool.cc.o CMakeFiles/rocksdb.dir/utilities/blob_db/blob_file.cc.o CMakeFiles/rocksdb.dir/utilities/cassandra/cassandra_compaction_filter.cc.o CMakeFiles/rocksdb.dir/utilities/cassandra/format.cc.o CMakeFiles/rocksdb.dir/utilities/cassandra/merge_operator.cc.o CMakeFiles/rocksdb.dir/utilities/checkpoint/checkpoint_impl.cc.o CMakeFiles/rocksdb.dir/utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc.o CMakeFiles/rocksdb.dir/utilities/debug.cc.o CMakeFiles/rocksdb.dir/utilities/env_mirror.cc.o CMakeFiles/rocksdb.dir/utilities/env_timed.cc.o CMakeFiles/rocksdb.dir/utilities/fault_injection_env.cc.o CMakeFiles/rocksdb.dir/utilities/fault_injection_fs.cc.o CMakeFiles/rocksdb.dir/utilities/leveldb_options/leveldb_options.cc.o CMakeFiles/rocksdb.dir/utilities/memory/memory_util.cc.o CMakeFiles/rocksdb.dir/utilities/merge_operators/bytesxor.cc.o CMakeFiles/rocksdb.dir/utilities/merge_operators/max.cc.o CMakeFiles/rocksdb.dir/utilities/merge_operators/put.cc.o CMakeFiles/rocksdb.dir/utilities/merge_operators/sortlist.cc.o CMakeFiles/rocksdb.dir/utilities/merge_operators/string_append/stringappend.cc.o CMakeFiles/rocksdb.dir/utilities/merge_operators/string_append/stringappend2.cc.o CMakeFiles/rocksdb.dir/utilities/merge_operators/uint64add.cc.o CMakeFiles/rocksdb.dir/utilities/object_registry.cc.o CMakeFiles/rocksdb.dir/utilities/option_change_migration/option_change_migration.cc.o CMakeFiles/rocksdb.dir/utilities/options/options_util.cc.o CMakeFiles/rocksdb.dir/utilities/persistent_cache/block_cache_tier.cc.o CMakeFiles/rocksdb.dir/utilities/persistent_cache/block_cache_tier_file.cc.o CMakeFiles/rocksdb.dir/utilities/persistent_cache/block_cache_tier_metadata.cc.o CMakeFiles/rocksdb.dir/utilities/persistent_cache/persistent_cache_tier.cc.o CMakeFiles/rocksdb.dir/utilities/persistent_cache/volatile_tier_impl.cc.o CMakeFiles/rocksdb.dir/utilities/simulator_cache/cache_simulator.cc.o CMakeFiles/rocksdb.dir/utilities/simulator_cache/sim_cache.cc.o CMakeFiles/rocksdb.dir/utilities/table_properties_collectors/compact_on_deletion_collector.cc.o CMakeFiles/rocksdb.dir/utilities/trace/file_trace_reader_writer.cc.o CMakeFiles/rocksdb.dir/utilities/transactions/lock/lock_manager.cc.o CMakeFiles/rocksdb.dir/utilities/transactions/lock/point/point_lock_tracker.cc.o CMakeFiles/rocksdb.dir/utilities/transactions/lock/point/point_lock_manager.cc.o CMakeFiles/rocksdb.dir/utilities/transactions/optimistic_transaction_db_impl.cc.o CMakeFiles/rocksdb.dir/utilities/transactions/optimistic_transaction.cc.o CMakeFiles/rocksdb.dir/utilities/transactions/pessimistic_transaction.cc.o CMakeFiles/rocksdb.dir/utilities/transactions/pessimistic_transaction_db.cc.o CMakeFiles/rocksdb.dir/utilities/transactions/snapshot_checker.cc.o CMakeFiles/rocksdb.dir/utilities/transactions/transaction_base.cc.o CMakeFiles/rocksdb.dir/utilities/transactions/transaction_db_mutex_impl.cc.o CMakeFiles/rocksdb.dir/utilities/transactions/transaction_util.cc.o CMakeFiles/rocksdb.dir/utilities/transactions/write_prepared_txn.cc.o CMakeFiles/rocksdb.dir/utilities/transactions/write_prepared_txn_db.cc.o CMakeFiles/rocksdb.dir/utilities/transactions/write_unprepared_txn.cc.o CMakeFiles/rocksdb.dir/utilities/transactions/write_unprepared_txn_db.cc.o CMakeFiles/rocksdb.dir/utilities/ttl/db_ttl_impl.cc.o CMakeFiles/rocksdb.dir/utilities/write_batch_with_index/write_batch_with_index.cc.o CMakeFiles/rocksdb.dir/utilities/write_batch_with_index/write_batch_with_index_internal.cc.o CMakeFiles/rocksdb.dir/rubble/logAndApply/logAndApply.grpc.pb.cc.o CMakeFiles/rocksdb.dir/rubble/logAndApply/logAndApply.pb.cc.o CMakeFiles/rocksdb.dir/port/port_posix.cc.o CMakeFiles/rocksdb.dir/env/env_posix.cc.o CMakeFiles/rocksdb.dir/env/fs_posix.cc.o CMakeFiles/rocksdb.dir/env/io_posix.cc.o CMakeFiles/rocksdb.dir/third-party/folly/folly/detail/Futex.cpp.o CMakeFiles/rocksdb.dir/third-party/folly/folly/synchronization/AtomicNotification.cpp.o CMakeFiles/rocksdb.dir/third-party/folly/folly/synchronization/DistributedMutex.cpp.o CMakeFiles/rocksdb.dir/third-party/folly/folly/synchronization/ParkingLot.cpp.o CMakeFiles/rocksdb.dir/third-party/folly/folly/synchronization/WaitOptions.cpp.o CMakeFiles/rocksdb.dir/logAndApply.grpc.pb.cc.o CMakeFiles/rocksdb.dir/logAndApply.pb.cc.o CMakeFiles/build_version.dir/build_version.cc.o
/usr/bin/ranlib librocksdb.a
doing a grep on the output on grpc and protobuf didn't give me the library... So linker somehow fails to find the lib, which is confusing to me cause I did a
target_link_libraries(${ROCKSDB_STATIC_LIB} PRIVATE
${THIRDPARTY_LIBS} ${SYSTEM_LIBS}
${_REFLECTION}
${_GRPC_GRPCPP}
${_PROTOBUF_LIBPROTOBUF}
)
in rocksdb's CMakeLists.

Tensorflow XLA AOT: Eigen related Error Building Project

I'm currently trying to work through the tensorflow XLA ahead of time compilation work flow for the first time, and I've hit a problem while trying to build the final executable binary which includes the AOT compiled object.
I've used the tutorial here to generate the test_graph_tfgather.pb and test_graph_tfgather.config.pbtxt files. Then I've used the tfcompile tool directly to produce MyClass.o and MyClass.h. So far so good.
I'm now building a simple makefile project which includes this compiled model, but I'm getting some errors related to Eigen. Could this be due to a different version of eigen3 being installed on my computer? I've also had to comment out the Eigen::ThreadPool lines due to eigen errors too so some version miss match may be the problem. Has anyone seen this problem before or does anyone have any ideas how to get this working?
Thanks.
The build errors:
g++ -c -std=c++11 -I . -I /usr/include/eigen3 -I /home/user/tensorflow_xla/tensorflow -I /usr/include main.cpp
In file included from /home/user/tensorflow_xla/tensorflow/tensorflow/compiler/xla/types.h:22:0,
from /home/user/tensorflow_xla/tensorflow/tensorflow/compiler/xla/executable_run_options.h:20,
from /home/user/tensorflow_xla/tensorflow/tensorflow/compiler/tf2xla/xla_compiled_cpu_function.h:22,
from MyClass.h:14,
from main.cpp:6:
/home/user/tensorflow_xla/tensorflow/tensorflow/core/framework/numeric_types.h: In static member function ‘static tensorflow::bfloat16 Eigen::NumTraits<tensorflow::bfloat16>::infinity()’:
/home/user/tensorflow_xla/tensorflow/tensorflow/core/framework/numeric_types.h:79:28: error: ‘infinity’ is not a member of ‘Eigen::NumTraits<float>’
return FloatToBFloat16(NumTraits<float>::infinity());
^
/home/user/tensorflow_xla/tensorflow/tensorflow/core/framework/numeric_types.h: In static member function ‘static tensorflow::bfloat16 Eigen::NumTraits<tensorflow::bfloat16>::quiet_NaN()’:
/home/user/tensorflow_xla/tensorflow/tensorflow/core/framework/numeric_types.h:83:28: error: ‘quiet_NaN’ is not a member of ‘Eigen::NumTraits<float>’
return FloatToBFloat16(NumTraits<float>::quiet_NaN());
^
/home/user/tensorflow_xla/tensorflow/tensorflow/core/framework/numeric_types.h: At global scope:
/home/user/tensorflow_xla/tensorflow/tensorflow/core/framework/numeric_types.h:95:34: error: ‘log’ is not a template function
const tensorflow::bfloat16& x) {
^
/home/user/tensorflow_xla/tensorflow/tensorflow/core/framework/numeric_types.h:101:34: error: ‘exp’ is not a template function
const tensorflow::bfloat16& x) {
^
/home/user/tensorflow_xla/tensorflow/tensorflow/core/framework/numeric_types.h:107:34: error: ‘abs’ is not a template function
const tensorflow::bfloat16& x) {
^
Makefile:10: recipe for target 'main.o' failed
main.cpp source:
#define EIGEN_USE_THREADS
#define EIGEN_USE_CUSTOM_THREAD_POOL
#include <iostream>
#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor"
#include "MyClass.h" // generated
int main(int argc, char** argv) {
//Eigen::ThreadPool tp(2); // Size the thread pool as appropriate.
//Eigen::ThreadPoolDevice device(&tp, tp.NumThreads());
MyClass matmul;
//matmul.set_thread_pool(&device);
// Set up args and run the computation.
const float args[12] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
std::copy(args + 0, args + 6, matmul.arg0_data());
std::copy(args + 6, args + 12, matmul.arg1_data());
matmul.Run();
// Check result
if (matmul.result0(0, 0) == 58) {
std::cout << "Success" << std::endl;
} else {
std::cout << "Failed. Expected value 58 at 0,0. Got:"
<< matmul.result0(0, 0) << std::endl;
}
return 0;
}
Makefile
EIGEN_INC=-I /usr/include/eigen3
TF_INC=-I /home/user/tensorflow_xla/tensorflow
CPPFLAGS=-c -std=c++11
xla_hw: main.o MyClass.o
g++ -o xla_hw main.o MyClass.o
main.o: main.cpp
g++ $(CPPFLAGS) -I . $(TF_INC) $(EIGEN_INC) -I /usr/include main.cpp
I've solved this problem now, it turns out there is a specific version of eigen3 included with tensorflow and you need to use this version for it to work. When tensorflow has been built the correct version of eigen3 is located at <tensorflow path>bazel-tensorflow/external/eigen_archive
Below is the working makefile which includes the correct Eigen path as well as the libraries needed to link the project.
TF_INC=-I /home/user/tensorflow_xla/tensorflow/bazel-tensorflow/external/eigen_archive -I /home/user/tensorflow_xla/tensorflow
TF_LIBS=-L/home/user/tensorflow_xla/tensorflow/bazel-bin/tensorflow/compiler/tf2xla/ -lxla_compiled_cpu_function -L/home/user/tensorflow_xla/tensorflow/bazel-bin/tensorflow/compiler/aot -lruntime
CPPFLAGS=-c -std=c++11
xla_hw: main.o MyClass.o
g++ -o xla_hw main.o MyClass.o $(TF_LIBS)
main.o: main.cpp
g++ $(CPPFLAGS) -I . $(TF_INC) -I /usr/include main.cpp

Which version of protocol buffers does TensorFlow 1.1 depend on?

It is unclear which version of protocol buffers TensorFlow 1.1 depends on.
The pip package built by TensorFlow 1.1 depends on protobuf >= 3.2.
The TensorFlow installation instructions for Ubuntu reference protobuf 3.1.
Furthermore, attempting to build TensorFlow 1.1 from source whilst using protobuf 3.1, 3.2, or 3.3 built from source fails.
I can build TensorFlow 1.1 from source as long as I allow it to build its own copy of protobuf but I would rather it used a common version if possible.
If I build protobuf 3.1 from source and then attempt to build TensorFlow 1.1 from source I get the following error:
ERROR: <snip>/.cache/bazel/_bazel_daniel/041a78b467f26d47aee0fcd68c1f3624/external/protobuf/BUILD:73:1: C++ compilation of rule '#protobuf//:protobuf_lite' failed: gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG ... (remaining 45 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
external/protobuf/src/google/protobuf/wire_format_lite.cc:393:67: error: no 'void google::protobuf::internal::WireFormatLite::WriteFloatArray(const float*, int, google::protobuf::io::CodedOutputStream*)' member function declared in class 'google::protobuf::internal::WireFormatLite'
io::CodedOutputStream* output) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:398:67: error: no 'void google::protobuf::internal::WireFormatLite::WriteDoubleArray(const double*, int, google::protobuf::io::CodedOutputStream*)' member function declared in class 'google::protobuf::internal::WireFormatLite'
io::CodedOutputStream* output) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:403:67: error: no 'void google::protobuf::internal::WireFormatLite::WriteFixed32Array(const uint32*, int, google::protobuf::io::CodedOutputStream*)' member function declared in class 'google::protobuf::internal::WireFormatLite'
io::CodedOutputStream* output) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:408:69: error: no 'void google::protobuf::internal::WireFormatLite::WriteFixed64Array(const uint64*, int, google::protobuf::io::CodedOutputStream*)' member function declared in class 'google::protobuf::internal::WireFormatLite'
io::CodedOutputStream* output) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:413:69: error: no 'void google::protobuf::internal::WireFormatLite::WriteSFixed32Array(const int32*, int, google::protobuf::io::CodedOutputStream*)' member function declared in class 'google::protobuf::internal::WireFormatLite'
io::CodedOutputStream* output) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:418:69: error: no 'void google::protobuf::internal::WireFormatLite::WriteSFixed64Array(const int64*, int, google::protobuf::io::CodedOutputStream*)' member function declared in class 'google::protobuf::internal::WireFormatLite'
io::CodedOutputStream* output) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:423:66: error: no 'void google::protobuf::internal::WireFormatLite::WriteBoolArray(const bool*, int, google::protobuf::io::CodedOutputStream*)' member function declared in class 'google::protobuf::internal::WireFormatLite'
io::CodedOutputStream* output) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc: In static member function 'static void google::protobuf::internal::WireFormatLite::WriteGroupMaybeToArray(int, const google::protobuf::MessageLite&, google::protobuf::io::CodedOutputStream*)':
external/protobuf/src/google/protobuf/wire_format_lite.cc:557:17: error: 'class google::protobuf::io::CodedOutputStream' has no member named 'IsSerializationDeterministic'
output->IsSerializationDeterministic(), target);
^
external/protobuf/src/google/protobuf/wire_format_lite.cc: In static member function 'static void google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(int, const google::protobuf::MessageLite&, google::protobuf::io::CodedOutputStream*)':
external/protobuf/src/google/protobuf/wire_format_lite.cc:574:17: error: 'class google::protobuf::io::CodedOutputStream' has no member named 'IsSerializationDeterministic'
output->IsSerializationDeterministic(), target);
^
external/protobuf/src/google/protobuf/wire_format_lite.cc: At global scope:
external/protobuf/src/google/protobuf/wire_format_lite.cc:739:8: error: prototype for 'size_t google::protobuf::internal::WireFormatLite::Int32Size(const google::protobuf::RepeatedField<int>&)' does not match any in class 'google::protobuf::internal::WireFormatLite'
size_t WireFormatLite::Int32Size(const RepeatedField<int32>& value) {
^
In file included from external/protobuf/src/google/protobuf/wire_format_lite.cc:35:0:
<snip>/source/protobuf/protobuf-3.1.0/inst/include/google/protobuf/wire_format_lite_inl.h:813:15: error: candidate is: static size_t google::protobuf::internal::WireFormatLite::Int32Size(google::protobuf::int32)
inline size_t WireFormatLite::Int32Size(int32 value) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:748:8: error: prototype for 'size_t google::protobuf::internal::WireFormatLite::UInt32Size(const google::protobuf::RepeatedField<unsigned int>&)' does not match any in class 'google::protobuf::internal::WireFormatLite'
size_t WireFormatLite::UInt32Size(const RepeatedField<uint32>& value) {
^
In file included from external/protobuf/src/google/protobuf/wire_format_lite.cc:35:0:
<snip>/source/protobuf/protobuf-3.1.0/inst/include/google/protobuf/wire_format_lite_inl.h:819:15: error: candidate is: static size_t google::protobuf::internal::WireFormatLite::UInt32Size(google::protobuf::uint32)
inline size_t WireFormatLite::UInt32Size(uint32 value) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:757:8: error: prototype for 'size_t google::protobuf::internal::WireFormatLite::SInt32Size(const google::protobuf::RepeatedField<int>&)' does not match any in class 'google::protobuf::internal::WireFormatLite'
size_t WireFormatLite::SInt32Size(const RepeatedField<int32>& value) {
^
In file included from external/protobuf/src/google/protobuf/wire_format_lite.cc:35:0:
<snip>/source/protobuf/protobuf-3.1.0/inst/include/google/protobuf/wire_format_lite_inl.h:825:15: error: candidate is: static size_t google::protobuf::internal::WireFormatLite::SInt32Size(google::protobuf::int32)
inline size_t WireFormatLite::SInt32Size(int32 value) {
^
external/protobuf/src/google/protobuf/wire_format_lite.cc:766:8: error: prototype for 'size_t google::protobuf::internal::WireFormatLite::EnumSize(const google::protobuf::RepeatedField<int>&)' does not match any in class 'google::protobuf::internal::WireFormatLite'
size_t WireFormatLite::EnumSize(const RepeatedField<int>& value) {
^
In file included from external/protobuf/src/google/protobuf/wire_format_lite.cc:35:0:
<snip>/source/protobuf/protobuf-3.1.0/inst/include/google/protobuf/wire_format_lite_inl.h:831:15: error: candidate is: static size_t google::protobuf::internal::WireFormatLite::EnumSize(int)
inline size_t WireFormatLite::EnumSize(int value) {
^
Target //tensorflow/tools/pip_package:build_pip_package failed to build
If I build protobuf 3.2 from source and then attempt to build TensorFlow 1.1 from source I get the following error:
ERROR: <snip>/.cache/bazel/_bazel_daniel/041a78b467f26d47aee0fcd68c1f3624/external/protobuf/BUILD:113:1: C++ compilation of rule '#protobuf//:protobuf' failed: gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG ... (remaining 43 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
external/protobuf/src/google/protobuf/util/json_util.cc:52:49: error: definition of implicitly-declared 'virtual google::protobuf::util::internal::ZeroCopyStreamByteSink::~ZeroCopyStreamByteSink()'
ZeroCopyStreamByteSink::~ZeroCopyStreamByteSink() {
^
external/protobuf/src/google/protobuf/util/json_util.cc: In member function 'virtual void google::protobuf::util::internal::ZeroCopyStreamByteSink::Append(const char*, size_t)':
external/protobuf/src/google/protobuf/util/json_util.cc:58:16: error: 'buffer_size_' was not declared in this scope
if (len <= buffer_size_) {
^
external/protobuf/src/google/protobuf/util/json_util.cc:59:14: error: 'buffer_' was not declared in this scope
memcpy(buffer_, bytes, len);
^
external/protobuf/src/google/protobuf/util/json_util.cc:64:12: error: 'buffer_' was not declared in this scope
memcpy(buffer_, bytes, buffer_size_);
^
external/protobuf/src/google/protobuf/util/json_util.cc:64:28: error: 'buffer_size_' was not declared in this scope
memcpy(buffer_, bytes, buffer_size_);
^
external/protobuf/src/google/protobuf/util/json_util.cc: In function 'google::protobuf::util::Status google::protobuf::util::BinaryToJsonStream(google::protobuf::util::TypeResolver*, const string&, google::protobuf::io::ZeroCopyInputStream*, google::protobuf::io::ZeroCopyOutputStream*, const google::protobuf::util::JsonPrintOptions&)':
external/protobuf/src/google/protobuf/util/json_util.cc:85:47: error: 'const struct google::protobuf::util::JsonPrintOptions' has no member named 'always_print_enums_as_ints'
proto_source.set_use_ints_for_enums(options.always_print_enums_as_ints);
^
Target //tensorflow/tools/pip_package:build_pip_package failed to build
If I build protobuf 3.3 from source and then attempt to build TensorFlow 1.1 from source I get the following error:
ERROR: <snip>/.cache/bazel/_bazel_daniel/041a78b467f26d47aee0fcd68c1f3624/external/protobuf/BUILD:73:1: C++ compilation of rule '#protobuf//:protobuf_lite' failed: gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG ... (remaining 45 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
external/protobuf/src/google/protobuf/arenastring.cc:41:6: error: redefinition of 'void google::protobuf::internal::ArenaStringPtr::AssignWithDefault(const string*, google::protobuf::internal::ArenaStringPtr)'
void ArenaStringPtr::AssignWithDefault(const ::std::string* default_value,
^
In file included from external/protobuf/src/google/protobuf/arenastring.cc:34:0:
<snip>/source/protobuf/protobuf-3.3.0/inst/include/google/protobuf/arenastring.h:316:13: note: 'void google::protobuf::internal::ArenaStringPtr::AssignWithDefault(const string*, google::protobuf::internal::ArenaStringPtr)' previously defined here
inline void ArenaStringPtr::AssignWithDefault(const ::std::string* default_value,
^
Target //tensorflow/tools/pip_package:build_pip_package failed to build

Undefined reference to `oslIsWlanPowerOn'

I am developing a PSP homebrew application and I using the makefile from the exampel but it won't link because the stupid (excuse my French) linker says that oslIsWlanPowrOn is undefined. I know I am linking the right library, plus I am following an example so it should compile. I know most stackoverflow users don't use the oslib or do much psp programming but any help would be appreciated. I have also tried reordering the order of the libs but still states the same linker errors. Anyhow here is the code below:
Makefile
TARGET = main
OBJS = main.o
CFLAGS = -O2 -g -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LIBS= -lpspwlan -losl -lpng -lz -lpspnet \
-lpsphprm -lpspsdk -lpspctrl -lpsprtc -lpsppower -lpspgu -lpspgum -lpspaudiolib -lpspaudio \
-lpspnet_adhocmatching -lpspnet_adhoc -lpspnet_adhocctl -lm -ljpeg
LDFLAGS =
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = PSP Chat
#PSP_EBOOT_ICON = ICON0.PNG
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Error details:
1>------ Build started: Project: PSP Chat, Configuration: Debug Win32 ------
1> psp-gcc -I. -IC:/pspsdk/psp/sdk/include -O2 -g -G0 -Wall -D_PSP_FW_VERSION=150 -L. -LC:/pspsdk/psp/sdk/lib main.o -lpspwlan -losl -lpng -lz -lpspnet -lpsphprm -lpspsdk -lpspctrl -lpsprtc -lpsppower -lpspgu -lpspgum -lpspaudiolib -lpspaudio -lpspnet_adhocmatching -lpspnet_adhoc -lpspnet_adhocctl -lm -ljpeg -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o main.elf
1> main.o: In function `main':
1> c:\Users\Danny\documents\visual studio 2010\Projects\PSP Chat\PSP Chat/main.cpp (24) : undefined reference to `oslIsWlanPowerOn'
1> c:\Users\Danny\documents\visual studio 2010\Projects\PSP Chat\PSP Chat/main.cpp (52) : undefined reference to `oslIsWlanPowerOn'
1> C:\pspsdk\bin\make: *** [main.elf] Error 1
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
main.cpp
#include <pspkernel.h>
#include <oslib\oslib.h>
PSP_MODULE_INFO("PSP Chat", 0, 1, 0);
OSL_FONT* font;
int main()
{
char* screename = (char*)malloc(100);
int skip = 0;
printf("Initializing OSL...");
oslInit(0);
printf("Loading Font...");
oslIntraFontInit(INTRAFONT_CACHE_MED);
font = oslLoadFontFile("flash0:/font/ltn0.pgf");
printf("Configuring Font Style...");
oslIntraFontSetStyle(font, 1.0, RGBA(0, 0, 255, 255), RGBA(0, 0, 0, 0), INTRAFONT_ALIGN_LEFT);
printf("Setting Font...");
oslSetFont(font);
while(!osl_quit)
{
if (!skip)
{
oslStartDrawing();
if (oslIsWlanPowerOn())
{
oslDrawString(10, 10, "Please Enter Screename By Pressing X (Client)...");
oslDrawString(10, 25, "Please Press O To Act As Server...");
if (oslOskIsActive()){
oslDrawOsk();
if (oslGetOskStatus() == PSP_UTILITY_DIALOG_NONE)
{
if (oslOskGetResult() == OSL_OSK_CANCEL)
{
screename = (char*)"Client";
}
else
{
oslOskGetText(screename);
}
oslEndOsk();
}
}
else
{
oslDrawString(10, 10, "Please turn on the wlan switch!");
}
oslEndDrawing();
}
oslEndFrame();
skip = oslSyncFrame();
oslReadKeys();
if (osl_keys->released.cross && oslIsWlanPowerOn())
{
oslInitOsk((char*)"Please enter screename!", (char*)"Client", 99, 1, -1);
}
}
}
sceKernelExitGame();
return 0;
}
There was a problem with the installation of the sdk and so I reinstalled it. Voila--it worked.
Thanks for everyone who tried to diagnose the problem.