Page 1 of 1

Ubuntu 12.04 x64 error: undefined reference to stat64

Posted: Tue Jun 26, 2012 2:06 pm
by rezsbc
Folks,

I'm having a bit of difficulty compiling this on my Ubuntu 12.04 64 bit machine. I have been able to compile fine previously on the same machine, even under 12.04 to my knowledge.

Currently when I try to compile the 'oss' package I get an error that there is an "undefined reference to `stat64'" in function "SYS_nstat". I must admit I'm no expert on compilation and I haven't been able to confirm the source of this error. I am 99% sure I have all dependencies installed so not sure what might be causing it.

The full output is below:

Code: Select all

cathal@officepc:~/makemkv-oss-1.7.5$ sudo make -f makefile.linux
mkdir -p out
gcc -Os -D_GNU_SOURCE -D_linux_ -D_REENTRANT -shared -Wl,-z,defs -oout/libmakemkv.so.1.full -Ilibebml/inc -DEBML_NO_READ -DEBML_STRICT_API -Ilibmatroska/inc \
	-Ilibmakemkv/inc -Isstring/inc -Imakemkvgui/inc -Ilibabi/inc -Ilibffcodec/inc \
	libebml/src/EbmlBinary.cpp libebml/src/EbmlContexts.cpp libebml/src/EbmlCrc32.cpp libebml/src/EbmlDate.cpp libebml/src/EbmlDummy.cpp libebml/src/EbmlElement.cpp libebml/src/EbmlFloat.cpp libebml/src/EbmlHead.cpp libebml/src/EbmlMaster.cpp libebml/src/EbmlSInteger.cpp libebml/src/EbmlString.cpp libebml/src/EbmlSubHead.cpp libebml/src/EbmlUInteger.cpp libebml/src/EbmlUnicodeString.cpp libebml/src/EbmlVersion.cpp libebml/src/EbmlVoid.cpp libebml/src/IOCallback.cpp libebml/src/MemIOCallback.cpp  libmatroska/src/FileKax.cpp libmatroska/src/KaxAttached.cpp libmatroska/src/KaxAttachments.cpp libmatroska/src/KaxBlock.cpp libmatroska/src/KaxBlockData.cpp libmatroska/src/KaxChapters.cpp libmatroska/src/KaxCluster.cpp libmatroska/src/KaxClusterData.cpp libmatroska/src/KaxContentEncoding.cpp libmatroska/src/KaxContexts.cpp libmatroska/src/KaxCues.cpp libmatroska/src/KaxCuesData.cpp libmatroska/src/KaxInfo.cpp libmatroska/src/KaxInfoData.cpp libmatroska/src/KaxSeekHead.cpp libmatroska/src/KaxSegment.cpp libmatroska/src/KaxTag.cpp libmatroska/src/KaxTags.cpp libmatroska/src/KaxTrackAudio.cpp libmatroska/src/KaxTrackEntryData.cpp libmatroska/src/KaxTracks.cpp libmatroska/src/KaxTrackVideo.cpp libmatroska/src/KaxVersion.cpp libmakemkv/src/ebmlwrite.cpp libmakemkv/src/libmkv.cpp libmakemkv/src/version.cpp libmakemkv/src/world.cpp  sstring/src/sstring.cpp \
	libabi/src/ossl_aes.c libabi/src/ossl_sha.c libabi/src/ossl_ec.c libabi/src/zlib.c libabi/src/xpat.c libabi/pssl/ec_key.c libabi/pssl/ec_lib.c libabi/pssl/ec_cvt.c libabi/pssl/ec_mult.c libabi/pssl/ecp_mont.c libabi/pssl/ecp_smpl.c libabi/pssl/ecs_ossl.c libabi/pssl/ecs_sign.c libabi/pssl/ecs_vrf.c libabi/src/httplinux.cpp makemkvgui/src/api_linux.cpp libabi/src/sys_linux.c libffcodec/src/ffcodec.c libffcodec/src/crc.c libffcodec/src/mlp.c libffcodec/src/mlp_parser.c libffcodec/src/mpegaudiodata.c libffcodec/src/mpegaudiodecheader.c libffcodec/src/aviobuf.c libffcodec/src/ffmdec.c libffcodec/src/ffmenc.c \
	-DHAVE_BUILDINFO_H -Itmp \
	-fPIC -Xlinker -dy -Xlinker --version-script=libmakemkv/src/libmakemkv.vers \
	-Xlinker -soname=libmakemkv.so.1 -lc -lstdc++ -lcrypto -lz -lexpat
