Build ROHC library with tcc

Bug #799206 reported by Didier Barvaux
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
rohc
Status tracked in Rohc-main
Rohc-1.5.x
Fix Released
Wishlist
Didier Barvaux
Rohc-main
Fix Released
Wishlist
Didier Barvaux

Bug Description

It would be great if the ROHC library could be built with the tcc compiler.

tags: added: library
Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

The problem was reported to tinycc developers: http://lists.gnu.org/archive/html/tinycc-devel/2011-04/msg00015.html
The problem is fixed upstream, but no official release contains the fix.

Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

How to install git version of tinycc:
$ git clone git://repo.or.cz/tinycc.git
$cd tinycc
$ ./configure --prefix=/tmp/tcc --cc=gcc --cpu=x86
$ make
$ make install
$ /tmp/tcc/bin/tcc -v
tcc version 0.9.25

Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

Trying to build the library with git version of tcc:

$ CC=/tmp/tcc/bin/tcc LD=/tmp/tcc/bin/tcc ./autogen.sh
[everything's fine]
$ make CC=/tmp/tcc/bin/tcc LD=/tmp/tcc/bin/tcc clean all
[everything's fine, cool!]
$ make CC=/tmp/tcc/bin/tcc LD=/tmp/tcc/bin/tcc check
[...]
make check-TESTS
make[4]: Entering directory `<path>/rohc-main/test/robustness/empty_payload'
FAIL: test_empty_payload_ir.sh
FAIL: test_empty_payload_irdyn.sh
FAIL: test_empty_payload_uo0.sh
FAIL: test_empty_payload_uo0_iponlyprofile.sh
FAIL: test_empty_payload_uo0_udpprofile.sh
FAIL: test_empty_payload_uo1.sh
FAIL: test_empty_payload_uor2.sh
===========================================
7 of 7 tests failed
Please report to http://launchpad.net/rohc/
===========================================
make[4]: *** [check-TESTS] Error 1
make[4]: Leaving directory `<path>/rohc-main/test/robustness/empty_payload'
make[3]: *** [check-am] Error 2
make[3]: Leaving directory `<path>/rohc-main/test/robustness/empty_payload'
make[2]: *** [check-recursive] Error 1
make[2]: Leaving directory `<path>/rohc-main/test/robustness'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `<path>/rohc-main/test'
make: *** [check-recursive] Error 1

$ ./test/robustness/empty_payload/test_empty_payload_ir.sh verbose verbose
[rohc_comp.c:147 rohc_alloc_compressor()] creating compressor
[rohc_comp.c:1519 c_alloc_contexts()] enlarge the context array from 0 to 4 elements (MAX_CID = 15)
enable all compression profiles
packet #1:
 packet is valid
[ip.c:77 ip_create()] bad IP header size (20 bytes)
[ERROR] [rohc_comp.c:349 rohc_compress()] cannot create the outer IP header
 failed to compress IP packet
[rohc_comp.c:243 rohc_free_compressor()] free contexts
[rohc_comp.c:247 rohc_free_compressor()] free feedback buffer

Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

Problem seems related to the lengths of bit-fields in the iphdr struct defined by netinet/ip.h.

Question asked to the tinycc ML: http://lists.gnu.org/archive/html/tinycc-devel/2012-05/msg00019.html

Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

Revision 370 adds a configure check for bit-fields lengths. This way compilers that will generates unexpected code for the library are detected earlier.

$ CC=/tmp/tcc/bin/tcc LD=/tmp/tcc/bin/tcc ./autogen.sh
[...]
checking whether the compiler computes bit-field lengths as expected... no
configure: error: in `/home/didier/documents/tech/dev/rohc/rohc-main':
configure: error: The compiler does not behave as expect for bit-field lengths, it would break the library
See `config.log' for more details

$ CC=gcc LD=gcc ./autogen.sh
[...]
checking whether the compiler computes bit-field lengths as expected... yes
[...]

$ CC=clang LD=clang ./autogen.sh
[...]
checking whether the compiler computes bit-field lengths as expected... yes
[...]

Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

Attach patch for TCC in order to pack bit fields the way GCC does.

Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

With the attached patch for TCC, some warnings were encountered in the library and the non-regression tests segfault. The warnings were easy to fix (see http://bazaar.launchpad.net/~didier-barvaux/rohc/main/revision/530) but the segfaults are caused by a bug in TCC (see http://lists.nongnu.org/archive/html/tinycc-devel/2012-10/msg00029.html).

Revision history for this message
Didier Barvaux (didier-barvaux) wrote :
Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

Re-schedule for 1.6.0 since upstreams bugs will (probably) not be fixed soon.

Revision history for this message
Didier Barvaux (didier-barvaux) wrote :

Not really a bugfix. The ROHC library has no strong requirement on bitfields anymore (struct iphdr embedded for MinGW/FreeBSD builds, then modified to use uint8_t instead of unsigned int for MinGW 4.7), so the configure check is now useless and TCC builds the library fine.

See http://bazaar.launchpad.net/~didier-barvaux/rohc/main/revision/629 for main branch.
See http://bazaar.launchpad.net/~didier-barvaux/rohc/1.5.x/revision/552 for 1.5.x branch.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.