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

Error: cannot find -lgflags while building glog #74

Closed
gaurav16gupta opened this issue Oct 7, 2016 · 5 comments
Closed

Error: cannot find -lgflags while building glog #74

gaurav16gupta opened this issue Oct 7, 2016 · 5 comments

Comments

@gaurav16gupta
Copy link

I am building glog for Android NDK. Getting this error while building-

[ 91%] Building CXX object CMakeFiles/stl_logging_unittest.dir/src/stl_logging_unittest.cc.o
/home/gaurav/deeplearning/caffe-android-lib/glog/src/logging_unittest.cc:641:3: error: #error There is no way to do glob.

error There is no way to do glob.

^
Linking CXX executable symbolize_unittest
cc1plus: warning: unrecognized command line option "-Wno-unnamed-type-template-args"
make[2]: *** [CMakeFiles/logging_unittest.dir/src/logging_unittest.cc.o] Error 1
make[1]: *** [CMakeFiles/logging_unittest.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/home/gaurav/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lgflags
collect2: error: ld returned 1 exit status
make[2]: *** [symbolize_unittest] Error 1
make[1]: *** [CMakeFiles/symbolize_unittest.dir/all] Error 2
Linking CXX executable demangle_unittest
/home/gaurav/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lgflags
collect2: error: ld returned 1 exit status
make[2]: *** [demangle_unittest] Error 1
make[1]: *** [CMakeFiles/demangle_unittest.dir/all] Error 2
Linking CXX executable stl_logging_unittest
/home/gaurav/Android/Sdk/ndk-bundle/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin/ld: cannot find -lgflags
collect2: error: ld returned 1 exit status
make[2]: *** [stl_logging_unittest] Error 1
make[1]: *** [CMakeFiles/stl_logging_unittest.dir/all] Error 2
make: *** [all] Error 2

Any suggestion?

@sh1r0
Copy link
Owner

sh1r0 commented Oct 7, 2016

Hi @stark123, please provide more details about how you built. Did you build gflags first?

@gaurav16gupta
Copy link
Author

Yes, the gflags is build first.
Also I am getting this warning-

CMake Warning:
Manually-specified variables were not used by the project:
GFLAGS_INCLUDE_DIR
GFLAGS_LIBRARY

@sh1r0
Copy link
Owner

sh1r0 commented Oct 7, 2016

I did not get such warnings when building via scripts/build_glog.sh.

@sh1r0
Copy link
Owner

sh1r0 commented Oct 21, 2016

Could be reopened if needed.

@sh1r0 sh1r0 closed this as completed Oct 21, 2016
@xuepan01
Copy link

xuepan01 commented Nov 9, 2016

Hi @stark123, I met the same issue with you.
Actually here is two issues:

  1. Cannot find the gflags lib to link, this can be resolved by:
    a. Create a file as Findgflags.cmake in the glog/cmake folder.
    b. Add two line in the file:
    set(gflags_INCLUDE_DIR ${GFLAGS_INCLUDE_DIR})
    set(gflags_LIBRARIES ${GFLAGS_LIBRARY})
    Now the issue should be resolved.
  2. error There is no way to do glob
    This is caused by BUILD_TESTING is defined but cannot find glob.h.
    I cannot find where defines the BUILD_TESTING, but it seems it's only a unit test, you can remove the test in the CMakeList.txt or comment the error in the logging_unittest.cc if you don't care about the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants