After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 776213 - metadata build/link failures on Solaris for major()/minor()
metadata build/link failures on Solaris for major()/minor()
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: build
1.28.x
Other Solaris
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
: 776532 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2016-12-17 16:46 UTC by Alan Coopersmith
Modified: 2017-01-06 15:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch currently used in Solaris builds (1.45 KB, patch)
2016-12-17 16:51 UTC, Alan Coopersmith
needs-work Details | Review
metadata: Include headers for device number functionality (1.89 KB, patch)
2017-01-02 10:37 UTC, Ondrej Holy
committed Details | Review

Description Alan Coopersmith 2016-12-17 16:46:38 UTC
Building on Solaris fails with:

metatree.c: In function ‘get_tree_for_device’:
metatree.c:2854:55: warning: implicit declaration of function ‘major’ [-Wimplicit-function-declaration]
                                                       major (device),
                                                       ^
metatree.c:2855:55: warning: implicit declaration of function ‘minor’ [-Wimplicit-function-declaration]
                                                       minor (device),
                                                       ^

Undefined			first referenced
 symbol  			    in file
major                               ./.libs/libmetadata.a(metatree.o)
minor                               ./.libs/libmetadata.a(metatree.o)
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status

On Solaris, you need to #include <sys/mkdev.h> to define the major() and
minor() macros for device nodes.
Comment 1 Alan Coopersmith 2016-12-17 16:51:16 UTC
Created attachment 342125 [details] [review]
Patch currently used in Solaris builds
Comment 2 Ondrej Holy 2016-12-19 09:06:07 UTC
Review of attachment 342125 [details] [review]:

Thanks for the patch, can you please update the patch per my review?

::: configure.ac
@@ +761,3 @@
 dnl Look for various fs info getters
 
+AC_CHECK_HEADERS([sys/statfs.h sys/statvfs.h sys/vfs.h sys/mount.h sys/param.h sys/mkdev.h])

We should rather use AC_HEADER_MAJOR for this, see:
https://www.gnu.org/software/autoconf/manual/autoconf.html#index-AC_005fHEADER_005fMAJOR-616

::: metadata/metatree.c
@@ +12,3 @@
+#if HAVE_SYS_MKDEV_H
+#include <sys/mkdev.h> /* needed for major() & minor() on Solaris */
+#endif

Hmm, we should probably include "sys/sysmacros.h" also in other cases for sure, so something like the following:

#if MAJOR_IN_MKDEV
#include <sys/mkdev.h>
#elif MAJOR_IN_SYSMACROS
#include <sys/sysmacros.h>
#endif
Comment 3 Ondrej Holy 2017-01-02 10:15:15 UTC
*** Bug 776532 has been marked as a duplicate of this bug. ***
Comment 4 Ondrej Holy 2017-01-02 10:15:57 UTC
The header files need to be included also in meta-daemon.c because of makedev(). See the duplicated bug.
Comment 5 Ondrej Holy 2017-01-02 10:37:26 UTC
Created attachment 342708 [details] [review]
metadata: Include headers for device number functionality

The implicit sys/sysmacros.h (resp. sys/mkdev.h) includes via sys/types.h
is being deprecated. Use AC_HEADER_MAJOR and include necessary header
files for major(), minor(), and makedev() functions.
Comment 6 Ondrej Holy 2017-01-02 10:38:30 UTC
Guys, can you please check that this fixes your problems?
Comment 7 Alan Coopersmith 2017-01-02 20:02:53 UTC
(In reply to Ondrej Holy from comment #6)
> Guys, can you please check that this fixes your problems?

Thanks - this solves the problem on Solaris and looks better than my patch.
Comment 8 Ondrej Holy 2017-01-06 15:26:44 UTC
Thanks for testing!

Attachment 342708 [details] pushed as 3424bef - metadata: Include headers for device number functionality