-
Notifications
You must be signed in to change notification settings - Fork 30
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
Misc build fixes and improvements #17
Conversation
pkg-config automatically handles static linking situations, where for example readline is linked against ncurses, and therefore -lncurses needs to be passed in addition to -lreadline. This proposal uses pkg-config when available. If pkg-config is not found, or readline is not found via pkg-config, we fallback to the existing AC_CHECK_LIB(). This AC_CHECK_LIB() test is modified to set READLINE_LIBS, like PKG_CHECK_MODULES() does. The Makefile.am consequently uses READLINE_LIBS instead of hardcoding -lreadline. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Fixes the following autoreconf warning: cdrwtool/Makefile.am:3: warning: source file '../mkudffs/mkudffs.c' is in a subdirectory, cdrwtool/Makefile.am:3: but option 'subdir-objects' is disabled automake: warning: possible forward-incompatibility. automake: At least a source file is in a subdirectory, but the 'subdir-objects' automake: automake option hasn't been enabled. For now, the corresponding output automake: object file(s) will be placed in the top-level directory. However, automake: this behaviour will change in future Automake versions: they will automake: unconditionally cause object files to be placed in the same subdirectory automake: of the corresponding sources. automake: You are advised to start using 'subdir-objects' option throughout your automake: project, to avoid future incompatibilities. cdrwtool/Makefile.am:3: warning: source file '../mkudffs/defaults.c' is in a subdirectory, cdrwtool/Makefile.am:3: but option 'subdir-objects' is disabled cdrwtool/Makefile.am:3: warning: source file '../mkudffs/file.c' is in a subdirectory, cdrwtool/Makefile.am:3: but option 'subdir-objects' is disabled cdrwtool/Makefile.am: installing 'config/depcomp' udflabel/Makefile.am:3: warning: source file '../udfinfo/readdisc.c' is in a subdirectory, udflabel/Makefile.am:3: but option 'subdir-objects' is disabled Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Address the following libtoolize warning: libtoolize: Consider adding 'AC_CONFIG_MACRO_DIRS([m4])' to configure.ac, libtoolize: and rerunning libtoolize and aclocal. libtoolize: Consider adding '-I m4' to ACLOCAL_AMFLAGS in Makefile.am. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Fixes the following build warning: main.c: In function ‘is_whole_disk’: main.c:170:13: warning: In the GNU C Library, "major" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "major", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "major", you should undefine it after including <sys/types.h>. maj = major(st.st_rdev); ^~~~~~~~~~~~~ main.c:171:13: warning: In the GNU C Library, "minor" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "minor", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "minor", you should undefine it after including <sys/types.h>. min = minor(st.st_rdev); ^~~~~~~~~~~~~ main.c: In function ‘is_removable_disk’: main.c:231:13: warning: In the GNU C Library, "major" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "major", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "major", you should undefine it after including <sys/types.h>. if (snprintf(buf, sizeof(buf), "/sys/dev/block/%d:%d/removable", major(st.st_rdev), minor(st.st_rdev)) >= (int)sizeof(buf)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.c:231:13: warning: In the GNU C Library, "minor" is defined by <sys/sysmacros.h>. For historical compatibility, it is currently defined by <sys/types.h> as well, but we plan to remove this soon. To use "minor", include <sys/sysmacros.h> directly. If you did not intend to use a system-defined macro "minor", you should undefine it after including <sys/types.h>. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
@@ -3,7 +3,7 @@ AC_PREREQ([2.63]) | |||
AC_INIT(udftools, 2.0, , , [https://github.com/pali/udftools/]) | |||
AC_CONFIG_AUX_DIR(config) | |||
AM_CONFIG_HEADER(include/config.h:include/config.in) | |||
AM_INIT_AUTOMAKE | |||
AM_INIT_AUTOMAKE([subdir-objects]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change breaks making in parallel (make -j), as it generates same object files (default.o, file.o, ...) from concurrent jobs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see why this break parallel build, I just tested, it works fine. subdir-objects just tells automake that object files are produced in subdirs. Could you show the build failure you're seeing ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is how autoconf/automake generates Makefiles. More Makefile.am files refers to source files outside of current directory. Without this change, object files (from sources files) are always generated into current directory. With this change, object files are put to same location where are source files. Therefore parallel build starts overwriting generated object files in different directories -- classic race condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get it sorry. Tons of projects are using subdir-objects with parallel build. subdir-objects will for example prevent object files from overwriting itself if you have foo/foo.c and bar/foo.c. If you have such file and don't use subdir-objects, then foo.o and foo.o will both be produced in the main directory, while with subdir-objects, they wil be produced as foo/foo.o and bar/foo.o.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get it sorry. Tons of projects are using subdir-objects with parallel build.
So if you are proposing some change to merge, I guess you understand what it is doing. But seems not. Argument that tons of project are using it, does not mean that it would work also with udftools in current state.
subdir-objects will for example prevent object files from overwriting itself if you have foo/foo.c and bar/foo.c.
I do not contradict this. But udftools automake files (Makefile.am) does not use this pattern.
Problem is that e.g. Makefile.am for cdrwtool uses files outside of cdrwtool directory tree. Same for udflabel.
When subdir-objects option is not used, then object files compiled from those source files are put into the current main directory as you wrote. Which is the correct behavior, as cdrwtool does not produce any files outside of the cdrwtool directory.
But when subdir-objects is used, then cdrwtool compiles sources files outside of cdrwtool directory. And therefore starts fighting with other Makefile.am files which generates same file in their own directories.
So here not usage of subdir-objects is correct way how to avoid above race which you already described.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct way of course would be to not compile source files outside of the current Makefile.am directory, but that needs fixing Makefile.am automake files, not autoconf file.
@@ -41,6 +41,7 @@ | |||
#include <limits.h> | |||
#include <dirent.h> | |||
#include <sys/ioctl.h> | |||
#include <sys/sysmacros.h> | |||
#include <linux/fs.h> | |||
#include <linux/fd.h> | |||
#include <sys/sysmacros.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why you are including sys/sysmacros.h file twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's a rebase issue, I'll drop this commit.
@@ -3,7 +3,8 @@ AC_PREREQ([2.63]) | |||
AC_INIT(udftools, 2.0, , , [https://github.com/pali/udftools/]) | |||
AC_CONFIG_AUX_DIR(config) | |||
AM_CONFIG_HEADER(include/config.h:include/config.in) | |||
AM_INIT_AUTOMAKE | |||
AM_INIT_AUTOMAKE([subdir-objects]) | |||
AC_CONFIG_MACRO_DIRS([m4]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this change breaks compilation, see Travis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you give me a link to the Travis failure so that I can have a look ? Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is above gitthub "comment" area. Now I reopened pull request, so travis started testing it again and you would see result there.
udffsck/udffsck | ||
udfinfo/udfinfo | ||
udflabel/udflabel | ||
wrudf/wrudf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of gitignore, it just hide if development git directory is clean or not, forces to use git clean -x (ignore gitignore). Also specially if people add there their own files which do not exists on other computers... Anyway everybody can sets its own set of gitignore rules (e.g. via file info/exclude) locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I guess that's a matter of taste, but fair enough, I can drop this from the patch series.
Hi @tpetazzoni, are you going to fix above mentioned problems? |
Closing for inactivity. |
@tpetazzoni ping |
Closing for inactivity. |
Hello,
Here is a patch series doing misc build fixes and improvements:
Thanks!