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

Can‘t build microprofile with mingw64 #80

Open
deltaLRD opened this issue Sep 7, 2022 · 1 comment
Open

Can‘t build microprofile with mingw64 #80

deltaLRD opened this issue Sep 7, 2022 · 1 comment

Comments

@deltaLRD
Copy link

deltaLRD commented Sep 7, 2022

My mingw64 is download from WinLibs

when I build this project with

cmake .. -G "Ninja"
ninja

the error is

[1/2] Building CXX object CMakeFiles/microprofile.dir/microprofile.cpp.obj
FAILED: CMakeFiles/microprofile.dir/microprofile.cpp.obj
D:\mingw64\bin\c++.exe -DMICROPROFILE_EXPORT -ID:/C++_proj/microprofile -ID:/C++_proj/microprofile/build  -MD -MT CMakeFiles/microprofile.dir/microprofile.cpp.obj -MF CMakeFiles\microprofile.dir\microprofile.cpp.obj.d -o CMakeFiles/microprofile.dir/microprofile.cpp.obj -c D:/C++_proj/microprofile/microprofile.cpp
D:/C++_proj/microprofile/microprofile.cpp: In function 'void MicroProfileThreadStart(void**, MicroProfileThreadFunc)':
D:/C++_proj/microprofile/microprofile.cpp:1206:53: error: invalid conversion from 'MicroProfileThreadFunc' {aka 'void* (*)(void*)'} to 'LPVOID' {aka 'void*'} [-fpermissive]
 1206 |     *pThread = CreateThread(0, 0, ThreadTrampoline, Func, 0, 0);
      |                                                     ^~~~
      |                                                     |
      |                                                     MicroProfileThreadFunc {aka void* (*)(void*)}
In file included from d:\mingw64\x86_64-w64-mingw32\include\winbase.h:29,
                 from d:\mingw64\x86_64-w64-mingw32\include\windows.h:70,
                 from d:\mingw64\x86_64-w64-mingw32\include\winsock2.h:23,
                 from D:/C++_proj/microprofile/microprofile.cpp:227:
d:\mingw64\x86_64-w64-mingw32\include\processthreadsapi.h:279:150: note:   initializing argument 4 of 'void* CreateThread(LPSECURITY_ATTRIBUTES, SIZE_T, LPTHREAD_START_ROUTINE, LPVOID, DWORD, LPDWORD)'
  279 |   WINBASEAPI HANDLE WINAPI CreateThread (LPSECURITY_ATTRIBUTES lpThreadAttributes, SIZE_T dwStackSize, LPTHREAD_START_ROUTINE lpStartAddress, LPVOID lpParameter, DWORD dwCreationFlags, LPDWORD lpThreadId);
      |                                                                                                                                               ~~~~~~~^~~~~~~~~~~
D:/C++_proj/microprofile/microprofile.cpp: At global scope:
D:/C++_proj/microprofile/microprofile.cpp:1296:40: warning: 'thread' attribute directive ignored [-Wattributes]
 1296 | MP_THREAD_LOCAL MicroProfileThreadLog* g_MicroProfileThreadLogThreadLocal = 0;
      |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:/C++_proj/microprofile/microprofile.cpp: In function 'bool MicroProfileStartWin32Trace(EventCallback, BufferCallback)':
D:/C++_proj/microprofile/microprofile.cpp:7350:19: warning: passing NULL to non-pointer argument 1 of 'ULONG StopTraceA(TRACEHANDLE, LPCSTR, PEVENT_TRACE_PROPERTIES)' [-Wconversion-null]
 7350 |         StopTrace(NULL, KERNEL_LOGGER_NAME, &sessionProperties);
      |                   ^~~~
In file included from D:/C++_proj/microprofile/microprofile.cpp:7241:
d:\mingw64\x86_64-w64-mingw32\include\evntrace.h:858:49: note:   declared here
  858 |   EXTERN_C ULONG WMIAPI StopTraceA (TRACEHANDLE TraceHandle, LPCSTR InstanceName, PEVENT_TRACE_PROPERTIES Properties);
      |                                     ~~~~~~~~~~~~^~~~~~~~~~~
ninja: build stopped: subcommand failed.
@jonasmr
Copy link
Owner

jonasmr commented Sep 7, 2022

I'm not sure what you are compiling with:

can you try putting in a cast to LPVOID

IE replace
*pThread = CreateThread(0, 0, ThreadTrampoline, Func, 0, 0);
with
*pThread = CreateThread(0, 0, ThreadTrampoline, (LPVOID)Func, 0, 0);

It also looks like its ignoring the thread attribute, which will probably also be a problem.

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

2 participants