hosseinmoein / DataFrame

C++ DataFrame for statistical, Financial, and ML analysis -- in modern C++ using native types and contiguous memory storage
https://hosseinmoein.github.io/DataFrame/
BSD 3-Clause "New" or "Revised" License
2.54k stars 313 forks source link

Not generating make in Microsoft Visual Studio Code #80

Closed b1c1jones closed 4 years ago

b1c1jones commented 4 years ago

makefile runs, make executable not generated. CMakeError.log CMakeOutput.log TargetDirectories.txt

hosseinmoein commented 4 years ago

I am not sure what you are trying to do. I need more details of what you are doing. From your attached logs the only thing that failed was your program:

#include <time.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef clock_gettime
  return ((int*)(&clock_gettime))[argc];
#else
  (void)argc;
  return 0;
#endif
}

As far as I can tell, this should fail to compile.

b1c1jones commented 4 years ago

The failure was at the check_symbol_exists(clock_gettime "time.h" HMDF_HAVE_CLOCK_GETTIME) call in the CMakeLists.txt. It appears windows does not use clock_gettime, they use GetProcessTimes (in Processthreadsapi.h).

From https://realpython.com/cpython-source-code-guide/:

"_PyTime_GetProcessTimeWithInfo() is implemented multiple different ways in the source code, but only certain parts are compiled into the binary for the module, depending on the operating system. Windows systems will call GetProcessTimes() and Unix systems will call clock_gettime().

Other modules that have multiple implementations for the same API are the threading module, the file system module, and the networking modules. Because the Operating Systems behave differently, the CPython source code implements the same behavior as best as it can and exposes it using a consistent, abstracted API."

hosseinmoein commented 4 years ago

Thanks. I was aware of that (although, I don't have access to a Windows development environment). check_symbol_exists(clock_gettime "time.h" HMDF_HAVE_CLOCK_GETTIME) is a CMake construct, so it should just work. Please let me know if the make process is breaking. In my code I do not use clock_gettime() in Windows. This is the only place in my code that clock_gettime() is called

#ifdef _WIN32
    FILETIME            ft;
    unsigned __int64    tmpres = 0;

    GetSystemTimeAsFileTime(&ft);

    tmpres |= ft.dwHighDateTime;
    tmpres <<= 32;
    tmpres |= ft.dwLowDateTime;

    tmpres /= 10;  // convert into microseconds
    // converting file time to unix epoch
    tmpres -= DELTA_EPOCH_IN_MICROSECS;

    set_time(tmpres / 1000000UL, (tmpres % 1000000UL) * 1000000);
#elif defined HMDF_HAVE_CLOCK_GETTIME
    struct timespec ts;

    ::clock_gettime(CLOCK_REALTIME, &ts);
    set_time(ts.tv_sec, ts.tv_nsec);
#else
    struct timeval  tv { };

    ::gettimeofday(&tv, nullptr);
    set_time(tv.tv_sec, tv.tv_usec * 1000);
#endif // _WIN32
b1c1jones commented 4 years ago

Yes, the make process breaks. Upon completion there is no make executable

hosseinmoein commented 4 years ago

hmm, that's not good. I do not understand why it wouldn't work. I works fine in Appveyor: https://ci.appveyor.com/project/hosseinmoein/dataframe

Are you following the instructions for CMake in the README? Alternatively, does it work if you comment out

Include(CheckSymbolExists)
check_symbol_exists(clock_gettime "time.h" HMDF_HAVE_CLOCK_GETTIME)

in CMakeLists.txt file?

hosseinmoein commented 4 years ago

If you are referring to your code executable not being built, that is understandable, since it has a couple of problems in it.

But the DataFrame built should work, if you follow instructions in the README. As an example you can look at Appveyor log (which is a Windows build) here https://ci.appveyor.com/project/hosseinmoein/dataframe

b1c1jones commented 4 years ago

I commented out. No build errors, and it still does not generate a make executable. I will go ahead and just use it as you say,