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

sys/sysmacros.h: present but cannot be compiled #71

Closed
Hexilee opened this issue Dec 29, 2022 · 6 comments
Closed

sys/sysmacros.h: present but cannot be compiled #71

Hexilee opened this issue Dec 29, 2022 · 6 comments

Comments

@Hexilee
Copy link

Hexilee commented Dec 29, 2022

When I configured pjdfstest on my filesystem, I got warnings:

checking sys/sysmacros.h usability... no
checking sys/sysmacros.h presence... yes
configure: WARNING: sys/sysmacros.h: present but cannot be compiled
configure: WARNING: sys/sysmacros.h:     check for missing prerequisite headers?
configure: WARNING: sys/sysmacros.h: see the Autoconf documentation
configure: WARNING: sys/sysmacros.h:     section "Present But Cannot Be Compiled"
configure: WARNING: sys/sysmacros.h: proceeding with the compiler's result
checking for sys/sysmacros.h... no
checking for bindat... no

Then I got compiling error when executed make pjdfstest:

cc -DHAVE_CONFIG_H -I.    -Wall -Werror -g -O2 -MT pjdfstest.o -MD -MP -MF .deps/pjdfstest.Tpo -c -o pjdfstest.o pjdfstest.c
pjdfstest.c: In function ‘show_stat’:
pjdfstest.c:590:2: error: expected expression before ‘else’
  590 |  else if (strcmp(what, "major") == 0)
      |  ^~~~
pjdfstest.c:593:30: error: implicit declaration of function ‘minor’ [-Werror=implicit-function-declaration]
  593 |   printf("%u", (unsigned int)minor(sp->st_rdev));
      |                              ^~~~~
pjdfstest.c: In function ‘call_syscall’:
pjdfstest.c:873:9: error: implicit declaration of function ‘makedev’ [-Werror=implicit-function-declaration]
  873 |   dev = makedev(NUM(fa + 3), NUM(fa + 4));
      |         ^~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:401: pjdfstest.o] Error 1

It seems the macros are defined in my /usr/include/x86_64-linux-gnu/sys/sysmacros.h:

/* Definitions of macros to access `dev_t' values.
   Copyright (C) 1996-2020 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, see
   <https://www.gnu.org/licenses/>.  */

#ifndef _SYS_SYSMACROS_H
#define _SYS_SYSMACROS_H 1

#include <features.h>
#include <bits/types.h>
#include <bits/sysmacros.h>

#define __SYSMACROS_DECL_TEMPL(rtype, name, proto)                           \
  extern rtype gnu_dev_##name proto __THROW __attribute_const__;

#define __SYSMACROS_IMPL_TEMPL(rtype, name, proto)                           \
  __extension__ __extern_inline __attribute_const__ rtype                    \
  __NTH (gnu_dev_##name proto)

__BEGIN_DECLS

__SYSMACROS_DECLARE_MAJOR (__SYSMACROS_DECL_TEMPL)
__SYSMACROS_DECLARE_MINOR (__SYSMACROS_DECL_TEMPL)
__SYSMACROS_DECLARE_MAKEDEV (__SYSMACROS_DECL_TEMPL)

#ifdef __USE_EXTERN_INLINES

__SYSMACROS_DEFINE_MAJOR (__SYSMACROS_IMPL_TEMPL)
__SYSMACROS_DEFINE_MINOR (__SYSMACROS_IMPL_TEMPL)
__SYSMACROS_DEFINE_MAKEDEV (__SYSMACROS_IMPL_TEMPL)

#endif

__END_DECLS

#ifndef __SYSMACROS_NEED_IMPLEMENTATION
# undef __SYSMACROS_DECL_TEMPL
# undef __SYSMACROS_IMPL_TEMPL
# undef __SYSMACROS_DECLARE_MAJOR
# undef __SYSMACROS_DECLARE_MINOR
# undef __SYSMACROS_DECLARE_MAKEDEV
# undef __SYSMACROS_DEFINE_MAJOR
# undef __SYSMACROS_DEFINE_MINOR
# undef __SYSMACROS_DEFINE_MAKEDEV
#endif

#define major(dev) gnu_dev_major (dev)
#define minor(dev) gnu_dev_minor (dev)
#define makedev(maj, min) gnu_dev_makedev (maj, min)

#endif /* sys/sysmacros.h */

I'm using ubuntu 20.04 and not very familiar with the autoconf, could anyone give me some advice please to fix this case?

@asomers
Copy link
Collaborator

asomers commented Dec 29, 2022

What do you see in config.log about sysmacros.h?

@Hexilee
Copy link
Author

Hexilee commented Dec 29, 2022

Thx, this is the config.log, it seems there are hundreds of lines complaining about sysmacros.h. However, when I configure pjdfstest for ext4 filesystem on the same machine, these complaints are missing.

@asomers
Copy link
Collaborator

asomers commented Dec 29, 2022

What do you mean "configure pjdfstest for ext4"? The file system under test shouldn't matter at this point.

@Hexilee
Copy link
Author

Hexilee commented Dec 29, 2022

When I clone and compile this repo on an ext4 volume, everything is ok, both ./configure and make pjdfstest complete successfully. However, on the same machine with a FUSE volume (which can pass pjdfstest), ./configure throws warnings and make pjdfstest fails. Is it possibly because of wrong FUSE behaviours?

@asomers
Copy link
Collaborator

asomers commented Dec 29, 2022

./configure doesn't care at all about what file system you will eventually test. Are you storing the pjdfstest repo on FUSE itself? That might be your problem, if there is some problem with your FUSE file system.

@Hexilee
Copy link
Author

Hexilee commented Feb 15, 2023

Thx, I found the problem.

@Hexilee Hexilee closed this as completed Feb 15, 2023
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

2 participants