jonasmr/microprofile

Compilation fails on linux

Closed this issue · 3 comments

In file included from src/modules/core/Trace.cpp:24:
src/modules/core/trace/microprofile.cpp:1838:19: warning: comparison of integers of different signs: 'int64_t' (aka 'long') and 'unsigned long' [-Wsign-compare]
        MP_ASSERT(nCount < MICROPROFILE_GPU_BUFFER_SIZE);
        ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/modules/core/trace/microprofile.cpp:199:30: note: expanded from macro 'MP_ASSERT'
#define MP_ASSERT(a) do{if(!(a)){MP_BREAK();} }while(0)
                             ^
src/modules/core/trace/microprofile.cpp:3699:2: error: use of undeclared identifier 'send'
        send(Socket, &S.WebServerBuffer[0], S.WebServerPut, 0);
        ^
src/modules/core/trace/microprofile.cpp:3711:3: error: use of undeclared identifier 'send'
                send(Socket, pData, (int)nSize, 0);
                ^
src/modules/core/trace/microprofile.cpp:3870:28: error: use of undeclared identifier 'PF_INET'
        S.ListenerSocket = socket(PF_INET, SOCK_STREAM, 6);
                                  ^
src/modules/core/trace/microprofile.cpp:3870:37: error: use of undeclared identifier 'SOCK_STREAM'
        S.ListenerSocket = socket(PF_INET, SOCK_STREAM, 6);
                                           ^
src/modules/core/trace/microprofile.cpp:3871:13: error: use of undeclared identifier 'MP_INVALID_SOCKET'
        MP_ASSERT(!MP_INVALID_SOCKET(S.ListenerSocket));
                   ^
src/modules/core/trace/microprofile.cpp:3875:21: error: variable has incomplete type 'struct sockaddr_in'
        struct sockaddr_in Addr; 
                           ^
src/modules/core/trace/microprofile.cpp:3875:9: note: forward declaration of 'sockaddr_in'
        struct sockaddr_in Addr; 
               ^
src/modules/core/trace/microprofile.cpp:3876:20: error: use of undeclared identifier 'AF_INET'
        Addr.sin_family = AF_INET; 
                          ^
src/modules/core/trace/microprofile.cpp:3877:25: error: use of undeclared identifier 'INADDR_ANY'
        Addr.sin_addr.s_addr = INADDR_ANY; 
                               ^
src/modules/core/trace/microprofile.cpp:3880:19: error: use of undeclared identifier 'htons'
                Addr.sin_port = htons(MICROPROFILE_WEBSERVER_PORT+i); 
                                ^
src/modules/core/trace/microprofile.cpp:3881:35: error: use of undeclared identifier 'sockaddr'
                if(0 == bind(S.ListenerSocket, (sockaddr*)&Addr, sizeof(Addr)))
                                                ^
src/modules/core/trace/microprofile.cpp:3881:44: error: expected expression
                if(0 == bind(S.ListenerSocket, (sockaddr*)&Addr, sizeof(Addr)))
                                                         ^
src/modules/core/trace/microprofile.cpp:3887:2: error: use of undeclared identifier 'listen'
        listen(S.ListenerSocket, 8);
        ^
src/modules/core/trace/microprofile.cpp:4996:17: warning: comparison of integers of different signs: 'uint64_t' (aka 'unsigned long') and 'int' [-Wsign-compare]
                if(nSizeBytes != r)
                   ~~~~~~~~~~ ^  ~
src/modules/core/trace/microprofile.cpp:5015:13: warning: comparison of integers of different signs: 'unsigned long' and 'char' [-Wsign-compare]
        if(nSize+1 > BytesAllocated)
           ~~~~~~~ ^ ~~~~~~~~~~~~~~
src/modules/core/trace/microprofile.cpp:5448:33: warning: comparison of integers of different signs: 'int' and 'uint32_t' (aka 'unsigned int') [-Wsign-compare]
                        uint32_t parent = CI.nParent == (uint32_t)-1 ? 0 : MicroProfileWebSocketIdPack(TYPE_COUNTER, CI.nParent);
                                          ~~~~~~~~~~ ^  ~~~~~~~~~~~~
src/modules/core/trace/microprofile.cpp:5474:6: error: use of undeclared identifier 'MP_INVALID_SOCKET'
        if(!MP_INVALID_SOCKET(Connection))
            ^

The error here is a problem with the header inclusion guard in line 845. There is only #if defined(__APPLE__) where it should have been #if defined(__APPLE__) || defined(__linux__)

If you add this, you get a lot of unresolved symbols:


../../../Debug/lib/libcore.a(Trace.cpp.o): In function `MicroProfileTickToMsMultiplierGpu':
src/modules/core/trace/microprofile.cpp:748: undefined reference to `MicroProfileTicksPerSecondGpu'
../../../Debug/lib/libcore.a(Trace.cpp.o): In function `MicroProfileShutdown':
src/modules/core/trace/microprofile.cpp:1026: undefined reference to `MicroProfileGpuShutdown'
../../../Debug/lib/libcore.a(Trace.cpp.o): In function `MicroProfileAllocInternal(unsigned long, unsigned long)':
src/modules/core/trace/microprofile.cpp:1932: undefined reference to `MicroProfileAllocAligned(unsigned long, unsigned long)'
../../../Debug/lib/libcore.a(Trace.cpp.o): In function `MicroProfileGpuEnterInternal':
src/modules/core/trace/microprofile.cpp:1858: undefined reference to `MicroProfileGpuInsertTimeStamp'
../../../Debug/lib/libcore.a(Trace.cpp.o): In function `MicroProfileGpuLeaveInternal':
src/modules/core/trace/microprofile.cpp:1878: undefined reference to `MicroProfileGpuInsertTimeStamp'
../../../Debug/lib/libcore.a(Trace.cpp.o): In function `MicroProfileFlip':
src/modules/core/trace/microprofile.cpp:2122: undefined reference to `MicroProfileGpuFlip'
src/modules/core/trace/microprofile.cpp:2163: undefined reference to `MicroProfileGpuGetTimeStamp'
src/modules/core/trace/microprofile.cpp:2164: undefined reference to `MicroProfileTicksPerSecondGpu'
src/modules/core/trace/microprofile.cpp:2272: undefined reference to `MicroProfileGpuGetTimeStamp'
../../../Debug/lib/libcore.a(Trace.cpp.o): In function `MicroProfileCalcAllTimers(float*, float*, float*, float*, float*, float*, float*, float*, float*, unsigned int)':
src/modules/core/trace/microprofile.cpp:2650: undefined reference to `MicroProfileTicksPerSecondGpu'
../../../Debug/lib/libcore.a(Trace.cpp.o): In function `MicroProfileGetTime':
src/modules/core/trace/microprofile.cpp:2703: undefined reference to `MicroProfileTicksPerSecondGpu'
../../../Debug/lib/libcore.a(Trace.cpp.o): In function `MicroProfileDumpCsv(void (*)(void*, unsigned long, char const*), void*)':
src/modules/core/trace/microprofile.cpp:2968: undefined reference to `MicroProfileTicksPerSecondGpu'
../../../Debug/lib/libcore.a(Trace.cpp.o): In function `MicroProfileDumpHtml(void (*)(void*, unsigned long, char const*), void*, unsigned long, char const*, unsigned long)':
src/modules/core/trace/microprofile.cpp:3096: undefined reference to `MicroProfileTicksPerSecondGpu'
src/modules/core/trace/microprofile.cpp:3435: undefined reference to `MicroProfileTicksPerSecondGpu'
src/modules/core/trace/microprofile.cpp:3437: undefined reference to `MicroProfileGetGpuTickReference'
../../../Debug/lib/libcore.a(Trace.cpp.o): In function `MicroProfileWebSocketSendFrame(int)':
src/modules/core/trace/microprofile.cpp:5180: undefined reference to `MicroProfileTicksPerSecondGpu'
../../../Debug/lib/libcore.a(Trace.cpp.o): In function `core::traceGLInit()':
src/modules/core/Trace.cpp:109: undefined reference to `MicroProfileGpuShutdown'
../../../Debug/lib/libcore.a(Trace.cpp.o): In function `core::traceGLShutdown()':
src/modules/core/Trace.cpp:120: undefined reference to `MicroProfileGpuShutdown'

Is there anything i'm missing here?

can you let me know if PR #1 fixed the issue?

works for me now. thanks

Hi.
Unfortunately I've had to break it temporarily again.
If you look at line 88 there is a

#if defined(linux)

where you might need to add your platform.