aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: build fails in FileFunctions.cpp with gcc 4.3, glibc 2.7 and _FORTIFY_SOURCE  (Read 2948 times)

Gerd78

  • Hero Member
  • *****
  • Karma: 9
  • Offline Offline
  • Posts: 681

Recent SVN snapshots do not compile with gcc 4.3, glibc 2.7 and _FORTIFY_SOURCE defined to 1 or 2. In order to reproduce, optimization needs to be set to at least -O1 as well because _FORTIFY_SOURCE is not active otherwise.

Example for today's tarball:
Code: [Select]
# CXXFLAGS="-O2 -D_FORTIFY_SOURCE=2" ./configure
[...]
# make
[...]
g++ -DHAVE_CONFIG_H -I. -I../../..    -I/usr/lib/wx/include/gtk2-unicode-release
-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pt
hread -DHAVE_BFD  -O2 -D_FORTIFY_SOURCE=2 -I/usr/include -D__CRYPTO_INSTALLED__
-D__WEAK_CRYPTO__ -g -D__DEBUG__ -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC -W -
Wall -Wshadow -Wundef -ggdb -fno-inline -fmessage-length=0   -DUSE_WX_EXTENSIONS
 -MT libmulecommon_a-FileFunctions.o -MD -MP -MF .deps/libmulecommon_a-FileFunct
ions.Tpo -c -o libmulecommon_a-FileFunctions.o `test -f 'FileFunctions.cpp' || e
cho './'`FileFunctions.cpp
In function ‘int open(const char*, int, ...)’,
    inlined from ‘FSCheckResult DoCheckFileSystem(const CPath&)’ at FileFunction
s.cpp:290:
/usr/include/bits/fcntl2.h:51: error: call to ‘__open_missing_mode’ declared wit
h attribute error: open with O_CREAT in second argument needs 3 arguments
make[4]: *** [libmulecommon_a-FileFunctions.o] Error 1
[...]
I have tested this with 20080328, which is the first SVN tarball that doesn't fail for unrelated reasons. It has the same problem already.
Logged

Gerd78

  • Hero Member
  • *****
  • Karma: 9
  • Offline Offline
  • Posts: 681

For the records: It compiles if _FORTIFY_SOURCE is not used, but glibc 2.7 aborts it at runtime.

Possible fix attached. Not sure whether you like 0600 or prefer leaving this up to the user's umask. Please review.
« Last Edit: April 15, 2008, 11:56:55 PM by Gerd78 »
Logged

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685

Fix committed. Thanks for your contribution.
Logged
concordia cum veritate