Ticket #2689 (closed defect: fixed)

Opened 13 years ago

Last modified 13 years ago

Compile failure of 4.8.1 on Snow Leopard

Reported by: egmont Owned by: angel_il
Priority: major Milestone: 4.8.2
Component: mc-core Version: 4.8.1
Keywords: Cc:
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master committed-stable

Description

Mac OS X 10.6.8, compiling fails with

[snip]

CC util.o
CC selcodepage.o
CCLD mc

Undefined symbols:

"_posix_fallocate", referenced from:

_vfs_preallocate in libmcviewer.a(vfs.o)

ld: symbol(s) not found
collect2: ld returned 1 exit status
make[3]: * [mc] Error 1
make[2]:
* [all-recursive] Error 1
make[1]: * [all-recursive] Error 1
make:
* [all] Error 2
$

4.8.0 compiled fine on the same system. 4.8.1 compiles fine on Linux (Ubuntu 10.04).

Attachments

mc-4.8.1-macosx-fallocate.patch (560 bytes) - added by egmont 13 years ago.
fix fallocate detection for mac

Change History

comment:1 Changed 13 years ago by egmont

config.h ends up having "#define HAVE_POSIX_FALLOCATE 1"

Relevant bits from config.log:
configure:21630: gcc -std=gnu99 -c -g -O2 -I/System/Library/Frameworks/CoreFoundation.framework/Headers -I$(top_builddir)/intl -I$(top_srcdir)/intl conftest.c >&5
conftest.c: In function 'main':
conftest.c:160: warning: implicit declaration of function 'posix_fallocate'

It seems the configure test compiles to an object file only (which succeeds) and doesn't link against libc (to create a runnable binary, which would fail)

comment:2 Changed 13 years ago by egmont

And there's also another, completely independent problem on mac:

Making all in man
Makefile:790: warning: overriding commands for target `mc.1'
Makefile:412: warning: ignoring old commands for target `mc.1'
Makefile:796: warning: overriding commands for target `mcedit.1'
Makefile:414: warning: ignoring old commands for target `mcedit.1'
Makefile:802: warning: overriding commands for target `mcview.1'
Makefile:416: warning: ignoring old commands for target `mcview.1'
Making all in es
Makefile:582: warning: overriding commands for target `mc.1'
Makefile:370: warning: ignoring old commands for target `mc.1'
cd ../../.. && /bin/sh ./config.status doc/man/es/mc.1
config.status: creating doc/man/es/mc.1
stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ... 
            [-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
sed: 1: "mc.1": invalid command code m
make[4]: *** [mc.1] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

It's so great that stat(1) and date(1) on mac and linux are totally incomaptbie :S

comment:3 Changed 13 years ago by andrew_b

Nobody of MC developers has Mac OS. So... patches are welcome! :)

comment:4 Changed 13 years ago by egmont

As for fallocate, the configure script should not only compile an object file, but a whole binary, and see if that succeeds. Unfortunately I don't know hardly anything about autoconf and friends and have no clue how to do it.

As for the man pages, I'm wondering what changed since 4.8.0, I'll have to check, maybe that change can be reverted.

Before the next release (e.g. 4.8.1.1 as the first major stable of the branch) I'd be happy to test the tarballs on mac, just please ping me :)

Changed 13 years ago by egmont

fix fallocate detection for mac

comment:5 Changed 13 years ago by egmont

For properly detecting that fallocate is not available, please see the attached patch.
(If applied on top of the tarball, autoconf has to be re-run obviously.)

comment:6 Changed 13 years ago by egmont

The stat and date story seems to be more complicated than I thought, I've created ticket #2692 for that.

I suggest let's leave this one for the fallocate issue (that simple one-liner patch) only.

comment:7 Changed 13 years ago by farrokhi

Provided patch does not solve the problem. The only workaround for me was manually removing "#define HAVE_POSIX_FALLOCATE 1" from config.h.

comment:8 Changed 13 years ago by egmont

farrokhi: Could you please provide more details about your system, as well as you exactly did? In case you started off from a tarball and applied the patch, did you remember to run autoconf before running configure?

Autoconf generates a different configure file, one that does not only try to compile the short testing source code to an object file, but actually tries to link it against libc. If posix_fallocate does not exist (such as on my Mac) then this fails and hence the generated config.h will not contain that line. If linking against libc succeeds then the system apparently has a functioning posix_fallocate and it's okay to use it.

comment:9 Changed 13 years ago by slavazanko

comment:10 Changed 13 years ago by egmont

Yes thanks, that thread is useful, it shows how to do it on Mac, rather than disabling the feature.
However, since it has to be done differently, the configure bits of detecting (posix_)fallocate availability still needs to be fixed as part of the whole solution ;)

comment:12 Changed 13 years ago by farrokhi

egmont: running autogen.sh after applying the patch, I am now seeing stat/date error.

comment:13 Changed 13 years ago by egmont

farrokhi: This is good news, this means that the fallocate fix works for you too.

comment:14 Changed 13 years ago by andrew_b

  • Milestone changed from Future Releases to 4.8.2

comment:15 Changed 13 years ago by angel_il

  • Branch state changed from no branch to on review

branch: 2689_bsd_fallocate_fix

Please review

egmont: thank you!

comment:16 Changed 13 years ago by angel_il

  • Votes for changeset set to angel_il

comment:17 Changed 13 years ago by andrew_b

  • Keywords stable-candidate added
  • Votes for changeset changed from angel_il to angel_il andrew_b
  • Branch state changed from on review to approved

comment:18 Changed 13 years ago by angel_il

  • Status changed from new to closed
  • Votes for changeset angel_il andrew_b deleted
  • Resolution set to fixed
  • Branch state changed from approved to merged

fixed: dca8a412bcace348dc57f58ca82fe0866ba8d1df

stable-candidate?

Version 0, edited 13 years ago by angel_il (next)

comment:19 Changed 13 years ago by angel_il

4.8.1-stable: a6ca3c289994a3a9ab8f481582e2632109b759f0 (cherry-picked)

comment:20 Changed 13 years ago by andrew_b

  • Keywords stable-candidate removed
  • Votes for changeset set to committed-master committed-stable

comment:21 Changed 13 years ago by andrew_b

  • Status changed from closed to reopened
  • Resolution fixed deleted

comment:22 Changed 13 years ago by andrew_b

  • Status changed from reopened to assigned
  • Owner set to angel_il

comment:23 Changed 13 years ago by andrew_b

  • Status changed from assigned to testing
  • Resolution set to fixed

comment:24 Changed 13 years ago by andrew_b

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.