Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLOG 0.4.0 : unresolved external symbol google::InitGoogleLogging #2494

Closed
ShamanTcler opened this issue Aug 12, 2020 · 4 comments · Fixed by #2500
Closed

GLOG 0.4.0 : unresolved external symbol google::InitGoogleLogging #2494

ShamanTcler opened this issue Aug 12, 2020 · 4 comments · Fixed by #2500
Labels
bug Something isn't working

Comments

@ShamanTcler
Copy link

Package Name/Version: glog/0.4.0
Operating System+version: Win 10
Compiler+version: MSVS 2015 & MSVS 2019
Conan version: 1.28.0
cmake version:3.18.0
Ninja version:1.10.0

This may be similar to: #1691

Using conan-cmake:

conan_cmake_run(
            REQUIRES
                glog/0.4.0
            IMPORTS
                ${CONANIMPORTS}
            BASIC_SETUP
                CMAKE_TARGETS
            )

add_executable( ${PROJECT_NAME} ${SOURCES}   )
target_link_libraries(${PROJECT_NAME} CONAN_PKG::glog)

main.cpp is simple enough:

#include <glog/logging.h>

int main(int argc, char* argv[]) {


     // Initialize Google's logging library.
     google::InitGoogleLogging(argv[0]);

     LOG(INFO) << "This is an info  message";
     LOG(WARNING) << "This is a warning message";
     LOG(ERROR) << "This is an error message";
     LOG(FATAL) << "This is a fatal message";

     return 0;
}

Log attached below.
Conan_GLOG_Fail.log

@ShamanTcler ShamanTcler added the bug Something isn't working label Aug 12, 2020
@SpaceIm
Copy link
Contributor

SpaceIm commented Aug 12, 2020

Looking at test_package in glog recipe, it injects a definition if windows and not mingw. This definition should be in cpp_info.

@ShamanTcler
Copy link
Author

Ok so your comments are welcome, but they go right over my head.

But I read so .... the recipe has

       if self.settings.os == "Windows":
            del self.options.fPIC

So the recipe deletes the fPIC option? As opposed to resetting it to False?

Not sure how this really helps me at the moment... just ignorant on how to use the information

@SpaceIm
Copy link
Contributor

SpaceIm commented Aug 12, 2020

Not related with PIC.

In test_package:

#include <iostream>
#ifdef _WIN32
#ifndef __MINGW32__
#define GOOGLE_GLOG_DLL_DECL 
#endif
#endif
#include <glog/logging.h>

int main(int argc, char** argv) {
    google::InitGoogleLogging(argv[0]);
    LOG(INFO) << "It works";
    return 0;
}

This GOOGLE_GLOG_DLL_DECL should be injected by cmake target, not manually added by consumers. So it's a bug in glog recipe.

@ShamanTcler
Copy link
Author

ShamanTcler commented Aug 12, 2020

Good that means I dodged that bullet, not my fault.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants