Beckhoff / ADS

Beckhoff protocol to communicate with TwinCAT devices.
MIT License
493 stars 194 forks source link

ninja build issue #135

Closed mbollini closed 1 year ago

mbollini commented 3 years ago

Hi, I did a clean git.

Meson works fine. This is its output:

C:\Users\Maurizio\Documents\GitHub\ADS>meson build
The Meson build system
Version: 0.57.1
Source dir: C:\Users\Maurizio\Documents\GitHub\ADS
Build dir: C:\Users\Maurizio\Documents\GitHub\ADS\build
Build type: native build
Project name: AdsLib
Project version: 0.1
C++ compiler for the host machine: c++ (gcc 9.2.0 "c++ (MinGW.org GCC Build-2) 9.2.0")
C++ linker for the host machine: c++ ld.bfd 2.32
Host machine cpu family: x86
Host machine cpu: x86
Library ws2_32 found: YES
Run-time dependency threads found: YES
Build targets in project: 3

Found ninja-1.10.2 at "C:\Program Files\Meson\ninja.EXE"

Ninja build fails because of a lot of errors.

I report just the very first here:

C:\Users\Maurizio\Documents\GitHub\ADS>ninja -C build ninja: Entering directorybuild' [4/17] Compiling C++ object libAdsLib.a.p/AdsLib_Log.cpp.obj FAILED: libAdsLib.a.p/AdsLib_Log.cpp.obj "c++" "-IlibAdsLib.a.p" "-I." "-I.." "-I..\AdsLib" "-I..\tools" "-fdiagnostics-color=always" "-pipe" "-D_FILE_OFFSET_BITS=64" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Wextra" "-Wpedantic" "-g" -MD -MQ libAdsLib.a.p/AdsLib_Log.cpp.obj -MF "libAdsLib.a.p\AdsLib_Log.cpp.obj.d" -o libAdsLib.a.p/AdsLib_Log.cpp.obj "-c" ../AdsLib/Log.cpp ../AdsLib/Log.cpp: In static member function 'static void Logger::Log(size_t, const string&)': ../AdsLib/Log.cpp:34:9: error: 'localtime_s' was not declared in this scope; did you mean 'localtime'? 34 | localtime_s(&temp, TIME_T); \ | ^~~ ../AdsLib/Log.cpp:60:9: note: in expansion of macro 'TIME_T_TO_STRING' 60 | TIME_T_TO_STRING(dateTime, &tt); | ^~~~`

Any clue?

Regards,

Maurizio.

pbruenn commented 3 years ago

Unfortunately yes I have an idea. At first I had "cpp_std=c++11" as a default option in meson.build until clang on windows with Visual C++ headers complained because Microsoft headers already require c++14. So I decided to let the compiler use it's own default as I only had clang on macOS and gcc5 on linux for win32 cross build require explicit cpp_std=c++11, which you can see in my gitlab yaml: https://github.com/Beckhoff/ADS/blob/0e0f73f709841c8ee3a0c1ff20ebb46165662d9f/.gitlab-ci.yml#L60 So try: meson build -Dcpp_std=c++11 or meson build -Dcpp_std=c++14 or add it to the meson.build file, which i might do if your compiler combination seems more widespread than mine: https://github.com/Beckhoff/ADS/blob/0e0f73f709841c8ee3a0c1ff20ebb46165662d9f/meson.build#L3-L5 If you are a meson starter like me, make sure to either delete your build dir before you try to change the cpp_std option or use meson setup --wipe build -Dcpp_std=c++11

mbollini commented 3 years ago

ninja_build.txt

I started with a clean git, issued 'meson build -Dcpp_std=c++11' but ninja fails to build. See attached log.

pbruenn commented 3 years ago

Did the old Makefile worked better for you? Sorry I have no other idea than to blame the compiler :-( https://stackoverflow.com/questions/34847804/stdthread-works-in-cygwin-but-not-in-mingw