Bug 1153786

Summary: pjproject on arm should force PJ_IS_LITTLE_ENDIAN
Product: [Fedora] Fedora Reporter: George Joseph <g.devel>
Component: pjprojectAssignee: Jared Smith <jsmith.fedora>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 20CC: jsmith.fedora, pbrobinson
Target Milestone: ---   
Target Release: ---   
Hardware: armv7hl   
OS: Linux   
Whiteboard:
Fixed In Version: pjproject-2.3-5.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-06 04:02:55 UTC Type: Bug
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: 245418    
Attachments:
Description Flags
Patch for arm endianess none

Description George Joseph 2014-10-16 18:20:11 UTC
Description of problem:

Since the arm platform in general is bi-endian, pjproject config.h doesn't set either the PJ_IS_LITTLE_ENDIAN or PJ_IS_BIG_ENDIAN flags which means that at app compile time, you have to set them.  Since Fedora is released only for little endian on arm, a patch to config.h to set PJ_IS_LITTLE_ENDIAN=1 and PJ_IS_BIG_ENDIAN=0 for arm would save a little work when compiling apps against pjproject.

Version-Release number of selected component (if applicable):

pjprokect-2.3-2.fc20

How reproducible:

Continually

Steps to Reproduce:
1.  Install pjproject on an arm platform
2.  Compile an app against pjproject
3.

Actual results:

You'll see 

/usr/include/pj/config.h:248:6: error: #error Endianness must be declared for this processor
 #    error Endianness must be declared for this processor

Expected results:

No error

Additional info:

Comment 1 Peter Robinson 2014-10-16 22:34:50 UTC
In reality the pjproject should detect this at compile time and set it as appropriate like all other projects do. ARM isn't the only architecture that is endian agnostic. MIPs, PPC are as well.

Comment 2 George Joseph 2014-10-16 23:12:15 UTC
True. Since you're never going to mix endianesses between pjproject and the app  AC_C_BIGENDIAN in the pjproject configure is probably a better way to go.

Comment 3 Peter Robinson 2014-10-16 23:22:41 UTC
(In reply to George Joseph from comment #2)
> True. Since you're never going to mix endianesses between pjproject and the
> app  AC_C_BIGENDIAN in the pjproject configure is probably a better way to
> go.

It's not really possibly to mix endianess at the library/app level. You have to have one or the other so it should just be detected and dealt with, it's not something that should ever need to be in config files. Having dealt with ARM and PPC (both BE and LE in Fedora) there's no other package I'm aware of that doesn't just deal with this automatically at compile time

Comment 4 George Joseph 2014-10-16 23:33:45 UTC
(In reply to Peter Robinson from comment #3)
> (In reply to George Joseph from comment #2)
> > True. Since you're never going to mix endianesses between pjproject and the
> > app  AC_C_BIGENDIAN in the pjproject configure is probably a better way to
> > go.
> 
> It's not really possibly to mix endianess at the library/app level. You have
> to have one or the other so it should just be detected and dealt with, it's
> not something that should ever need to be in config files. Having dealt with
> ARM and PPC (both BE and LE in Fedora) there's no other package I'm aware of
> that doesn't just deal with this automatically at compile time

I *think* that's just what I said but when you say 'automatically' what do you mean?  pjproject itself I believe needs to be endian-aware in some of the codecs.

Comment 5 George Joseph 2014-10-17 21:10:00 UTC
Jared...

The test build didn't work.  You can tell by looking in /usr/include/pj/config.h.  It still has...

#elif defined (PJ_M_ARMV4) || defined(ARM) || defined(_ARM_) ||  \
	defined(ARMV4) || defined(__arm__)
    /*
     * ARM, bi-endian, so raise error if endianness is not configured
     */
#   undef PJ_M_ARMV4
#   define PJ_M_ARMV4		1
#   define PJ_M_NAME		"armv4"
#   define PJ_HAS_PENTIUM	0
#   if !PJ_IS_LITTLE_ENDIAN && !PJ_IS_BIG_ENDIAN
#   	error Endianness must be declared for this processor
#   endif

It should have the definitions instead of the test and error.

#   define PJ_IS_LITTLE_ENDIAN	1
#   define PJ_IS_BIG_ENDIAN	0

Comment 6 George Joseph 2014-10-19 23:48:05 UTC
Created attachment 948341 [details]
Patch for arm endianess

Here's a patch that modified config.h to automatically set the PJ flags for ARM if __BYTE_ORDER__ is set.  If __BYTE_ORDER__ isn't set, the old behavior applies which gives you the error if you haven't explicitly set it.

Yo you can probably push this upstream.

Comment 7 Fedora Update System 2014-11-11 13:28:05 UTC
pjproject-2.3-5.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/pjproject-2.3-5.fc21

Comment 8 Fedora Update System 2014-11-11 13:29:04 UTC
pjproject-2.3-5.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/pjproject-2.3-5.fc20

Comment 9 Fedora Update System 2014-11-11 13:29:36 UTC
pjproject-2.3-5.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/pjproject-2.3-5.fc19

Comment 10 Fedora Update System 2014-11-11 13:30:32 UTC
pjproject-2.3-5.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/pjproject-2.3-5.el6

Comment 11 Fedora Update System 2014-11-12 23:17:16 UTC
Package pjproject-2.3-5.el6:
* should fix your issue,
* was pushed to the Fedora EPEL 6 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=epel-testing pjproject-2.3-5.el6'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-EPEL-2014-3991/pjproject-2.3-5.el6
then log in and leave karma (feedback).

Comment 12 Fedora Update System 2015-01-22 22:19:06 UTC
pjproject-2.3-6.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/pjproject-2.3-6.fc21

Comment 13 Fedora Update System 2015-01-22 23:00:07 UTC
pjproject-2.3-6.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/pjproject-2.3-6.fc20

Comment 14 Fedora Update System 2015-02-06 04:02:55 UTC
pjproject-2.3-6.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2015-02-06 04:04:12 UTC
pjproject-2.3-6.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2015-04-01 01:54:52 UTC
pjproject-2.3-5.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.