Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile failure after GCC 7.3.0 version #18

Open
LoganZhao opened this issue Aug 22, 2022 · 0 comments
Open

Compile failure after GCC 7.3.0 version #18

LoganZhao opened this issue Aug 22, 2022 · 0 comments

Comments

@LoganZhao
Copy link

LoganZhao commented Aug 22, 2022

Env:

LMbench 3

Error Message:

#make results make[1]: Entering directory '/root/lmbench3/src' gcc -O -DRUSAGE -DHAVE_uint=1 -DHAVE_int64_t=1 -DHAVE_DRAND48 -DHAVE_SCHED_SETAFFINITY=1 -o ../bin/x86_64-linux-gnu/disk disk.c ../bin/x86_64-linux- gnu/lmbench.a -lm /usr/bin/ld: /tmp/ccvsfTiW.o: in function seekto':
disk.c:(.text+0x37): undefined reference to llseek' collect2: error: ld returned 1 exit status make[1]: *** [Makefile:323: ../bin/x86_64-linux-gnu/disk] Error 1 make[1]: Leaving directory '/root/lmbench3/src' make: *** [Makefile:114: lmbench] Error 2

#define BIGSEEK (1<<30)
int
seekto(int fd, uint64 off)
{
#ifdef linux
extern loff_t llseek(int, loff_t, int);

    if (**llseek**(fd, (loff_t)off, SEEK_SET) == (loff_t)-1) {
            return(-1);
    }
    return (0);

#else
uint64 here = 0;
lseek(fd, 0, 0);
while ((uint64)(off - here) > (uint64)BIGSEEK) {
if (lseek(fd, BIGSEEK, SEEK_CUR) == -1) break;
here += BIGSEEK;
}
assert((uint64)(off - here) <= (uint64)BIGSEEK);
if (lseek(fd, (int)(off - here), SEEK_CUR) == -1) return (-1);
return (0);
#endif
}

root@iZbp176gmwpuh1u0d4zudlZ:~# gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:hsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)

Analysis:

Check disk.c, line292, found seekto is using llseek funtion. After GCC 7.3.0 version, llseek is replaced by lseek64. so replace have fixed this issue.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant