Boost logo

Boost Users :

Subject: [Boost-users] RE Problems using thread and asio libraries together with Boost 1.36.0 on Cygwin
From: frederic.bron_at_[hidden]
Date: 2008-09-25 10:15:46


I had no issue compiling 1.36 on cygwin although I am not using it.

Why -mwin32 and not -mno-cygwin?

Personnaly, I add threadapi=win32 to BJAM_CONFIG in Makefile (after ./configure).
and I use the following user-config.jam:
using gcc : : : <cflags>-mno-cygwin <cflags>-DBOOST_WINDOWS_API <cxxflags>-mno-cygwin <cxxflags>-DBOOST_WINDOWS_API <compilerflags>-mno-cygwin <compilerflags>-DBOOST_WINDOWS_API <linkflags>-mno-cygwin
;

Regards,

F. Bron
___________________________________
Frédéric Bron (frederic.bron_at_[hidden])
Unité ALT, Alcan CRV, BP 27, 38341 Voreppe
+33 4 76 57 81 72, +33 6 07 48 56 67

boost-users-bounces_at_[hidden] a écrit sur 24/09/2008 22:22:47 :

>
> > I have been using Boost 1.34.1 for quite awhile for a Windows
> > application that uses both the Boost thread and asio libraries. The
> > application builds successfully using gcc 3.4.4 on Cygwin and both
> > MSVC 8.0 and 9.0. Now I am trying to port the application to Boost
> > 1.36.0 and have had some problems with the gcc compiler on Cygwin.
> > The following (or similar) errors have occured when compiling any file
> > that includes a thread library header:
> >
> > ...
> > g++ -o build/ftds/out/OutputManager.o -c -g -mwin32 -mthreads -Wall
> > -ansi -D_REENTRANT -D__STRICT_ANSI__ -D_WIN32_WINNT=0x0501
> > -D__USE_W32_SOCKETS -DWIN32_LEAN_AND_MEAN -DRWDEBUG=1
> > -DRW_MULTI_THREAD -DZAF_BOOL_DEFINED -DZAF_POSIX -DNOMINMAX=1
> > -Iinclude -Ic:/cygwin/home/cvc7986/work/boost_1_36_0
> > -Ic:/rwave/workspaces/winxp/gcc/15s "-Ic:/Program Files/IVI
> > Foundation/VISA/winnt/include" "-Ic:/Program Files/Agilent/IO
> > Libraries Suite/include" -Ic:/zaf530/include
> > source/ftds/out/OutputManager.cpp
> > In file included from /usr/include/cygwin/sys_time.h:13,
> > from /usr/include/sys/time.h:27,
> > from
> > c:/cygwin/home/cvc7986/work/boost_1_36_0/boost/date_time/c_time.hpp:28
> > ,
> > from
> > c:/cygwin/home/cvc7986/work/boost_1_36_0/boost/date_time/microsec_time
> > _clock.hpp:18,
> > from
> > c:/cygwin/home/cvc7986/work/boost_1_36_0/boost/thread/thread_time.hpp:
> > 9,
> > from
> > c:/cygwin/home/cvc7986/work/boost_1_36_0/boost/thread/pthread/timespec
> > .hpp:9,
> > from
> > c:/cygwin/home/cvc7986/work/boost_1_36_0/boost/thread/pthread/conditio
> > n_variable.hpp:8,
> > from
> > c:/cygwin/home/cvc7986/work/boost_1_36_0/boost/thread/condition_variab
> > le.hpp:16,
> > from
> > c:/cygwin/home/cvc7986/work/boost_1_36_0/boost/thread/condition.hpp:9,
> > from include/cds/Server.h:29,
> > from source/ftds/out/OutputManager.cpp:27:
> > /usr/include/sys/select.h:31: error: `fd_set' has not been declared
> > /usr/include/sys/select.h:31: error: `fd_set' has not been declared
> > /usr/include/sys/select.h:31: error: `fd_set' has not been declared
> > /usr/include/sys/select.h:33: error: `fd_set' has not been declared
> > /usr/include/sys/select.h:33: error: `fd_set' has not been declared
> > /usr/include/sys/select.h:33: error: `fd_set' has not been declared
> > In file included from
> > c:/cygwin/home/cvc7986/work/boost_1_36_0/boost/asio/detail/socket_type
> > s.hpp:75,
> > from
> > c:/cygwin/home/cvc7986/work/boost_1_36_0/boost/asio/detail/win_iocp_io
> > _service_fwd.hpp:24,
> > from
> > c:/cygwin/home/cvc7986/work/boost_1_36_0/boost/asio/io_service.hpp:37,
> > from
> > c:/cygwin/home/cvc7986/work/boost_1_36_0/boost/asio/basic_io_object.hp
> > p:20,
> > from
> > c:/cygwin/home/cvc7986/work/boost_1_36_0/boost/asio/basic_datagram_soc
> > ket.hpp:25,
> > from
> > c:/cygwin/home/cvc7986/work/boost_1_36_0/boost/asio.hpp:20,
> > from include/cds/srvr/ConfigurationServer.h:26,
> > from include/cds/Server.h:41,
> > from source/ftds/out/OutputManager.cpp:27:
> > /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.
> > h:109: error: redefinition of `struct timeval'
> > /usr/include/sys/time.h:16: error: previous definition of `struct
> > timeval'
> > /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/winsock2.
> > h:632: error: declaration of C function `int select(int, fd_set*,
> > fd_set*, fd_set*, const timeval*)' conflicts with
> > /usr/include/sys/select.h:31: error: previous declaration `int
> > select(int, int*, int*, int*, timeval*)' here
> > scons: *** [build/ftds/out/OutputManager.o] Error 1
> > ...
> >
> > I was able to determine that the problem was caused by the inclusion
> > of sys/time.h, which includes cygwin/sys_time.h, which then includes
> > sys/select.h. The definition of struct fd_set was prevented in
> > sys/types.h because macro __USE_W32_SOCKETS had been defined, as is
> > required for using the asio library on Cygwin.
> >
> > My temporary solution to the problem was to disable the definition of
> > the BOOST_HAS_GETTIMEOFDAY macro in the Boost header file
> > boost/config/platform/cygwin.hpp and to define BOOST_HAS_FTIME macro
> > instead:
> >
> > $ diff ~/work/boost_1_36_0/boost/config/platform/cygwin.hpp
> > boost/config/platform/cygwin.hpp
> > 27c27,32
> > < # define BOOST_HAS_GETTIMEOFDAY
> > ---
> > > // temp: # define BOOST_HAS_GETTIMEOFDAY
> > > # if !defined(__USE_W32_SOCKETS) // temp
> > > # define BOOST_HAS_GETTIMEOFDAY // temp
> > > # else // temp
> > > # define BOOST_HAS_FTIME // temp
> > > # endif // temp
> >
> > This has solved the problem for me as of now, but it would be good to
> > know if there is a better way to solve this. I was not able to find
> > any references to this problem in any of the Boost lists.
> >
> Thanks in advance,
>
> > Carus V. (Bud) Clarke
> > carus.v.clarke_at_[hidden]
> >
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users

Avis :
Ce message et toute pièce jointe sont la propriété d'Alcan et sont destinés seulement aux personnes ou à l'entité à qui le message est adressé. Si vous avez reçu ce message par erreur, veuillez le
détruire et en aviser l'expéditeur par courriel. Si vous n'êtes pas le destinataire du message, vous n'êtes pas autorisé à utiliser, à copier ou à divulguer le contenu du message ou ses pièces jointes
en tout ou en partie.

Notice:
This message and any attachments are the property of Alcan and are intended solely for the named recipients or entity to whom this message is addressed. If you have received this message in error
please inform the sender via e-mail and destroy the message. If you are not the intended recipient you are not allowed to use, copy or disclose the contents or attachments in whole or in part.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net