Bug 511162 - libjs.pc should specify necessary defines and include paths
Summary: libjs.pc should specify necessary defines and include paths
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: js
Version: 11
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Pavel Alexeev
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-07-13 23:46 UTC by Thomas Sondergaard
Modified: 2009-08-20 17:27 UTC (History)
1 user (show)

Fixed In Version: 1.70-8.el5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-08-03 06:12:56 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Patch that fixes the reported problem. (891 bytes, patch)
2009-07-13 23:51 UTC, Thomas Sondergaard
no flags Details | Diff

Description Thomas Sondergaard 2009-07-13 23:46:06 UTC
Description of problem:
XP_UNIX AND JS_THREADSAFE need to be defined when including headers from js-devel, also /usr/include/nspr4 needs to be in the include search path. These things should be handled by libjs.pc

Comment 1 Thomas Sondergaard 2009-07-13 23:51:34 UTC
Created attachment 351535 [details]
Patch that fixes the reported problem.

Patch tested against my own application only.

Comment 2 Pavel Alexeev 2009-07-31 08:20:16 UTC
Hello, Thomas Sondergaard. Thank you for the report.

(In reply to comment #0)
> Description of problem:
> XP_UNIX AND JS_THREADSAFE need to be defined when including headers from
> js-devel
Why??

>, also /usr/include/nspr4 needs to be in the include search path.
This is not part of js.
$ repoquery --whatprovides /usr/include/nspr4
nspr-devel-0:4.8-1.fc11.i586
nspr-devel-0:4.7.3-5.fc11.i586

You are shure what build js requires nspr-devel??

> These
> things should be handled by libjs.pc
In you patch only release bump and additional defines... According to libjs.pc only log...

What exact trouble you have with js?

Comment 3 Thomas Sondergaard 2009-07-31 18:30:12 UTC
(In reply to comment #2)
> What exact trouble you have with js?  

[ts@roadrunner ~]$ cat minimal.c 
#include <jsapi.h>
#include <jsdate.h>
#include <jsscript.h>

int main() {
  return 0;
}

[ts@roadrunner ~]$ gcc -Wall -g $(pkg-config --libs --cflags libjs) -o minimal minimal.c
In file included from /usr/include/jspubtd.h:45,
                 from /usr/include/jsapi.h:47,
                 from minimal.c:1:
/usr/include/jstypes.h:248:6: error: #error "Must define one of XP_BEOS, XP_OS2, XP_WIN or XP_UNIX"
/usr/include/jstypes.h:264:2: error: #error No suitable type for JSInt8/JSUint8
<snip>


"gcc -Wall -g $(pkg-config --libs --cflags libjs) -DXP_UNIX -o minimal minimal.c" compiles without errors, but since js is built with thread-safety a real example wouldn't work. We need to compile with -DJS_THREADSAFE=1, but when we do that we see that we need nspr-devel:

[ts@roadrunner ~]$ gcc -Wall -g $(PKG_CONFIG_PATH=. pkg-config --libs --cflags play) -DXP_UNIX=1 -DJS_THREADSAFE=1 -o minimal minimal.c
In file included from /usr/include/jsatom.h:53,
                 from /usr/include/jsscript.h:46,
                 from minimal.c:3:
/usr/include/jslock.h:45:20: error: pratom.h: No such file or directory
/usr/include/jslock.h:46:20: error: prlock.h: No such file or directory
/usr/include/jslock.h:47:20: error: prcvar.h: No such file or directory
/usr/include/jslock.h:48:22: error: prthread.h: No such file or directory
<snip>


- pratom.h, prlock.h etc are all from nspr-devel.

In addition to the patch I provided js-devel should also be changed to depend on nspr-devel

Comment 4 Pavel Alexeev 2009-08-01 12:38:47 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > What exact trouble you have with js?  
> 
> [ts@roadrunner ~]$ cat minimal.c 
> #include <jsapi.h>
> #include <jsdate.h>
> #include <jsscript.h>
> 
> int main() {
>   return 0;
> }
> 
> [ts@roadrunner ~]$ gcc -Wall -g $(pkg-config --libs --cflags libjs) -o minimal
> minimal.c
> In file included from /usr/include/jspubtd.h:45,
>                  from /usr/include/jsapi.h:47,
>                  from minimal.c:1:
> /usr/include/jstypes.h:248:6: error: #error "Must define one of XP_BEOS,
> XP_OS2, XP_WIN or XP_UNIX"
> /usr/include/jstypes.h:264:2: error: #error No suitable type for JSInt8/JSUint8
Ok, this error about your program must define one of XP_BEOS,
> XP_OS2, XP_WIN or XP_UNIX, not js self.

> "gcc -Wall -g $(pkg-config --libs --cflags libjs) -DXP_UNIX -o minimal
> minimal.c" compiles without errors, but since js is built with thread-safety a
> real example wouldn't work. We need to compile with -DJS_THREADSAFE=1, but when
> we do that we see that we need nspr-devel:
> 
> [ts@roadrunner ~]$ gcc -Wall -g $(PKG_CONFIG_PATH=. pkg-config --libs --cflags
> play) -DXP_UNIX=1 -DJS_THREADSAFE=1 -o minimal minimal.c
> In file included from /usr/include/jsatom.h:53,
>                  from /usr/include/jsscript.h:46,
>                  from minimal.c:3:
> /usr/include/jslock.h:45:20: error: pratom.h: No such file or directory
> /usr/include/jslock.h:46:20: error: prlock.h: No such file or directory
> /usr/include/jslock.h:47:20: error: prcvar.h: No such file or directory
> /usr/include/jslock.h:48:22: error: prthread.h: No such file or directory
> <snip>
> - pratom.h, prlock.h etc are all from nspr-devel.
I don't known about what program you are speak, but again I think in this situation you programm must have nspr-devel dependency. Why you search it in js?

Comment 5 Thomas Sondergaard 2009-08-01 19:54:36 UTC
(In reply to comment #4)
> Ok, this error about your program must define one of XP_BEOS,
> XP_OS2, XP_WIN or XP_UNIX, not js self.

Only XP_UNIX makes sense for this rpm, so it would be very nice if libjs.pc would be nice enough to define it. According to http://pkg-config.freedesktop.org/wiki/ pkg-config is all about getting the necessary compiler options, so you don't have to hardcode them.

> I don't known about what program you are speak, but again I think in this
> situation you programm must have nspr-devel dependency. Why you search it in
> js?  

What? Look in jsatom.h - it includes pratom.h. Obviously js-devel depends on nspr-devel!


To recap.

1) libjs.pc should define XP_UNIX because that is the only option that makes sense in a fedora rpm and we want such necessary defines specified for us via pkg-config, so library users don't have to hardcode them.

2) When js is compile with JS_THREADSAFE=1, which it is, then it depends on nspr - this dependency is already present in the rpm, *and* js-devel depends on nspr-devel for pratom.h etc.

Comment 6 Pavel Alexeev 2009-08-02 11:28:38 UTC
(In reply to comment #5)
> Only XP_UNIX makes sense for this rpm, so it would be very nice if libjs.pc
> would be nice enough to define it.
Ok, you are right, in particular Fedora package we can define it.

> 2) When js is compile with JS_THREADSAFE=1, which it is,
As I can understand you are suggest compile js with it, now it is compiled without.

And I don't understand why we need recompile it with this define. Please, can you more describe that?


BTW, did you speaking with upstream about this two things???

Comment 7 Thomas Sondergaard 2009-08-02 13:30:50 UTC
(In reply to comment #6)

> > 2) When js is compile with JS_THREADSAFE=1, which it is,
> As I can understand you are suggest compile js with it, now it is compiled
> without.

js-1.70-5.fc11 already *is* compiled with JS_THREADSAFE=1. Look in the .spec for JS_THREADSAFE.

> BTW, did you speaking with upstream about this two things???  

This has nothing to do with upstream. If JS_THREADSAFE was defined when libjs.so was built it needs to be defined when applications include headers from js-devel.

Comment 8 Pavel Alexeev 2009-08-02 17:26:47 UTC
Ok, I think I understand you. Thank you for the patience and descriptions (I'm new maintainer of js, and it will first my update).

Updates follow.

Comment 9 Fedora Update System 2009-08-02 19:13:10 UTC
js-1.70-8.fc10 has been submitted as an update for Fedora 10.
http://admin.fedoraproject.org/updates/js-1.70-8.fc10

Comment 10 Fedora Update System 2009-08-02 19:13:43 UTC
js-1.70-8.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/js-1.70-8.fc11

Comment 11 Fedora Update System 2009-08-02 19:14:18 UTC
js-1.70-8.el5 has been submitted as an update for Fedora EPEL 5.
http://admin.fedoraproject.org/updates/js-1.70-8.el5

Comment 12 Fedora Update System 2009-08-19 23:13:21 UTC
js-1.70-8.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2009-08-19 23:16:57 UTC
js-1.70-8.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2009-08-20 17:27:33 UTC
js-1.70-8.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.