You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Paul Querna <pa...@querna.org> on 2009/10/30 11:45:37 UTC

[patch] portability / start of osx port

patchset online: <http://people.apache.org/~pquerna/ts/patches/portable-v1/>

17 patches, and I can get both libinkevent.a and libinktomi++.a.  The
Kqueue code will definitely need a rewrite, as I did an absolutely
terrible malloc and iteration of the results, but it should be enough
for now to move on to other portability issues.

I have not tested on linux with this patchset.

proxy/* doesn't compile yet, not really started on it.

Feedback?

Thanks,

Paul

Re: [patch] portability / start of osx port

Posted by Bryan Call <bc...@yahoo-inc.com>.
After applying your patches I am getting this error when compiling on 
Fedora 11:

[bcall@snowball debug]$ gmake
Making all in libinktomi++
gmake[1]: Entering directory 
`/home/bcall/dev/traffic/release_2_0/debug/libinktomi++'
ccache /usr/bin/g++ -DPACKAGE_NAME=\"Traffic\ Server\" 
-DPACKAGE_TARNAME=\"trafficserver\" -DPACKAGE_VERSION=\"2.0.0\" 
-DPACKAGE_STRING=\"Traffic\ Server\ 2.0.0\" 
-DPACKAGE_BUGREPORT=\"trafficserver-dev@incubator.apache.org\" 
-DPACKAGE=\"trafficserver\" -DVERSION=\"2.0.0\" -DHOST_OS=linux 
-DBUILD_PERSON=\"bcall\" -DBUILD_MACHINE=\"snowball.fodder.org\" 
-DDEBUG=1 -DMODULARIZED=1 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE=1 
-D_REENTRANT=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 
-DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 
-DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 
-DHAVE_SYS_EPOLL_H=1 -DHAVE_ENDIAN_H=1 -DHAVE_SYS_SYSINFO_H=1 
-DHAVE_SYS_SYSCTL_H=1 -DHAVE_NETINET_IP_H=1 -DHAVE_SYS_IOCTL_H=1 
-DHAVE_SYS_SYSCTL_H=1 -DHAVE_SYS_SYSINFO_H=1 
-DHAVE_ARPA_NAMESER_COMPAT_H=1 -DHAVE_DB_185_H=1 -DHAVE_DB_H=1 
-DHAVE_EXECINFO_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_NETINET_IN_H=1 
-DHAVE_ARPA_INET_H=1 -DHAVE_NETDB_H=1 -DHAVE_STDLIB_H=1 
-DHAVE_SYS_SOCKET_H=1 -DHAVE_LIBSSL=1 -DHAVE_ATOMIC_BUILTINS=1 
-DHAVE_EPOLL_CREATE=1 -DHTTP_CACHE=1 -I. 
-I../../external-apache/libinktomi++     -ggdb3 -m32 -Wall -Werror 
-Wno-char-subscripts -Wno-write-strings -Wno-invalid-offsetof  
-march=pentium -MT ink_inet.o -MD -MP -MF .deps/ink_inet.Tpo -c -o 
ink_inet.o ../../external-apache/libinktomi++/ink_inet.cc
.../../external-apache/libinktomi++/ink_inet.cc: In function ‘hostent* 
ink_gethostbyname_r(char*, ink_gethostbyname_r_data*)’:
.../../external-apache/libinktomi++/ink_inet.cc:62: error: cannot convert 
‘int*’ to ‘hostent**’ for argument ‘5’ to ‘int gethostbyname_r(const 
char*, hostent*, char*, size_t, hostent**, int*)’
.../../external-apache/libinktomi++/ink_inet.cc: In function ‘hostent* 
ink_gethostbyaddr_r(char*, int, int, ink_gethostbyaddr_r_data*)’:
.../../external-apache/libinktomi++/ink_inet.cc:83: error: cannot convert 
‘int*’ to ‘hostent**’ for argument ‘7’ to ‘int gethostbyaddr_r(const 
void*, __socklen_t, int, hostent*, char*, size_t, hostent**, int*)’
gmake[1]: *** [ink_inet.o] Error 1
gmake[1]: Leaving directory 
`/home/bcall/dev/traffic/release_2_0/debug/libinktomi++'
gmake: *** [all-recursive] Error 1

-Bryan

On 10/30/2009 12:24 PM, Paul Querna wrote:
> Updated patchset at:
> <http://people.apache.org/~pquerna/ts/patches/portable-v2/>
>
> (note, some of the fixes aren't in the right 'order'... I didn't use
> the mq hg extension when I should of... oh well.)
>
> On Fri, Oct 30, 2009 at 9:20 AM, Leif Hedstrom<le...@yahoo-inc.com>  wrote:
>    
>> Awesome! A few questions right away:
>>
>> *_Patch 1:_* Can we be sure these defines are valid for any platform where
>> ETIME / ENOTSUP isn't defined (I have no idea if there are such cases)?
>> Maybe be more defensive, and do something like
>>
>>    #ifndef ETIME
>>    #ifdef ETIMEDOUT
>>    #define ETIME ETIMEDOUT
>>    #endif
>>    #endif
>>
>> And let it fail on platforms without ETIMEDOUT ?
>>      
> Yeah, changed it to do this in the new #18.
>
>    
>> With this patch, I get a
>> warning from autoreconfig:
>>    /usr/share/aclocal/autotrace.m4:7: warning: underquoted definition of
>> AM_PATH_AUTOTRACE
>>    /usr/share/aclocal/autotrace.m4:7:   run info '(automake)Extending
>> aclocal'
>>    /usr/share/aclocal/autotrace.m4:7:   or see
>> http://sources.redhat.com/automake/automake.html#Extending-aclocal
>>
>> It still builds though.
>>      
> This is just automake being stupid.  Its a harmless warming, and in
> this case, being generated from 3rd party m4 code.
>
>    
>> *_Patch 2:_* Does this imply that we don't require BDB any more?? I didn't
>> think that was the case, but maybe Andrew or someone in the team knows?  As
>> for the glibc-devel check, any way we can do that in a cross platform way?
>>      
> Fixed in new #18. Will error out if no DB interface is found.  the
> SimpleDBM wrapper still exists, its just that a DB-equiv is sometimes
> available in the core libc.
>
> I don't think the glibc function check is needed at all, eveything
> else we are testing for will tell if simple basics like the compiler
> works.
>
>    
>> _*Patch 4:*_ Looks complicated, but using compiler support for the atomic
>> stuff seems like a great idea. But, this fails on Linux for me:
>>
>> gmake[1]: *** No rule to make target `ink_atomic.o', needed by
>> `libinktomi++.a'.  Stop.
>> gmake[1]: Leaving directory
>> `/export/apache/trafficserver/traffic/trunk.pquerna/libinktomi++'
>> gmake: *** [all-recursive] Error 1
>>      
> D'oh, my patch file was missing the *new* file, ink_atomic.cc.
> Included in the new patch set's #18.
>
>    
>> *_Patch 6:_* This breaks my build on Linux, with
>>
>>     unused-debug-symbols -fno-strict-aliasing -Wno-invalid-offsetof
>>   -march=pentium -MT Allocator.o -MD -MP -MF .deps/Allocator.Tpo -c -o
>> Allocator.o Allocator.cc
>>     In file included from SimpleDBM.h:54,
>>                      from inktomi++.h:139,
>>                      from Allocator.cc:33:
>>     /usr/include/db.h:142: error: conflicting declaration ‘typedef struct
>> __db_dbt DBT’
>>     /usr/include/db_185.h:93: error: ‘DBT’ has a previous declaration as
>> ‘typedef struct DBT DBT’
>>     /usr/include/db.h:1371: error: conflicting declaration ‘DB_BTREE’
>>     /usr/include/db_185.h:108: error: ‘DB_BTREE’ has a previous declaration
>> as ‘DBTYPE DB_BTREE’
>>     /usr/include/db.h:1372: error: conflicting declaration ‘DB_HASH’
>>     /usr/include/db_185.h:108: error: ‘DB_HASH’ has a previous declaration as
>> ‘DBTYPE DB_HASH’
>>     /usr/include/db.h:1373: error: conflicting declaration ‘DB_RECNO’
>>     /usr/include/db_185.h:108: error: ‘DB_RECNO’ has a previous declaration
>> as ‘DBTYPE DB_RECNO’
>>     /usr/include/db.h:1376: error: conflicting declaration ‘typedef enum
>> DBTYPE DBTYPE’
>>     /usr/include/db_185.h:108: error: ‘DBTYPE’ has a previous declaration as
>> ‘typedef enum DBTYPE DBTYPE’
>>     /usr/include/db.h:1502: error: redefinition of ‘struct __db’
>>     /usr/include/db_185.h:111: error: previous definition of ‘struct __db’
>>     gmake[1]: *** [Allocator.o] Error 1
>>     gmake[1]: Leaving directory
>> `/export/apache/trafficserver/traffic/trunk.pquerna.test/libinktomi++'
>>     gmake: *** [all-recursive] Error 1
>>      
> fixed in patch 18.  Now only include one header, if both are found.
>
>    
>> _*Patch 7:*_ With this patch, the configure warning from above changes to:
>>
>>    build-aux/apr_network.m4:24: warning: underquoted definition of
>> APR_TYPE_IN_ADDR
>>    build-aux/apr_network.m4:24:   run info '(automake)Extending aclocal'
>>    build-aux/apr_network.m4:24:   or see
>> http://sources.redhat.com/automake/automake.html#Extending-aclocal
>>      
> fixed.
>
>    
>> and the build then fails (on linux):
>>     ink_inet.cc: In function ‘hostent* ink_gethostbyname_r(char*,
>> ink_gethostbyname_r_data*)’:
>>     ink_inet.cc:62: error: cannot convert ‘int*’ to ‘hostent**’ for argument
>> ‘5’ to ‘int gethostbyname_r(const char*, hostent*, char*, size_t, hostent**,
>> int*)’
>>     ink_inet.cc: In function ‘hostent* ink_gethostbyaddr_r(char*, int, int,
>> ink_gethostbyaddr_r_data*)’:
>>     ink_inet.cc:83: error: cannot convert ‘int*’ to ‘hostent**’ for argument
>> ‘7’ to ‘int gethostbyaddr_r(const void*, __socklen_t, int, hostent*, char*,
>> size_t, hostent**, int*)’
>>     gmake[1]: *** [ink_inet.o] Error 1
>>     gmake[1]: Leaving directory
>> `/export/apache/trafficserver/traffic/trunk.pquerna.test/libinktomi++'
>>     gmake: *** [all-recursive] Error 1
>>      
> This looks like GETHOSTBYNAME_R_GLIBC2 isn't defined.
>
> This was caused by the headers not being detected before the check for
> the gethostbyname check was ran. Fixed in patch #19.
>    



Re: [patch] portability / start of osx port

Posted by Paul Querna <pa...@querna.org>.
Updated patchset at:
<http://people.apache.org/~pquerna/ts/patches/portable-v2/>

(note, some of the fixes aren't in the right 'order'... I didn't use
the mq hg extension when I should of... oh well.)

On Fri, Oct 30, 2009 at 9:20 AM, Leif Hedstrom <le...@yahoo-inc.com> wrote:
> Awesome! A few questions right away:
>
> *_Patch 1:_* Can we be sure these defines are valid for any platform where
> ETIME / ENOTSUP isn't defined (I have no idea if there are such cases)?
> Maybe be more defensive, and do something like
>
>   #ifndef ETIME
>   #ifdef ETIMEDOUT
>   #define ETIME ETIMEDOUT
>   #endif
>   #endif
>
> And let it fail on platforms without ETIMEDOUT ?

Yeah, changed it to do this in the new #18.

> With this patch, I get a
> warning from autoreconfig:
>   /usr/share/aclocal/autotrace.m4:7: warning: underquoted definition of
> AM_PATH_AUTOTRACE
>   /usr/share/aclocal/autotrace.m4:7:   run info '(automake)Extending
> aclocal'
>   /usr/share/aclocal/autotrace.m4:7:   or see
> http://sources.redhat.com/automake/automake.html#Extending-aclocal
>
> It still builds though.

This is just automake being stupid.  Its a harmless warming, and in
this case, being generated from 3rd party m4 code.

> *_Patch 2:_* Does this imply that we don't require BDB any more?? I didn't
> think that was the case, but maybe Andrew or someone in the team knows?  As
> for the glibc-devel check, any way we can do that in a cross platform way?

Fixed in new #18. Will error out if no DB interface is found.  the
SimpleDBM wrapper still exists, its just that a DB-equiv is sometimes
available in the core libc.

I don't think the glibc function check is needed at all, eveything
else we are testing for will tell if simple basics like the compiler
works.

> _*Patch 4:*_ Looks complicated, but using compiler support for the atomic
> stuff seems like a great idea. But, this fails on Linux for me:
>
> gmake[1]: *** No rule to make target `ink_atomic.o', needed by
> `libinktomi++.a'.  Stop.
> gmake[1]: Leaving directory
> `/export/apache/trafficserver/traffic/trunk.pquerna/libinktomi++'
> gmake: *** [all-recursive] Error 1

D'oh, my patch file was missing the *new* file, ink_atomic.cc.
Included in the new patch set's #18.

> *_Patch 6:_* This breaks my build on Linux, with
>
>    unused-debug-symbols -fno-strict-aliasing -Wno-invalid-offsetof
>  -march=pentium -MT Allocator.o -MD -MP -MF .deps/Allocator.Tpo -c -o
> Allocator.o Allocator.cc
>    In file included from SimpleDBM.h:54,
>                     from inktomi++.h:139,
>                     from Allocator.cc:33:
>    /usr/include/db.h:142: error: conflicting declaration ‘typedef struct
> __db_dbt DBT’
>    /usr/include/db_185.h:93: error: ‘DBT’ has a previous declaration as
> ‘typedef struct DBT DBT’
>    /usr/include/db.h:1371: error: conflicting declaration ‘DB_BTREE’
>    /usr/include/db_185.h:108: error: ‘DB_BTREE’ has a previous declaration
> as ‘DBTYPE DB_BTREE’
>    /usr/include/db.h:1372: error: conflicting declaration ‘DB_HASH’
>    /usr/include/db_185.h:108: error: ‘DB_HASH’ has a previous declaration as
> ‘DBTYPE DB_HASH’
>    /usr/include/db.h:1373: error: conflicting declaration ‘DB_RECNO’
>    /usr/include/db_185.h:108: error: ‘DB_RECNO’ has a previous declaration
> as ‘DBTYPE DB_RECNO’
>    /usr/include/db.h:1376: error: conflicting declaration ‘typedef enum
> DBTYPE DBTYPE’
>    /usr/include/db_185.h:108: error: ‘DBTYPE’ has a previous declaration as
> ‘typedef enum DBTYPE DBTYPE’
>    /usr/include/db.h:1502: error: redefinition of ‘struct __db’
>    /usr/include/db_185.h:111: error: previous definition of ‘struct __db’
>    gmake[1]: *** [Allocator.o] Error 1
>    gmake[1]: Leaving directory
> `/export/apache/trafficserver/traffic/trunk.pquerna.test/libinktomi++'
>    gmake: *** [all-recursive] Error 1

fixed in patch 18.  Now only include one header, if both are found.

> _*Patch 7:*_ With this patch, the configure warning from above changes to:
>
>   build-aux/apr_network.m4:24: warning: underquoted definition of
> APR_TYPE_IN_ADDR
>   build-aux/apr_network.m4:24:   run info '(automake)Extending aclocal'
>   build-aux/apr_network.m4:24:   or see
> http://sources.redhat.com/automake/automake.html#Extending-aclocal

fixed.

> and the build then fails (on linux):
>    ink_inet.cc: In function ‘hostent* ink_gethostbyname_r(char*,
> ink_gethostbyname_r_data*)’:
>    ink_inet.cc:62: error: cannot convert ‘int*’ to ‘hostent**’ for argument
> ‘5’ to ‘int gethostbyname_r(const char*, hostent*, char*, size_t, hostent**,
> int*)’
>    ink_inet.cc: In function ‘hostent* ink_gethostbyaddr_r(char*, int, int,
> ink_gethostbyaddr_r_data*)’:
>    ink_inet.cc:83: error: cannot convert ‘int*’ to ‘hostent**’ for argument
> ‘7’ to ‘int gethostbyaddr_r(const void*, __socklen_t, int, hostent*, char*,
> size_t, hostent**, int*)’
>    gmake[1]: *** [ink_inet.o] Error 1
>    gmake[1]: Leaving directory
> `/export/apache/trafficserver/traffic/trunk.pquerna.test/libinktomi++'
>    gmake: *** [all-recursive] Error 1

This looks like GETHOSTBYNAME_R_GLIBC2 isn't defined.

This was caused by the headers not being detected before the check for
the gethostbyname check was ran. Fixed in patch #19.

Re: [patch] portability / start of osx port

Posted by Leif Hedstrom <le...@yahoo-inc.com>.
On 10/30/2009 04:45 AM, Paul Querna wrote:
> patchset online:<http://people.apache.org/~pquerna/ts/patches/portable-v1/>
>
> 17 patches, and I can get both libinkevent.a and libinktomi++.a.  The
> Kqueue code will definitely need a rewrite, as I did an absolutely
> terrible malloc and iteration of the results, but it should be enough
> for now to move on to other portability issues.
>
> I have not tested on linux with this patchset.
>
> proxy/* doesn't compile yet, not really started on it.
>    

Awesome! A few questions right away:

*_Patch 1:_* Can we be sure these defines are valid for any platform 
where ETIME / ENOTSUP isn't defined (I have no idea if there are such 
cases)? Maybe be more defensive, and do something like

    #ifndef ETIME
    #ifdef ETIMEDOUT
    #define ETIME ETIMEDOUT
    #endif
    #endif

And let it fail on platforms without ETIMEDOUT ? With this patch, I get 
a warning from autoreconfig:

    /usr/share/aclocal/autotrace.m4:7: warning: underquoted definition 
of AM_PATH_AUTOTRACE
    /usr/share/aclocal/autotrace.m4:7:   run info '(automake)Extending 
aclocal'
    /usr/share/aclocal/autotrace.m4:7:   or see 
http://sources.redhat.com/automake/automake.html#Extending-aclocal

It still builds though.

*_Patch 2:_* Does this imply that we don't require BDB any more?? I 
didn't think that was the case, but maybe Andrew or someone in the team 
knows?  As for the glibc-devel check, any way we can do that in a cross 
platform way?

_*Patch 3:*_ Looks good (had some problems applying it because I backed 
out patch 2).

_*Patch 4:*_ Looks complicated, but using compiler support for the 
atomic stuff seems like a great idea. But, this fails on Linux for me:

gmake[1]: *** No rule to make target `ink_atomic.o', needed by 
`libinktomi++.a'.  Stop.
gmake[1]: Leaving directory 
`/export/apache/trafficserver/traffic/trunk.pquerna/libinktomi++'
gmake: *** [all-recursive] Error 1


_*Patch 5:*_ Looks good.



*_Patch 6:_* This breaks my build on Linux, with

     unused-debug-symbols -fno-strict-aliasing -Wno-invalid-offsetof  
-march=pentium -MT Allocator.o -MD -MP -MF .deps/Allocator.Tpo -c -o 
Allocator.o Allocator.cc
     In file included from SimpleDBM.h:54,
                      from inktomi++.h:139,
                      from Allocator.cc:33:
     /usr/include/db.h:142: error: conflicting declaration ‘typedef 
struct __db_dbt DBT’
     /usr/include/db_185.h:93: error: ‘DBT’ has a previous declaration 
as ‘typedef struct DBT DBT’
     /usr/include/db.h:1371: error: conflicting declaration ‘DB_BTREE’
     /usr/include/db_185.h:108: error: ‘DB_BTREE’ has a previous 
declaration as ‘DBTYPE DB_BTREE’
     /usr/include/db.h:1372: error: conflicting declaration ‘DB_HASH’
     /usr/include/db_185.h:108: error: ‘DB_HASH’ has a previous 
declaration as ‘DBTYPE DB_HASH’
     /usr/include/db.h:1373: error: conflicting declaration ‘DB_RECNO’
     /usr/include/db_185.h:108: error: ‘DB_RECNO’ has a previous 
declaration as ‘DBTYPE DB_RECNO’
     /usr/include/db.h:1376: error: conflicting declaration ‘typedef 
enum DBTYPE DBTYPE’
     /usr/include/db_185.h:108: error: ‘DBTYPE’ has a previous 
declaration as ‘typedef enum DBTYPE DBTYPE’
     /usr/include/db.h:1502: error: redefinition of ‘struct __db’
     /usr/include/db_185.h:111: error: previous definition of ‘struct __db’
     gmake[1]: *** [Allocator.o] Error 1
     gmake[1]: Leaving directory 
`/export/apache/trafficserver/traffic/trunk.pquerna.test/libinktomi++'
     gmake: *** [all-recursive] Error 1


_*Patch 7:*_ With this patch, the configure warning from above changes to:

    build-aux/apr_network.m4:24: warning: underquoted definition of 
APR_TYPE_IN_ADDR
    build-aux/apr_network.m4:24:   run info '(automake)Extending aclocal'
    build-aux/apr_network.m4:24:   or see 
http://sources.redhat.com/automake/automake.html#Extending-aclocal

and the build then fails (on linux):

     ink_inet.cc: In function ‘hostent* ink_gethostbyname_r(char*, 
ink_gethostbyname_r_data*)’:
     ink_inet.cc:62: error: cannot convert ‘int*’ to ‘hostent**’ for 
argument ‘5’ to ‘int gethostbyname_r(const char*, hostent*, char*, 
size_t, hostent**, int*)’
     ink_inet.cc: In function ‘hostent* ink_gethostbyaddr_r(char*, int, 
int, ink_gethostbyaddr_r_data*)’:
     ink_inet.cc:83: error: cannot convert ‘int*’ to ‘hostent**’ for 
argument ‘7’ to ‘int gethostbyaddr_r(const void*, __socklen_t, int, 
hostent*, char*, size_t, hostent**, int*)’
     gmake[1]: *** [ink_inet.o] Error 1
     gmake[1]: Leaving directory 
`/export/apache/trafficserver/traffic/trunk.pquerna.test/libinktomi++'
     gmake: *** [all-recursive] Error 1


I didn't review anything past this point yet.

-- Leif


Re: [patch] Don't assume tcl.h is in /usr/lib

Posted by Leif Hedstrom <le...@ogre.com>.
On 10/30/2009 04:50 PM, Belmon, Stephane wrote:
> And make the checks have some teeth. tcl.h is in /usr/lib/tclx.y on Ubuntu at least. This assumed TCL>= 8.4, but that's ancient already.
>    

Cool, thanks! I filed bug

    https://issues.apache.org/jira/browse/TS-3


Cheers,

-- leif


[patch] Don't assume tcl.h is in /usr/lib

Posted by "Belmon, Stephane" <sb...@websense.com>.
And make the checks have some teeth. tcl.h is in /usr/lib/tclx.y on Ubuntu at least. This assumed TCL >= 8.4, but that's ancient already.

Index: configure.ac
===================================================================
--- configure.ac        (revision 831451)
+++ configure.ac        (working copy)
@@ -376,8 +376,13 @@
 # -----------------------------------------------------------------------------
 # 5. CHECK FOR HEADER FILES
 
-AC_CHECK_HEADER([execinfo.h],[],[])
+AC_CHECK_HEADER([execinfo.h],[],[AC_MSG_FAILURE(Cannot find execinfo.h)])
 
+SC_PATH_TCLCONFIG
+source $TCL_BIN_DIR/tclConfig.sh
+CPPFLAGS="$CPPFLAGS $TCL_INCLUDE_SPEC"
+AC_CHECK_HEADER([tcl.h],[],[AC_MSG_FAILURE(Cannot find tcl.h)])
+
 #
 # use modular IOCORE 
 #

--
Stephane Belmon


 Protected by Websense Hosted Email Security -- www.websense.com