Yes, this will help a lot!  I use MinGW-w64 in Windows, the 32-bit and the 
64-bit version.  I, however, have msys 1 installed, not 2.   That seems to be 
causing problems during compiling.   For example, for some reason I don't have 
the libtool or libtoolize in msys 1.   I went to install MSYS 2 (both 32-bit 
and 64-bit versions) but when I try to build libserialport, it fails.

I believe it fails because of MinGW-w64 (the 64-bit version) is installed in 
C:\Program Files\.... (the default installation path) and the space seems to 
cause problem.   The space between Program and Files I mean.   From MSYS 2 
shell, this is what I run (with the output):
$ ./autogen.shGenerating build system...configure.ac:43: installing 
'autostuff/ar-lib'configure.ac:43: installing 
'autostuff/compile'configure.ac:41: installing 'autostuff/missing'Makefile.am: 
installing './INSTALL'Makefile.am: installing 'autostuff/depcomp'
$ ./configure
$ ./configurechecking for a BSD-compatible install... /usr/bin/install 
-cchecking whether build environment is sane... yeschecking for a thread-safe 
mkdir -p... /usr/bin/mkdir -pchecking for gawk... gawkchecking whether make 
sets $(MAKE)... yeschecking whether make supports nested variables... 
yeschecking whether make supports nested variables... (cached) yeschecking for 
style of include used by make... GNUchecking for gcc... gccchecking whether the 
C compiler works... yeschecking for C compiler default output file name... 
a.exechecking for suffix of executables... .exechecking whether we are cross 
compiling... nochecking for suffix of object files... ochecking whether we are 
using the GNU C compiler... yeschecking whether gcc accepts -g... yeschecking 
for gcc option to accept ISO C89... none neededchecking whether gcc understands 
-c and -o together... yeschecking dependency style of gcc... gcc3checking for 
ar... archecking the archiver (ar) interface... archecking for gcc... (cached) 
gccchecking whether we are using the GNU C compiler... (cached) yeschecking 
whether gcc accepts -g... (cached) yeschecking for gcc option to accept ISO 
C89... (cached) none neededchecking whether gcc understands -c and -o 
together... (cached) yeschecking dependency style of gcc... (cached) 
gcc3checking how to run the C preprocessor... gcc -Echecking whether ln -s 
works... no, using cp -pRchecking build system type... x86_64-pc-msyschecking 
host system type... x86_64-pc-msyschecking how to print strings... 
printfchecking for a sed that does not truncate output... /usr/bin/sedchecking 
for grep that handles long lines and -e... /usr/bin/grepchecking for egrep... 
/usr/bin/grep -Echecking for fgrep... /usr/bin/grep -Fchecking for ld used by 
gcc... 
C:/ProgramFiles/mingw-w64/x86_64-5.1.0-posix-seh-rt_v4-rev0/mingw64/x86_64-w64-mingw32/bin/ld.exechecking
 if the linker 
(C:/ProgramFiles/mingw-w64/x86_64-5.1.0-posix-seh-rt_v4-rev0/mingw64/x86_64-w64-mingw32/bin/ld.exe)
 is GNU ld... nochecking for BSD- or MS-compatible name lister (nm)... 
/c/Program Files/mingw-w64/x86_64-5.1.0-posix-seh-rt_v4-rev0/mingw64/bin/nm 
-Bchecking the name lister (/c/Program 
Files/mingw-w64/x86_64-5.1.0-posix-seh-rt_v4-rev0/mingw64/bin/nm -B) 
interface... BSD nmchecking the maximum length of command line arguments... 
8192checking how to convert x86_64-pc-msys file names to x86_64-pc-msys 
format... func_convert_file_noopchecking how to convert x86_64-pc-msys file 
names to toolchain format... func_convert_file_noopchecking for 
C:/ProgramFiles/mingw-w64/x86_64-5.1.0-posix-seh-rt_v4-rev0/mingw64/x86_64-w64-mingw32/bin/ld.exe
 option to reload object files... -rchecking for objdump... objdumpchecking how 
to recognize dependent libraries... file_magic ^x86 archive import|^x86 
DLLchecking for dlltool... dlltoolchecking how to associate runtime and link 
libraries... func_cygming_dll_for_implibchecking for archiver @FILE support... 
@checking for strip... stripchecking for ranlib... ranlibchecking command to 
parse /c/Program 
Files/mingw-w64/x86_64-5.1.0-posix-seh-rt_v4-rev0/mingw64/bin/nm -B output from 
gcc object... failedchecking for sysroot... nochecking for a working dd... 
/usr/bin/ddchecking how to truncate binary pipes... /usr/bin/dd bs=4096 
count=1checking for mt... nochecking if : is a manifest tool... nochecking for 
ANSI C header files... yeschecking for sys/types.h... yeschecking for 
sys/stat.h... yeschecking for stdlib.h... yeschecking for string.h... 
yeschecking for memory.h... yeschecking for strings.h... yeschecking for 
inttypes.h... yeschecking for stdint.h... yeschecking for unistd.h... 
yeschecking for dlfcn.h... nochecking for objdir... .libschecking if gcc 
supports -fno-rtti -fno-exceptions... nochecking for gcc option to produce 
PIC... -DDLL_EXPORT -DPICchecking if gcc PIC flag -DDLL_EXPORT -DPIC works... 
yeschecking if gcc static flag -static works... yeschecking if gcc supports -c 
-o file.o... yeschecking if gcc supports -c -o file.o... (cached) yeschecking 
whether the gcc linker 
(C:/ProgramFiles/mingw-w64/x86_64-5.1.0-posix-seh-rt_v4-rev0/mingw64/x86_64-w64-mingw32/bin/ld.exe)
 supports shared libraries... yeschecking dynamic linker characteristics... 
