Bug #2463
closed__thread storage class for errno may break Firefox 17.0esr C++ compilation
0%
Description
Executing the commands on the file cpperrno.cpp
$ c++ cpperrno.cpp
$ ./a.out
produces the output:
errno = 22
on NetBSD amd64, FreeBSD amd64, and Linux amd64 (Ubuntu 12.04 LTS).
However on DragonFly the output is an error message:
$ c++ cpperrno.cpp
/tmp//ccTk4OGn.o: In function `(anonymous namespace)::__error()':
cpperrno.cpp:(.text+0x10): undefined reference to `(anonymous namespace)::errno'
This matters because the file cpperrno.cpp is a minimal example demonstrating build breakage of current pkgsrc devel/xulrunner for Firefox 17.0esr, as reported in a followup to PR pkg/47233.
The difference appears to be that on DragonFly in file sys/sys/errno.h, there is the declaration:
#if !defined(_KERNEL) || defined(_KERNEL_VIRTUAL)
extern __thread int errno;
Obviously there are reasons to use storage class keyword __thread for errno; nonetheless, the breakage of compilation for Firefox 17.0esr on no platform but DragonFly indicates some alternative solution must be devised for porting C++ userland programs.
/* begin cpperrno.cpp */
namespace {
#pragma GCC visibility push(default)
#include <errno.h>
#pragma GCC visibility pop
void innamespace() {
errno = EINVAL;
}
} /* end namespace */
extern "C" {
void seterrno() {
innamespace();
}
} /* end extern */
#include <stdio.h>
#include <errno.h>
int main() {
seterrno();
printf("errno = %d\n", errno);
return errno;
}
/* end cpperrno.cpp */
Files
Updated by ahuete.devel almost 12 years ago
According to vsrinivas the problem is that our sys/errno.h is a C-only
header. He pointed out the solution would be wrapping errno and
__errno() between BEGIN_DECLS and END_DECLS macros.
2012/11/27 David Shao via Redmine <bugtracker-admin@leaf.dragonflybsd.org>:
Issue #2463 has been reported by David Shao.
----------------------------------------
Bug #2463: __thread storage class for errno may break Firefox 17.0esr C++ compilation
http://bugs.dragonflybsd.org/issues/2463Author: David Shao
Status: New
Priority: Normal
Assignee:
Category:
Target version:Executing the commands on the file cpperrno.cpp
$ c++ cpperrno.cpp
$ ./a.out
produces the output:
errno = 22
on NetBSD amd64, FreeBSD amd64, and Linux amd64 (Ubuntu 12.04 LTS).
However on DragonFly the output is an error message:
$ c++ cpperrno.cpp
/tmp//ccTk4OGn.o: In function `(anonymous namespace)::__error()':
cpperrno.cpp:(.text+0x10): undefined reference to `(anonymous namespace)::errno'This matters because the file cpperrno.cpp is a minimal example demonstrating build breakage of current pkgsrc devel/xulrunner for Firefox 17.0esr, as reported in a followup to PR pkg/47233.
The difference appears to be that on DragonFly in file sys/sys/errno.h, there is the declaration:
#if !defined(_KERNEL) || defined(_KERNEL_VIRTUAL)
extern __thread int errno;Obviously there are reasons to use storage class keyword __thread for errno; nonetheless, the breakage of compilation for Firefox 17.0esr on no platform but DragonFly indicates some alternative solution must be devised for porting C++ userland programs.
/* begin cpperrno.cpp */
namespace {#pragma GCC visibility push(default)
#include <errno.h>
#pragma GCC visibility popvoid innamespace() {
errno = EINVAL;
}} /* end namespace */
extern "C" {
void seterrno() {
innamespace();
}} /* end extern */
#include <stdio.h>
#include <errno.h>int main() {
seterrno();
printf("errno = %d\n", errno);
return errno;
}
/* end cpperrno.cpp */--
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
Updated by swildner almost 12 years ago
- Status changed from New to Feedback
I've changed <sys/errno.h> accordingly.
David, can you please try with devel/xulrunner and report results?
Updated by davshao almost 12 years ago
After updating through master
Remove support for ISA adapters.
commit 17f3d27a9030370ecc934704e186d57adaba60f7
Date: Thu Nov 29 01:52:11 2012 +0100
and removing the local patches commenting out usage of errno, I was able to
bmake replace clean
/usr/pkgsrc/devel/xulrunner successfully on DragonFly x86_64. I have not had the time to test bmake replace on i386.
devel/xulrunner for Firefox 17.0esr still needs on x86_64 the explicit cast of INT64_MIN to int64_t or a change of the definition of INT64_MIN from LL as illustrated in an update to Bug #2461.