Closed Bug 736765 Opened 12 years ago Closed 12 years ago

Firefox 11 compile error: file_util.cc:228:35: error: ‘ftruncate’ was not declared in this scope

Categories

(Core :: IPC, defect)

11 Branch
x86_64
Linux
defect
Not set
critical

Tracking

()

RESOLVED DUPLICATE of bug 725655

People

(Reporter: u209627, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120316 Firefox/11.0
Build ID: 20120317005948

Steps to reproduce:

I just tried to compile Firefox 11 for Linux from source.


Actual results:

c++ -o file_util.o -c -I../../dist/stl_wrappers -I../../dist/system_wrappers -include ../../../mozilla/config/gcc_hidden.h -DMOZILLA_INTERNAL_API -D_IMPL_NS_COM -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -DIMPL_NS_NET -DIMPL_THEBES  -DSTATIC_EXPORTABLE_JS_API -DOSTYPE=\"Linux3.2\" -DOSARCH=Linux -DEXCLUDE_SKIA_DEPENDENCIES  -DOS_LINUX=1 -DOS_POSIX=1  -DHAVE_CONFIG_H -I../../../mozilla/ipc/chromium/src -I../../../mozilla/ipc/glue -I../../ipc/ipdl/_ipdlheaders  -I../../../mozilla/ipc/chromium/src/third_party/libevent -I../../../mozilla/ipc/chromium/src/third_party/libevent/linux -I../../../mozilla/ipc/chromium -I. -I../../dist/include -I../../dist/include/nsprpub  -I/home/fraga/src/firefox/dist/include/nspr -I/home/fraga/src/firefox/dist/include/nss      -fPIC -fno-rtti -Wall -Wpointer-arith -Woverloaded-virtual -Wsynth -Wno-ctor-dtor-privacy -Wno-non-virtual-dtor -Wcast-align -Wno-invalid-offsetof -Wno-variadic-macros -Werror=return-type -Wno-long-long -O3 -march=native -pipe -fno-exceptions -fno-strict-aliasing -std=gnu++0x -pthread -pipe -DDEBUG -D_DEBUG -DTRACING -g -pthread -I/usr/xorg/include/pixman-1 -I/usr/X11/include -I/usr/xorg/include -I/usr/local/include/gtk-2.0 -I/usr/local/lib/gtk-2.0/include -I/usr/local/include/atk-1.0 -I/usr/local/include/cairo -I/usr/local/include/gdk-pixbuf-2.0 -I/usr/local/include/pango-1.0 -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/freetype2 -I/usr/local/include -I/usr/local/include/libpng15 -I/usr/local/include/gtk-unix-print-2.0   -fno-omit-frame-pointer   -DMOZILLA_CLIENT -include ../../mozilla-config.h -MD -MF .deps/file_util.pp /home/fraga/src/mozilla/ipc/chromium/src/base/file_util.cc
/home/fraga/src/mozilla/ipc/chromium/src/base/file_util.cc: In function ‘FILE* file_util::CreateAndOpenTemporaryFile(FilePath*)’:
/home/fraga/src/mozilla/ipc/chromium/src/base/file_util.cc:197:12: warning: converting ‘false’ to pointer type ‘FILE* {aka _IO_FILE*}’ [-Wconversion-null]
/home/fraga/src/mozilla/ipc/chromium/src/base/file_util.cc: In function ‘bool file_util::TruncateFile(FILE*)’:
/home/fraga/src/mozilla/ipc/chromium/src/base/file_util.cc:228:35: error: ‘ftruncate’ was not declared in this scope
make[4]: *** [file_util.o] Error 1
make[4]: Leaving directory `/home/fraga/src/firefox/ipc/chromium'
make[3]: *** [libs] Error 2
make[3]: Leaving directory `/home/fraga/src/firefox/ipc'
make[2]: *** [libs_tier_platform] Error 2
make[2]: Leaving directory `/home/fraga/src/firefox'
make[1]: *** [tier_platform] Error 2
make[1]: Leaving directory `/home/fraga/src/firefox'
make: *** [default] Error 2



Expected results:

With gcc 4.6.3 this error doesn't happen... just with gcc 4.7.0 20120314 (prerelease).
Severity: normal → trivial
The solution is here:

http://gcc.gnu.org/gcc-4.7/porting_to.html

C++ language issues
Header dependency changes

Many of the standard C++ library include files have been edited to no longer include <unistd.h> to remove namespace pollution.

As such, C++ programs that used functions including truncate, sleep or pipe without first including <unistd.h> will no longer compile. The diagnostic produced is similar to:

error: ‘truncate’ was not declared in this scope

error: ‘sleep’ was not declared in this scope

error: ‘pipe’ was not declared in this scope

error: there are no arguments to 'offsetof' that depend on a template
parameter, so a declaration of 'offsetof' must be available

Fixing this issue is easy: just include <unistd.h>.
This patch fixes it for me
This was already supposedly fixed in bug 706724 for Firefox 12. You must always test the newest trunk version (now FF14) before creating patches.

So these are the options now:
1. The bug only fixed the file file_util.cc . The reporter there didn't say other files need to be fixed too.
2. If you see the other files need the fix then please update the patch (drop the change file_util.cc as it is unnneded)
Component: Untriaged → IPC
Depends on: 706724
Product: Firefox → Core
QA Contact: untriaged → ipc
Can someone post the solution to this bug step by step?  Thank you.
If you do compile the source, apply the attached patch (but you can ignore file_util.cc, it should already have the fix).
firefox 12 is still broken for me. Also broke the patch.
Ok, I think this is intentional change in gcc 4.7, it is in their release notes. I'll look at it.
Assignee: nobody → acelists
Why exactly are you trying to build Firefox 12? If you are developing something, you should use the current trunk (mozilla-central).

I checked and all the fixes in the attached patch are already merged in mozilla-central (probably via other bugs).
I have compiled TB15 with gcc 4.7.0 (32-bit) now and I did not get a build failure. I have checked the log of the build and all the files mentioned in the patch were compiled fine (I had --disable-ipc commented out).

If there is a need to backport this to TB12+, bsmedberg must decide that.
I confirm this bug.  I just upgraded to Fedora 17 with gcc 4.7, and cannot compile Mozilla Firefox 12 from source.
Severity: trivial → critical
Status: UNCONFIRMED → NEW
Ever confirmed: true
This was apparently fixed in FF13, but somehow the patch missed the FF12 cycle.  With a release of FF13 on June 5, though, it's probably not worth fixing...
See Also: → 725655
Exactly. So I'd say this is a dupe of bug 725655.
Or a wontfix if the specific intent of this bug is to get it into FF12.
Depends on: 725655
As FF13 is out, this can probably be closed.
Assignee: acelists → nobody
Status: NEW → RESOLVED
Closed: 12 years ago
No longer depends on: 725655
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: