Comments (8)
FYI, I have a very basic CMakeLists.txt
in PR #3.
from libserialport.
As of ndim@0574156, the CI builds are succeeding:
https://github.com/ndim/libserialport/actions/runs/8069048688
This includes cmake ("cm") and autotools ("at") builds:
- linux-x86_64 (at, cm)
- linux (i386, armhf, arm64) x (cm, at)
- macos-x86_64 (cm, at)
- msvc (cm only)
- msys2+mingw (mingw64, ucrt64, clang64) (cm, at)
The commit series and the resulting tree need massive cleanups, but at least we now have a known good state, at least in the sense of "it succeeds building something".
from libserialport.
vcpkg does not have the port yet. There was a new port request but nobody has done the port yet.
from libserialport.
Nice. You are almost there already.
Need to add something similar to avrdude, for MinGW.
if(WIN32 OR MINGW)
list(APPEND EXTRA_WINDOWS_RESOURCES "${PROJECT_BINARY_DIR}/src/windows.rc")
list(APPEND EXTRA_WINDOWS_LIBRARIES setupapi hid ws2_32)
endif()
Build log
MINGW64 /c/work/avr/avrdude_test/avrdude_libserialport_pr3
$ cmake -B build_cmake_mingw64
-- Building for: Ninja
-- The C compiler identification is GNU 13.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/msys64/mingw64/bin/cc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done (5.7s)
-- Generating done (0.0s)
-- Build files have been written to: C:/work/avr/avrdude_test/avrdude_libserialport_pr3/build_cmake_mingw64
$ cmake --build build_cmake_mingw64
[2/2] Linking C shared library libserialport.dll
FAILED: libserialport.dll liblibserialport.dll.a
C:\WINDOWS\system32\cmd.exe /C "cd . && C:\msys64\mingw64\bin\cc.exe -shared -o libserialport.dll -Wl,--out-implib,liblibserialport.dll.a -Wl,--major-image-version,0,--minor-image-version,1 CMakeFiles/libserialport.dir/windows.c.obj -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0x9f2): undefined reference to `__imp_CM_Get_Parent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0xa17): undefined reference to `__imp_CM_Get_Device_IDA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0xc52): undefined reference to `__imp_SetupDiGetClassDevsA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0xca1): undefined reference to `__imp_SetupDiEnumDeviceInterfaces'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0xcdb): undefined reference to `__imp_SetupDiGetDeviceInterfaceDetailA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0xd45): undefined reference to `__imp_SetupDiGetDeviceInterfaceDetailA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0xd74): undefined reference to `__imp_CM_Get_Parent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0xe4e): undefined reference to `__imp_SetupDiEnumDeviceInfo'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0xe66): undefined reference to `__imp_SetupDiDestroyDeviceInfoList'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0xec2): undefined reference to `__imp_SetupDiGetClassDevsA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0xeda): undefined reference to `sp_last_error_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0xf23): undefined reference to `sp_free_error_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0xf70): undefined reference to `__imp_SetupDiOpenDevRegKey'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0x1073): undefined reference to `__imp_CM_Get_Parent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0x10b1): undefined reference to `__imp_CM_Get_DevNode_Registry_PropertyA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0x1142): undefined reference to `__imp_CM_Get_DevNode_Registry_PropertyA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0x1170): undefined reference to `__imp_CM_Get_Parent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0x11f9): undefined reference to `__imp_CM_Get_Device_IDA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0x1273): undefined reference to `__imp_CM_Get_DevNode_Registry_PropertyA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0x133a): undefined reference to `__imp_CM_Get_DevNode_Registry_PropertyA'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0x13ba): undefined reference to `__imp_CM_Get_Parent'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0x150f): undefined reference to `__imp_SetupDiEnumDeviceInfo'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0x152d): undefined reference to `__imp_SetupDiDestroyDeviceInfoList'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0x15ff): undefined reference to `sp_last_error_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0x163f): undefined reference to `sp_free_error_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0x16f7): undefined reference to `sp_last_error_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0x1737): undefined reference to `sp_free_error_message'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.text+0x18de): undefined reference to `list_append'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/libserialport.dir/windows.c.obj:windows.c:(.rdata$.refptr.sp_debug_handler[.refptr.sp_debug_handler]+0x0): undefined reference to `sp_debug_handler'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
from libserialport.
Similar for VS2019.
PS C:\work\avr\avrdude_test\avrdude_libserialport_pr3> cmake -B .\build_cmake_vs2019
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19045.
-- The C compiler identification is MSVC 19.29.30153.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/work/avr/avrdude_test/avrdude_libserialport_pr3/build_cmake_vs2019
PS C:\work\avr\avrdude_test\avrdude_libserialport_pr3> cmake --build .\build_cmake_vs2019
Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Checking Build System
Building Custom Rule C:/work/avr/avrdude_test/avrdude_libserialport_pr3/CMakeLists.txt
windows.c
C:\work\avr\avrdude_test\avrdude_libserialport_pr3\libserialport.h(292,1): warning C4005: 'SP_API': macro redefinition
[C:\work\avr\avrdude_test\avrdude_libserialport_pr3\build_cmake_vs2019\libserialport.vcxproj]
C:\work\avr\avrdude_test\avrdude_libserialport_pr3\build_cmake_vs2019\config.h(17): message : see previous definition o
f 'SP_API' [C:\work\avr\avrdude_test\avrdude_libserialport_pr3\build_cmake_vs2019\libserialport.vcxproj]
windows.obj : error LNK2019: unresolved external symbol __imp_sp_last_error_message referenced in function get_port_det
ails [C:\work\avr\avrdude_test\avrdude_libserialport_pr3\build_cmake_vs2019\libserialport.vcxproj]
windows.obj : error LNK2019: unresolved external symbol __imp_sp_free_error_message referenced in function get_port_det
ails [C:\work\avr\avrdude_test\avrdude_libserialport_pr3\build_cmake_vs2019\libserialport.vcxproj]
windows.obj : error LNK2019: unresolved external symbol __imp_SetupDiEnumDeviceInfo referenced in function get_port_det
ails [C:\work\avr\avrdude_test\avrdude_libserialport_pr3\build_cmake_vs2019\libserialport.vcxproj]
windows.obj : error LNK2019: unresolved external symbol __imp_SetupDiDestroyDeviceInfoList referenced in function get_p
ort_details [C:\work\avr\avrdude_test\avrdude_libserialport_pr3\build_cmake_vs2019\libserialport.vcxproj]
windows.obj : error LNK2019: unresolved external symbol __imp_SetupDiEnumDeviceInterfaces referenced in function get_us
b_details [C:\work\avr\avrdude_test\avrdude_libserialport_pr3\build_cmake_vs2019\libserialport.vcxproj]
windows.obj : error LNK2019: unresolved external symbol __imp_SetupDiGetDeviceInterfaceDetailA referenced in function g
et_usb_details [C:\work\avr\avrdude_test\avrdude_libserialport_pr3\build_cmake_vs2019\libserialport.vcxproj]
windows.obj : error LNK2019: unresolved external symbol __imp_SetupDiGetClassDevsA referenced in function get_port_deta
ils [C:\work\avr\avrdude_test\avrdude_libserialport_pr3\build_cmake_vs2019\libserialport.vcxproj]
windows.obj : error LNK2019: unresolved external symbol __imp_SetupDiOpenDevRegKey referenced in function get_port_deta
ils [C:\work\avr\avrdude_test\avrdude_libserialport_pr3\build_cmake_vs2019\libserialport.vcxproj]
windows.obj : error LNK2019: unresolved external symbol __imp_CM_Get_Device_IDA referenced in function get_port_details
[C:\work\avr\avrdude_test\avrdude_libserialport_pr3\build_cmake_vs2019\libserialport.vcxproj]
windows.obj : error LNK2019: unresolved external symbol __imp_CM_Get_DevNode_Registry_PropertyA referenced in function
get_port_details [C:\work\avr\avrdude_test\avrdude_libserialport_pr3\build_cmake_vs2019\libserialport.vcxproj]
windows.obj : error LNK2019: unresolved external symbol __imp_CM_Get_Parent referenced in function get_port_details [C:
\work\avr\avrdude_test\avrdude_libserialport_pr3\build_cmake_vs2019\libserialport.vcxproj]
windows.obj : error LNK2019: unresolved external symbol list_append referenced in function list_ports [C:\work\avr\avrd
ude_test\avrdude_libserialport_pr3\build_cmake_vs2019\libserialport.vcxproj]
windows.obj : error LNK2001: unresolved external symbol sp_debug_handler [C:\work\avr\avrdude_test\avrdude_libserialpor
t_pr3\build_cmake_vs2019\libserialport.vcxproj]
C:\work\avr\avrdude_test\avrdude_libserialport_pr3\build_cmake_vs2019\Debug\libserialport.dll : fatal error LNK1120: 13
unresolved externals [C:\work\avr\avrdude_test\avrdude_libserialport_pr3\build_cmake_vs2019\libserialport.vcxproj]
from libserialport.
CMake build under macOS ARM64 (macOS 14.3.1, Mac Mini M1).
mcuee@mcuees-Mac-mini libserialport_ndim % cmake -B build_cmake
-- The C compiler identification is AppleClang 15.0.0.15000100
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/mcuee/build/avr/libserialport_ndim/build_cmake
mcuee@mcuees-Mac-mini libserialport_ndim % cmake --build build_cmake
[ 25%] Building C object CMakeFiles/libserialport.dir/serialport.c.o
[ 50%] Building C object CMakeFiles/libserialport.dir/timing.c.o
[ 75%] Building C object CMakeFiles/libserialport.dir/macosx.c.o
[100%] Linking C shared library libserialport.dylib
[100%] Built target libserialport
from libserialport.
CMake under Linux.
mcuee@UbuntuSwift3 ~/build/avr/libserialport_ndim (add-version-suffix)$ cmake -B build_cmake
-- The C compiler identification is GNU 9.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done (0.4s)
-- Generating done (0.0s)
-- Build files have been written to: /home/mcuee/build/avr/libserialport_ndim/build_cmake
mcuee@UbuntuSwift3 ~/build/avr/libserialport_ndim (add-version-suffix)$ cmake --build build_cmake/
[ 20%] Building C object CMakeFiles/libserialport.dir/serialport.c.o
[ 40%] Building C object CMakeFiles/libserialport.dir/timing.c.o
[ 60%] Building C object CMakeFiles/libserialport.dir/linux.c.o
[ 80%] Building C object CMakeFiles/libserialport.dir/linux_termios.c.o
[100%] Linking C shared library libserialport.so
[100%] Built target libserialport
mcuee@UbuntuSwift3 ~/build/avr/libserialport_ndim (add-version-suffix)$ sudo cmake --build build_cmake --target install
[100%] Built target libserialport
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/lib/pkgconfig/libserialport.pc
-- Installing: /usr/local/lib/libserialport.so.0.1.0
-- Installing: /usr/local/lib/libserialport.so.0
-- Installing: /usr/local/lib/libserialport.so
-- Installing: /usr/local/include/libserialport.h
from libserialport.
Not so sure how to carry out cross-compiler under macOS though.
arduino/avrdude-packing#31 (comment)
root@c44bc932da28:~/build/libserialport_cmake# cmake -B build_darwin -DCMAKE_C_COMPILER=o64-clang -DCMAKE_EXE_LINKER_FLAGS="-L/opt/lib/x86_64-apple-darwin13/lib" -DCMAKE_C_FLAGS="-I/opt/lib/x86_64-apple-darwin13/include -pthread -framework Foundation -framework IOKit -framework Cocoa -framework Security" -DCMAKE_PREFIX_PATH=/opt/lib/x86_64-apple-darwin13 -- The C compiler identification is Clang 10.0.0
-- Check for working C compiler: /opt/osxcross/target/bin/o64-clang
-- Check for working C compiler: /opt/osxcross/target/bin/o64-clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /root/build/libserialport_cmake/build_darwin
root@c44bc932da28:~/build/libserialport_cmake# cmake -build build_darwin
-- Configuring done
-- Generating done
-- Build files have been written to: /root/build/libserialport_cmake/build_darwin
root@c44bc932da28:~/build/libserialport_cmake# cmake -B build_darwin -DCMAKE_C_COMPILER=o64-clang -DCMAKE_EXE_LINKER_FLAGS="-L/opt/lib/x86_64-apple-darwin13/lib" -DCMAKE_C_FLAGS="-I/opt/lib/x86_64-apple-darwin13/include -pthread -framework Foundation -framework IOKit -framework Cocoa -framework Security" -DCMAKE_PREFIX_PATH=/opt/lib/x86_64-apple-darwin13
-- Configuring done
-- Generating done
-- Build files have been written to: /root/build/libserialport_cmake/build_darwin
root@c44bc932da28:~/build/libserialport_cmake# cmake --build build_darwin
Scanning dependencies of target libserialport
[ 20%] Building C object CMakeFiles/libserialport.dir/serialport.c.o
clang: warning: -framework Foundation: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -framework IOKit: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -framework Cocoa: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -framework Security: 'linker' input unused [-Wunused-command-line-argument]
[ 40%] Building C object CMakeFiles/libserialport.dir/timing.c.o
clang: warning: -framework Foundation: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -framework IOKit: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -framework Cocoa: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -framework Security: 'linker' input unused [-Wunused-command-line-argument]
[ 60%] Building C object CMakeFiles/libserialport.dir/linux.c.o
clang: warning: -framework Foundation: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -framework IOKit: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -framework Cocoa: 'linker' input unused [-Wunused-command-line-argument]
clang: warning: -framework Security: 'linker' input unused [-Wunused-command-line-argument]
/root/build/libserialport_cmake/linux.c:198:23: error: incomplete definition of type 'struct dirent'
char buf[sizeof(entry->d_name) + 23];
~~~~~^
/root/build/libserialport_cmake/linux.c:193:9: note: forward declaration of 'struct dirent'
struct dirent *entry;
^
/root/build/libserialport_cmake/linux.c:200:2: error: use of undeclared identifier 'DIR'
DIR *dir;
^
/root/build/libserialport_cmake/linux.c:200:7: error: use of undeclared identifier 'dir'; did you mean 'div'?
DIR *dir;
^~~
div
/opt/osxcross/target/bin/../SDK/MacOSX10.15.sdk/usr/include/stdlib.h:144:8: note: 'div' declared here
div_t div(int, int) __pure2;
^
/root/build/libserialport_cmake/linux.c:205:14: warning: implicit declaration of function 'opendir' is invalid in C99 [-Wimplicit-function-declaration]
if (!(dir = opendir("/sys/class/tty")))
^
/root/build/libserialport_cmake/linux.c:205:8: error: use of undeclared identifier 'dir'
if (!(dir = opendir("/sys/class/tty")))
^
/root/build/libserialport_cmake/linux.c:209:18: warning: implicit declaration of function 'readdir' is invalid in C99 [-Wimplicit-function-declaration]
while ((entry = readdir(dir))) {
^
/root/build/libserialport_cmake/linux.c:209:26: error: use of undeclared identifier 'dir'; did you mean 'div'?
while ((entry = readdir(dir))) {
^~~
div
/opt/osxcross/target/bin/../SDK/MacOSX10.15.sdk/usr/include/stdlib.h:144:8: note: 'div' declared here
div_t div(int, int) __pure2;
^
/root/build/libserialport_cmake/linux.c:209:16: warning: incompatible integer to pointer conversion assigning to 'struct dirent *' from 'int' [-Wint-conversion]
while ((entry = readdir(dir))) {
^ ~~~~~~~~~~~~
/root/build/libserialport_cmake/linux.c:210:56: error: incomplete definition of type 'struct dirent'
snprintf(buf, sizeof(buf), "/sys/class/tty/%s", entry->d_name);
~~~~~^
/opt/osxcross/target/bin/../SDK/MacOSX10.15.sdk/usr/include/secure/_stdio.h:57:62: note: expanded from macro 'snprintf'
__builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
^~~~~~~~~~~
/root/build/libserialport_cmake/linux.c:193:9: note: forward declaration of 'struct dirent'
struct dirent *entry;
^
/root/build/libserialport_cmake/linux.c:214:64: error: incomplete definition of type 'struct dirent'
snprintf(buf, sizeof(buf), "/sys/class/tty/%s/device", entry->d_name);
~~~~~^
/opt/osxcross/target/bin/../SDK/MacOSX10.15.sdk/usr/include/secure/_stdio.h:57:62: note: expanded from macro 'snprintf'
__builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
^~~~~~~~~~~
/root/build/libserialport_cmake/linux.c:193:9: note: forward declaration of 'struct dirent'
struct dirent *entry;
^
/root/build/libserialport_cmake/linux.c:221:48: error: incomplete definition of type 'struct dirent'
snprintf(name, sizeof(name), "/dev/%s", entry->d_name);
~~~~~^
/opt/osxcross/target/bin/../SDK/MacOSX10.15.sdk/usr/include/secure/_stdio.h:57:62: note: expanded from macro 'snprintf'
__builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), __VA_ARGS__)
^~~~~~~~~~~
/root/build/libserialport_cmake/linux.c:193:9: note: forward declaration of 'struct dirent'
struct dirent *entry;
^
/root/build/libserialport_cmake/linux.c:256:2: warning: implicit declaration of function 'closedir' is invalid in C99 [-Wimplicit-function-declaration]
closedir(dir);
^
/root/build/libserialport_cmake/linux.c:256:11: error: use of undeclared identifier 'dir'; did you mean 'div'?
closedir(dir);
^~~
div
/opt/osxcross/target/bin/../SDK/MacOSX10.15.sdk/usr/include/stdlib.h:144:8: note: 'div' declared here
div_t div(int, int) __pure2;
^
4 warnings and 9 errors generated.
make[2]: *** [CMakeFiles/libserialport.dir/build.make:89: CMakeFiles/libserialport.dir/linux.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/libserialport.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
from libserialport.
Related Issues (3)
- Release with a new versioning scheme? HOT 12
- Add github action HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libserialport.