Win32 ld.exechecking how to hardcode library paths into programs... 
immediatechecking whether stripping libraries is possible... yeschecking if 
libtool supports shared libraries... yeschecking whether to build shared 
libraries... yeschecking whether to build static libraries... yeschecking for 
pkg-config... /usr/bin/pkg-configchecking pkg-config is at least version 
0.22... yeschecking for size_t... yeschecking for struct termios2... nochecking 
for struct termiox... nochecking for struct termios.c_ispeed... nochecking for 
struct termios.c_ospeed... nochecking for struct termios2.c_ispeed... 
nochecking for struct termios2.c_ospeed... nochecking for BOTHER... nochecking 
for struct serial_struct... noconfigure: WARNING: cache variable lt_cv_path_LD 
contains a newlinechecking that generated files are newer than configure... 
doneconfigure: creating ./config.statusconfig.status: creating 
Makefileconfig.status: creating libserialport.hconfig.status: creating 
libserialport.pcconfig.status: creating config.hconfig.status: executing 
depfiles commandsconfig.status: executing libtool commands
libserialport configuration summary:
  - Package version (major.minor.micro):    0.1.1  - Library version 
(current:revision:age): 0:0:0  - Prefix: /usr/local  - Building on: 
x86_64-pc-msys  - Building for: x86_64-pc-msys
configure: WARNING: cache variable lt_cv_path_LD contains a newline
$ makeMakefile:296: *** missing separator.  Stop.
Notice where it says checking whether the linker supports shared libraries.   
There's a new line there.   I don't know if this matters.   However, in the 
Makefile, on line 296:, I have:
Files/mingw-w64/x86_64-5.1.0-posix-seh-rt_v4-rev0/mingw64/x86_64-w64-mingw32/bin/ld.exe

On line 295 however, I have:
LD = C:/Program

If I combine them into one line and surround them by double quotes, things 
start to work a bit:LD = "C:/Program 
Files/mingw-w64/x86_64-5.1.0-posix-seh-rt_v4-rev0/mingw64/x86_64-w64-mingw32/bin/ld.exe"
I type make again:$ makemake  all-am  CC       serialport.lo  CCLD     
libserialport.laC:/Program 
Files/mingw-w64/x86_64-5.1.0-posix-seh-rt_v4-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
 cannot find -linkcollect2.exe: error: ld returned 1 exit statusMakefile:505: 
recipe for target 'libserialport.la' failedmake[1]: *** [libserialport.la] 
Error 1Makefile:412: recipe for target 'all' failedmake: *** [all] Error 2
I believe this is an error because I'm under the impression, libserialport 
depends on no third party applications.   Therefore, it's hard for me to 
believe to compile it, I need a library called "ink"   or "libink".   Am I 
correct in thinking this or is there a third party library that I should have 
and don't?

I truly appreciate all the help you've provided.
  From: Uwe Hermann <u...@hermann-uwe.de>
 To: Nacho Man <nacho2...@yahoo.com> 
Cc: "sigrok-devel@lists.sourceforge.net" <sigrok-devel@lists.sourceforge.net> 
 Sent: Friday, August 28, 2015 6:18 AM
 Subject: Re: [sigrok-devel] A question or two about libserialport.
   
Hi,

On Thu, Aug 27, 2015 at 09:00:11PM +0000, Nacho Man wrote:
> I'm sorry if this is the wrong mailing list but I couldn't really find one 
> specifically for libserialport.

No problem, this is the correct one, there's no specific one for


libserialport.


> I had some questions about it and was wondering if anyone here could help.   
> I was looking for some examples, in C source code, of how to use it.   I've 
> been reading the API documentation but I've been having trouble figuring out 
> how to build a program using libserialport.
> 
> If I could just figure out how to scan the system for serial ports, I think 
> I'd be able to figure the rest out myself.  I wouldn't think it'd matter, but 
> my program will be compiled on Windows using MinGW64 (32-bit and 64-bit) and 
> Linux using GNU's gcc.  Thanks.And again, if this is the wrong place, I do 
> apologize.

Here's a quick example to get you started, it'll list all ports it can
detect. Tested on Linux, but libserialport also works fine on Windows.
You need MinGW-w64 (the "old" MinGW will not work).

    #include <stdio.h>
    #include <libserialport.h>
    
    int main(void)
    {
            int i;
            struct sp_port **ports;
    
            sp_list_ports(&ports);
    
            for (i = 0; ports[i]; i++)
                    printf("Found port: '%s'.\n", sp_get_port_name(ports[i]));
    
            sp_free_port_list(ports);
    }


Hope that helps, Uwe.
-- 
http://hermann-uwe.de | http://randomprojects.org | http://sigrok.org


  
------------------------------------------------------------------------------
_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to