Bug 69926

Summary: Infinite recursion in <ptlib.h>
Product: [Retired] Red Hat Raw Hide Reporter: Alec Voropay <alec>
Component: pwlibAssignee: Alexander Larsson <alexl>
Status: CLOSED NOTABUG QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 1.0CC: alec
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
URL: http://www.openh323.org/code.html
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-08-01 12:35:41 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 67218    

Description Alec Voropay 2002-07-26 14:45:56 UTC
Description of Problem:
It is impossible to compile any "pwlib" app.
#include <ptlib.h>
produces infinite loop


Version-Release number of selected component (if applicable):
pwlib-devel-1.3.3-2
pwlib-1.3.3-2


How Reproducible:
Try to compile any "pwlib" app


Steps to Reproduce:
1. Install
pwlib-devel-1.3.3-2
pwlib-1.3.3-2

2. Tiny "pwlib" app:  "a.cxx"
====
#include <ptlib.h>
main (){};
====

3. "pwlib-style" Makefile
====
PROG    = a
SOURCES = a.cxx
include $(PWLIBDIR)/make/ptlib.mak
====

4.
$ export PWLIBDIR=/usr/share/pwlib

5.
$ make opt


Actual Results:

It goes into infinite include loop:

[root@monitor a]# make opt
g++ -Wall -DP_LINUX -mcpu=i686 -D_REENTRANT -DP_HAS_SEMAPHORES -DP_SSL -
I/usr/include/include -I/usr/include/crypto -DP_EXPAT -DP_PTHREADS -
DPHAS_TEMPLATES -DPBYTE_ORDER=PLITTLE_ENDIAN -
I/usr/share/pwlib/include/ptlib/unix -I/usr/share/pwlib/include -O3 -DNDEBUG  -
c a.cxx -o obj_linux_x86_r/a.o
In file included from /usr/include/ptlib/ptime.h:634,
                 from /usr/include/ptlib/ptime.h:634,
                 from /usr/include/ptlib/ptime.h:634,
                 from /usr/include/ptlib/ptime.h:634,
......................
......................
                 from /usr/include/ptlib/ptime.h:634,
                 from /usr/include/ptlib/ptime.h:634,
                 from /usr/include/ptlib.h:142,
                 from a.cxx:1:
/usr/include/ptlib/ptime.h:126:18: #include nested too deeply
/usr/include/ptlib/ptime.h:634:25: #include nested too deeply
In file included from /usr/include/ptlib/timeint.h:455,
                 from /usr/include/ptlib/timeint.h:455,
                 from /usr/include/ptlib/timeint.h:455,
                 from /usr/include/ptlib/timeint.h:455,


Expected Results:
Should compile

Additional Information:

See next post

Comment 1 Alec Voropay 2002-07-26 14:56:42 UTC
Pay attention to files included in "/usr/include/ptlib.h"
For example line 142:
#include <ptlib/ptime.h>

 This file ""/usr/include/ptlib/ptime.h" RECURSIVELY calls
himself. Look at the end :

// Include platform dependent part of class
#include <ptlib/ptime.h>


 This line should call PLATFORM DEPENDENT .h  !!!

#include <ptlib/unix/ptlib/ptime.h>






Comment 2 Alec Voropay 2002-08-01 08:08:30 UTC
There is another way : to do full set of symlinks in PWLIBDIR directory.

Changed pwlib.spec  (I've added -m644 permission for include/*.h)

=======================================

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/bin
mkdir -p $RPM_BUILD_ROOT/usr/lib
mkdir -p $RPM_BUILD_ROOT/usr/include/ptclib
mkdir -p $RPM_BUILD_ROOT/usr/include/ptlib/unix/ptlib
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/%{name}/make
cp -d lib/*so* $RPM_BUILD_ROOT/usr/lib
install -m 644 include/ptlib.h $RPM_BUILD_ROOT/usr/include
install -m 644 include/ptlib/*.h $RPM_BUILD_ROOT/usr/include/ptlib/
install -m 644 include/ptlib/*.inl $RPM_BUILD_ROOT/usr/include/ptlib/
install -m 644 include/ptlib/unix/ptlib/*.h 
$RPM_BUILD_ROOT/usr/include/ptlib/unix/ptli
b
install -m 644 include/ptlib/unix/ptlib/*.inl 
$RPM_BUILD_ROOT/usr/include/ptlib/unix/pt
lib
install -m 644 include/ptclib/*.h $RPM_BUILD_ROOT/usr/include/ptclib/
install tools/asnparser/obj_linux_*/asnparser $RPM_BUILD_ROOT/usr/bin


ln -s $RPM_BUILD_ROOT/%{_datadir}/%{name}/include  /usr/include
ln -s $RPM_BUILD_ROOT/%{_datadir}/%{name}/lib  /usr/lib
ln -s $RPM_BUILD_ROOT/%{_datadir}/%{name}/bin  /usr/bin
mkdir $RPM_BUILD_ROOT/%{_datadir}/%{name}/tools
ln -s $RPM_BUILD_ROOT/%{_datadir}/%{name}/tools/asnparser  /usr/bin



Comment 3 Alec Voropay 2002-08-01 12:35:35 UTC
Sorry,  ln -s  src  dst  .....

ln -s /usr/include $RPM_BUILD_ROOT/%{_datadir}/%{name}/include
ln -s /usr/lib     $RPM_BUILD_ROOT/%{_datadir}/%{name}/lib
ln -s /usr/bin     $RPM_BUILD_ROOT/%{_datadir}/%{name}/bin  
mkdir $RPM_BUILD_ROOT/%{_datadir}/%{name}/tools
ln -s /usr/bin     $RPM_BUILD_ROOT/%{_datadir}/%{name}/tools/asnparser  


Comment 4 Alexander Larsson 2002-08-07 09:37:46 UTC
Due to stupid naming on the part of the pwlib team you need to list
-I/usr/include/ptlib/unix/ before /usr/include (which is last by default).

"g++ -I/usr/include/ptlib/unix/ a.cxx" works for me.