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: 'readdir_r' is deprecated #305

Open
lmaisons opened this issue Oct 3, 2016 · 9 comments
Open

Compile failure: 'readdir_r' is deprecated #305

lmaisons opened this issue Oct 3, 2016 · 9 comments

Comments

@lmaisons
Copy link

lmaisons commented Oct 3, 2016

Running make using the example glue fails on Arch due to readdir_r having been deprecated in glibc 2.24.

[lmaisons@statik:~/tr.open/omr]$ uname -a
Linux statik 4.7.5-1-ARCH #1 SMP PREEMPT Sat Sep 24 13:04:22 CEST 2016 x86_64 GNU/Linux
[lmaisons@statik:~/tr.open/omr]$ make -f run_configure.mk SPEC=linux_x86-64 OMRGLUE=./example/glue
(... snip ...)
[lmaisons@statik:~/tr.open/omr]$ make
(... snip ...)
cc  -DOMRPORT_LIBRARY_DEFINE -I. -I./linuxamd64 -I./linux386 -I./linux -I./unix_include -I./unix -I./common -I./include -I./  -DUT_DIRECT_TRACE_REGISTRATION -I../include_core -I../nls -DLINUX -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DJ9HAMMER -c  -MMD -MP -fPIC -ggdb -m64 -Wimplicit -Wreturn-type -Werror -Wall -O3 -fno-strict-aliasing   -o omrvmem.o ./linux/omrvmem.c
./linux/omrvmem.c: In function ‘omrvmem_numa_get_node_details’:
./linux/omrvmem.c:1528:4: error: ‘readdir_r’ is deprecated [-Werror=deprecated-declarations]
    while ((0 == readdir_r(nodes, &nodeStorage, &node)) && (NULL != node)) {
    ^~~~~
In file included from /usr/include/features.h:368:0,
                 from /usr/include/stdio.h:27,
                 from ../include_core/omrport.h:36,
                 from ./linux/omrvmem.c:28:
/usr/include/dirent.h:189:12: note: declared here
 extern int __REDIRECT (readdir_r,
            ^
./linux/omrvmem.c:1548:9: error: ‘readdir_r’ is deprecated [-Werror=deprecated-declarations]
         while ((0 == readdir_r(oneNode, &cpuStorage, &fileEntry)) && (NULL != fileEntry)) {
         ^~~~~
In file included from /usr/include/features.h:368:0,
                 from /usr/include/stdio.h:27,
                 from ../include_core/omrport.h:36,
                 from ./linux/omrvmem.c:28:
/usr/include/dirent.h:189:12: note: declared here
 extern int __REDIRECT (readdir_r,
            ^
cc1: all warnings being treated as errors
@rwy7
Copy link
Contributor

rwy7 commented Oct 5, 2016

Seeing this too. From the man page:

This function is deprecated; use readdir(3) instead.

This is a good candidate for the beginner label.

@dsouzai
Copy link
Contributor

dsouzai commented Nov 29, 2016

Fails on Fedora 25 as well (4.8.8-300.fc25.x86_64). I believe it used to work on Fedora 24.

@lmaisons
Copy link
Author

lmaisons commented Jan 4, 2017

Relevant discussion for Rust Lang including some subtleties that may also be relevant to us: rust-lang/rust#34668

@Varun-garg
Copy link
Contributor

compiles after commenting following warning as error in configure.mk.in

OMR_WARNINGS_AS_ERRORS := @OMR_WARNINGS_AS_ERRORS@

@rwy7
Copy link
Contributor

rwy7 commented Mar 31, 2017

Hi @Varun-garg, thanks for taking an interest in our project! What you've done is disabled treating warnings as errors in our build system. For what it's worth, there is an easier way to do this. We provide an option to configure, --disable-warnings-as-errors.

Using the run_configure.mk wrapper, you can set this flag with:

export enable_warnings_as_errors=no

or by passing the option to run_configure.mk:

make -f run_configure.mk EXTRA_CONFIGURE_ARGS='--disable-warnings-as-errors'

You shouldn't have to edit configure.mk.in.

While this is an effective workaround, the real task is to reimplement the linux implementation of omrvmem_numa_get_node_details in terms of readdir, instead of the deprecated readdir_r. I'd be happy to provide additional guidance to anyone interested in taking this on.

@Varun-garg
Copy link
Contributor

Varun-garg commented Mar 31, 2017

Hi @rwy0717, thank you for detailing the issue and providing a better workaround. I'd be happy to fix this issue.

Regards,
Varun

@Varun-garg
Copy link
Contributor

This issue seems to be fixed for me.

@mstoodle
Copy link
Contributor

This problem has also been observed on Ubuntu 16.10 (ppc64le is where it was specifically seen). It would still be nice to get this issue fixed as we see OMR starting to be used on more modern systems.

@Varun-garg
Copy link
Contributor

Varun-garg commented Sep 16, 2017

Code in port/linux/omrvmem.c hasn't been modified since 2016, I was having this error earlier this year, but for some reason I am not getting it lately (same distro as earlier, only upgraded packages: glibc 2.26, gcc 7.2.0) . config.status also says OMR_WARNINGS_AS_ERRORS flag is enabled. Maybe now it's not compiling with default configuration.

Varun-garg added a commit to Varun-garg/omr that referenced this issue Sep 29, 2017
Replaced readdir_r with readdir()

Issue eclipse-omr#305

Signed-off-by: Varun Garg <varun.10@live.com>
Varun-garg added a commit to Varun-garg/omr that referenced this issue Sep 29, 2017
Replaced readdir_r() call with readdir()

Issue: eclipse-omr#305
Signed-off-by: Varun Garg <varun.10@live.com>
Varun-garg added a commit to Varun-garg/omr that referenced this issue Sep 29, 2017
Replaced readdir_r() method with readdir()

Issue: eclipse-omr#305
Signed-off-by: Varun Garg <varun.10@live.com>
Varun-garg added a commit to Varun-garg/omr that referenced this issue Oct 7, 2017
Replaced readdir_r() method with readdir()

Issue: eclipse-omr#305
Signed-off-by: Varun Garg <varun.10@live.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants