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 package doesn't seem to work. ( mingw-w64-x86_64-glog 0.3.4.4d391fe-3 ) #960

Closed
Joeppie opened this issue Jul 27, 2017 · 13 comments
Closed

Comments

@Joeppie
Copy link

Joeppie commented Jul 27, 2017

Hello,

I've installed the 64 bit version of mingw/msys2 on 2 seperate devices.
While I can succesfully make use of many libraries,I cannot get even the simplest code (i.e. just calling the init function) to work with the supplied 64 bit shared library for glog. It compiles fine, but will not run.

As soon as the DLL is loaded, an access violation occurs in libglog.dll. I suspect there is something wrong with the binary version of the library; it cannot seem to be loaded. I checked with Dependency Checker, and have verified that a crash occurs loading the glog DLL. The DLL architecture itself is 64 bit as it should be.

On a side note, and not something msys2 can fix, static linking of glog also seems a no-go as this leads to multiple definition errors, pertaining to the fact that glog itself uses, and has its own definition for stack unwinding.

@peterbud
Copy link
Contributor

@Joeppie I guess you are referring to the mingw-w64-glog package. That has been updated back in August, you can give a try

@peterbud
Copy link
Contributor

peterbud commented Oct 7, 2017

I believe this can be closed due to no response

@Joeppie
Copy link
Author

Joeppie commented Oct 18, 2017

I haven't been in the position to try this, I switched over to developing on Linux. However, not even the simplest program linking to glog would work, with the mentioned mingw-w64-glog package. I am not sure how wise it is to close this issue??

@peterbud
Copy link
Contributor

I think you should include here what and how would you like to link to glog, and what is the exact error/symptom you have, which MSYS shell you are using etc. Without that nobody can help you.

@29antonioac
Copy link

29antonioac commented Jan 28, 2019

Hi! I can confirm this is not working. Very simple example:

#include <glog/logging.h>

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

At runtime a popup displays this message

The application was unable to start correctly (0xc0000142). Click OK to close the application.

I have a fresh install of MSYS2 with some libraries working like a charm (sqlite3, yaml-cpp). Can I do anything to get glog working? glog version is mingw-w64-x86_64-glog-0.3.5-1.

Thanks for your work! This system solves all my problem with the Windows machine at office :D .

@peterbud
Copy link
Contributor

It does work. If you build the package yourself, you can check the test applications (demangle_unittest.exe logging_unittest.exe stl_logging_unittest.exe utilities_unittest.exe) built and properly executed:

==> Starting check()...
Running tests...
Test project D:/Peter/Documents/Development/MINGW-packages/mingw-w64-glog/src/build-x86_64-w64-mingw32
    Start 1: demangle
1/3 Test #1: demangle .........................   Passed    0.02 sec
    Start 2: logging
2/3 Test #2: logging ..........................   Passed    1.54 sec
    Start 3: stl_logging
3/3 Test #3: stl_logging ......................   Passed    0.03 sec

100% tests passed, 0 tests failed out of 3

Total Test time (real) =   1.61 sec

When you wrote:

Click OK to close the application.

Do you mean by double clicking on the built executable from the file explorer?

Pls read the wiki to understand that either:

  • you need to start the application from the MINGW64 shell/subsystem, like ./myglogtest.exe
  • Or you need to distribute/copy with your application the necessary depenent dlls, in this case the libglog.dll etc.

@29antonioac
Copy link

Hi, thanks for your answer.

When you wrote:

Click OK to close the application.

Do you mean by double clicking on the built executable from the file explorer?

No, it is only because a popup is displayed. I launch the app using conEmu.

image

I have set the PATH variable properly, I think.

image

If I launch the app using the Mingw64 environment, it does nothing

image

Pls read the wiki to understand that either:

  • you need to start the application from the MINGW64 shell/subsystem, like ./myglogtest.exe
  • Or you need to distribute/copy with your application the necessary depenent dlls, in this case the libglog.dll etc.

I can see that libglog.dll is in mingw64/bin, and libglog.dll.a in mingw64/lib, and both of them are present in the PATH. Am I missing something?

Thanks for your help!

@peterbud
Copy link
Contributor

peterbud commented Jan 29, 2019

Your executable has a name "main.x"? That sounds like not a normal executable file extension.

Whether you run your program from conemu of from Windows explore, does not very different. The problem is those environments do not know where to locate the dependent dll.s

Let's try first to make sure the compiled executable is working first from within the MINGW64 shell

  • Pls share what is the result of echo $PATH
  • Pls share the command you use to build the minimal glog test application you referred above to

@29antonioac
Copy link

29antonioac commented Jan 29, 2019

Having this code

#include <iostream>
#include <glog/logging.h>

int main(int argc, char const *argv[]) {
  google::InitGoogleLogging(argv[0]);
  LOG(INFO) << "Hi Log";
  std::cout << "Hi stdout" << std::endl;
  return 0;
}

Let's try first to make sure the compiled executable is working first from within the MINGW64 shell

  • Pls share what is the result of echo $PATH
  • Pls share the command you use to build the minimal glog test application you referred above to

Compiling with g++ glog-test.cpp -o glog-test -lglog, the output is nothing inside Mingw64 environment, as in the previous pic.

$ echo $PATH
/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

Checking libglog.dll exists

$ ls /mingw64/bin/libglog.dll
/mingw64/bin/libglog.dll

Thank you!

@peterbud
Copy link
Contributor

@analca3 your PATH and your test code is OK.
The problem was that libglog was missing the libunwind dependency. Basically the programs using libglog were able to compile, but they were not working (silently failing).

I have submitted a PR which is fixing this. With that fix I was able to make the above code work.
Pls note the following:

  • when you launch the glog-test.exe from MINGW64 shell, then by default it puts the logfiles into the directory /msys64/tmp.
  • when you launch the glog-test.exe from command prompt, then by default it puts the logfiles into the %APPDATA%\Local\Temp folder

When Alexpux uploads the new version you can try it out.

@29antonioac
Copy link

Thank you for the support! I will try again when the PR merges.

@peterbud
Copy link
Contributor

peterbud commented Feb 4, 2019

@analca3 the package has been uploaded to the repo

@29antonioac
Copy link

Thank you! It works like a charm now 🥇

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

No branches or pull requests

3 participants