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

Building on Ubuntu 20.04 #4

Open
DavidAPease opened this issue Mar 17, 2021 · 6 comments
Open

Building on Ubuntu 20.04 #4

DavidAPease opened this issue Mar 17, 2021 · 6 comments

Comments

@DavidAPease
Copy link

Ran into problems building on Ubuntu 20.04 (GCC version 9.3.0). I am posting my work-arounds here for any others that hit these problems:

1 Unused return value warning from write() and other functions was being flagged as an error while building in the klib directory:
In ./klib/Makefile, remove -Werror flag to convert "unused function return value" error back to warning.

  1. Unresolved calls to trig functions in ld:
    In main ./Makefile, move $(LIBS) from the middle of the $(CC) line to the end, so that libmath is searched after unresolved
    references have been encountered.
@kevinboone
Copy link
Owner

Thanks for pointing this out. There's an ongoing problem, here: I always use "-Werror" in my builds, because I want to trap every warning that might potentially be relevant. Unfortunately, the kinds of things that gcc thinks are worthy of reporting as warnings, with specific command-line settings, seems to be somewhat variable. My version isn't complaining about ignoring the return value from write(), but arguably this is something I ought to look into. It's possible that I should be checking this return value.

The same applies to the library search order used by the GNU linker. It does seem to cause any problem for me when I change the order in the way you describe; but when I change anything like this, even slightly, I get a barrage of complaints ;)

So, unless it's causing you a lot of inconvenience, I'd rather just leave this as a helpful comment. I could remove the "-Werror" from master if it's causing a lot of annoyance -- I have had to do this on some of my other repositories.

@jayascript
Copy link

Just chiming in that I had this exact same error this morning. I almost went back to the previous version of this package because I couldn't get this one to install. The workaround provided by @DavidAPease was quick and solved the problem easily. Please do look into this and consider updating the master branch as it could deter potential users like me from installing the newer version of this application.

@kevinboone
Copy link
Owner

Sigh. I've removed -Werror from the build. I can always put it back in, in my local installation. I hate doing this, because I like the assurance that no warnings are sneaking past. At the same time, there's no consistency among GCC versions about what actually constitutes a warning :/

@cernyhonza
Copy link

Hi, there is still -Werror in klib/Makefile. I;ve just got following error with gcc 12.2.0:

src/kzipfile.c:700:9: error: pointer ‘s_path’ may be used after ‘free’ [-Werror=use-after-free]
  700 |         klog_debug (KLOG_CLASS, "zip_extract_all: could not create directory %s\n",
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  701 |           s_path);
      |           ~~~~~~~
src/kzipfile.c:694:7: note: call to ‘free’ here
  694 |       free (s_path);
      |       ^~~~~~~~~~~~~
cc1: all warnings being treated as errors

@DavidAPease
Copy link
Author

DavidAPease commented Nov 12, 2022 via email

@kevinboone
Copy link
Owner

I'm reluctant to remove -Werror because doing so allows errors like this -- which are entirely my own -- to escape unnoticed. In this case, the file containing the error is, in fact, unused, and I've removed the entire file.

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

4 participants