/tmp/ccC99Q0D.o: In function `SYS_nstat':
sys_linux.c:(.text+0x12): undefined reference to `stat64'
/tmp/ccC99Q0D.o: In function `SYS_fstat':
sys_linux.c:(.text+0x66): undefined reference to `fstat64'
collect2: ld returned 1 exit status
make: *** [out/libmakemkv.so.1.full] Error 1

Also not sure what other information you might want this may be relevent:

Code: Select all

cathal@officepc:~/makemkv-oss-1.7.5$ uname -a
Linux officepc 3.2.0-25-generic #40-Ubuntu SMP Wed May 23 20:30:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

cathal@officepc:~/makemkv-oss-1.7.5$ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
If anyone has any ideas/advice I would be most thankful!

Cathal.

Re: Ubuntu 12.04 x64 error: undefined reference to stat64

Posted: Tue Jun 26, 2012 3:07 pm
by crowfax
Re-Run this:

Code: Select all

sudo apt-get install build-essential libc6-dev libssl-dev libexpat1-dev libgl1-mesa-dev libqt4-dev
The requirements changed with 1.7.5. Make sure you have them all.

Re: Ubuntu 12.04 x64 error: undefined reference to stat64

Posted: Tue Jun 26, 2012 3:44 pm
by rezsbc
Thanks yes I have all the dependencies installed:

Code: Select all

cathal@officepc:~$ sudo apt-get install build-essential libc6-dev libssl-dev libexpat1-dev libgl1-mesa-dev libqt4-dev
[sudo] password for cathal: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version.
libc6-dev is already the newest version.
libexpat1-dev is already the newest version.
libgl1-mesa-dev is already the newest version.
libqt4-dev is already the newest version.
libssl-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
cathal@officepc:~$ 

Re: Ubuntu 12.04 x64 error: undefined reference to stat64

Posted: Tue Jun 26, 2012 3:55 pm
by crowfax
Humm.

I'm rubbish with compiling errors.

If I were you I'd purge all the dependencies, reboot and re-install them. Other than that I'm out of ideas.

Re: Ubuntu 12.04 x64 error: undefined reference to stat64

Posted: Thu Jun 28, 2012 8:48 pm
by tanders12
Hm stat64 is a system-level function:

http://linux.die.net/man/2/stat64

It definitely shouldn't be missing. 1.7.5 is compiling fine for my on Ubuntu 12.04 64bit.

Re: Ubuntu 12.04 x64 error: undefined reference to stat64

Posted: Sat Jun 30, 2012 5:25 pm
by rezsbc
Thanks tanders I'll dig deeper.

It's complaining about this function in '/makemkv-oss-1.7.6/libabi/src':

Code: Select all

int SYS_fstat(int filedes, SYS_stat *buf)
{
    struct stat64 st;
    int err;

    err = fstat64(filedes,&st);

    if (!err)
    {
        statcvt(buf,&st);
    }

    return err;
}
I'm no expert but I tend to agree with you this is a core function (should be in libc) and the above code does not look terribly complex. I'll try to dig more and see if I can work anything out.

BTW I get this on 1.7.6 too and also 1.7.4.

Re: Ubuntu 12.04 x64 error: undefined reference to stat64

Posted: Sat Jun 30, 2012 5:46 pm
by rezsbc
OK crowfax you might not be the worlds biggest expert but you sorted me out!!

I removed (aptitude reinstall) the dependencies and it worked!

Must be something to do with my libc library.... thanks all for the help appreciate all the replies :)