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

Failure to compile with -fno-common #122

Closed
insanitywholesale opened this issue Mar 3, 2020 · 2 comments
Closed

Failure to compile with -fno-common #122

insanitywholesale opened this issue Mar 3, 2020 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@insanitywholesale
Copy link
Contributor

Expected Behavior

Successful compilation with -fno-common

Current Behavior

Compilation failure when using -fno-common

Failure Information (for bugs)

Context

Adding -fno-common to CFLAGS is all I needed to produce this issue

  • DF-SHOW Version: v0.8.2-beta
  • Operating System: Gentoo
  • System Architecture: amd64
  • Output of uname -a: Linux puddle 4.19.97-gentoo Develop to Master #1 SMP Sun Jan 19 23:53:56 EET 2020 x86_64 Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz GenuineIntel GNU/Linux

Failure Logs

make -j9
make  all-am
make[1]: Entering directory '/var/tmp/portage/app-misc/dfshow-0.8.2_beta/work/dfshow-0.8.2-beta'
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I.    -DSYSCONFIG=\"/etc\" -DDATADIR=\"/usr/share/dfshow\" -D_XOPEN_SOURCE_EXTENDED -march=native -mtune=native -O2 -pipe -fno-common -c -o src/show.o src/show.c
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I.    -DSYSCONFIG=\"/etc\" -DDATADIR=\"/usr/share/dfshow\" -D_XOPEN_SOURCE_EXTENDED -march=native -mtune=native -O2 -pipe -fno-common -c -o src/showfunctions.o src/showfunctions.c
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I.    -DSYSCONFIG=\"/etc\" -DDATADIR=\"/usr/share/dfshow\" -D_XOPEN_SOURCE_EXTENDED -march=native -mtune=native -O2 -pipe -fno-common -c -o src/showmenus.o src/showmenus.c
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I.    -DSYSCONFIG=\"/etc\" -DDATADIR=\"/usr/share/dfshow\" -D_XOPEN_SOURCE_EXTENDED -march=native -mtune=native -O2 -pipe -fno-common -c -o src/colors.o src/colors.c
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I.    -DSYSCONFIG=\"/etc\" -DDATADIR=\"/usr/share/dfshow\" -D_XOPEN_SOURCE_EXTENDED -march=native -mtune=native -O2 -pipe -fno-common -c -o src/common.o src/common.c
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I.    -DSYSCONFIG=\"/etc\" -DDATADIR=\"/usr/share/dfshow\" -D_XOPEN_SOURCE_EXTENDED -march=native -mtune=native -O2 -pipe -fno-common -c -o src/sf.o src/sf.c
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I.    -DSYSCONFIG=\"/etc\" -DDATADIR=\"/usr/share/dfshow\" -D_XOPEN_SOURCE_EXTENDED -march=native -mtune=native -O2 -pipe -fno-common -c -o src/sfmenus.o src/sfmenus.c
src/show.c: In function 'main':
src/show.c:936:9: warning: ignoring return value of 'getcwd', declared with attribute warn_unused_result [-Wunused-result]
  936 |         getcwd(tmpPwd, sizeof(currentpwd));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/show.c:942:7: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Wunused-result]
  942 |       chdir(currentpwd);
      |       ^~~~~~~~~~~~~~~~~
src/show.c:944:7: warning: ignoring return value of 'getcwd', declared with attribute warn_unused_result [-Wunused-result]
  944 |       getcwd(currentpwd, sizeof(currentpwd));
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/common.c: In function 'wReadLine':
src/common.c:532:5: warning: implicit declaration of function 'get_wch'; did you mean 'getwc'? [-Wimplicit-function-declaration]
  532 |     get_wch(&c);
      |     ^~~~~~~
      |     getwc
src/common.c: In function 'showManPage':
src/common.c:780:3: warning: ignoring return value of 'system', declared with attribute warn_unused_result [-Wunused-result]
  780 |   system("clear"); // Needed to ensure man pages display correctly
      |   ^~~~~~~~~~~~~~~
src/common.c:781:3: warning: ignoring return value of 'system', declared with attribute warn_unused_result [-Wunused-result]
  781 |   system(mancmd);
      |   ^~~~~~~~~~~~~~
x86_64-pc-linux-gnu-gcc -DSYSCONFIG=\"/etc\" -DDATADIR=\"/usr/share/dfshow\" -D_XOPEN_SOURCE_EXTENDED -march=native -mtune=native -O2 -pipe -fno-common  -Wl,-O1 -Wl,--as-needed -o bin/sf src/sf.o src/sfmenus.o src/colors.o src/common.o -lncursesw -lm -lconfig -ltinfow
src/showmenus.c: In function 'refreshDirectory':
src/showmenus.c:334:5: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Wunused-result]
  334 |     chdir(currentpwd);
      |     ^~~~~~~~~~~~~~~~~
src/showmenus.c: In function 'show_directory_input':
src/showmenus.c:393:7: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Wunused-result]
  393 |       chdir(currentpwd);
      |       ^~~~~~~~~~~~~~~~~
src/showmenus.c: In function 'linktext_input':
src/showmenus.c:1357:13: warning: ignoring return value of 'symlink', declared with attribute warn_unused_result [-Wunused-result]
 1357 |             symlink(relativeFile, target);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/showmenus.c:1360:13: warning: ignoring return value of 'symlink', declared with attribute warn_unused_result [-Wunused-result]
 1360 |             symlink(file, target);
      |             ^~~~~~~~~~~~~~~~~~~~~
src/showmenus.c:1363:11: warning: ignoring return value of 'link', declared with attribute warn_unused_result [-Wunused-result]
 1363 |           link(file, target);
      |           ^~~~~~~~~~~~~~~~~~
src/showmenus.c: In function 'directory_view_menu_inputs':
src/showmenus.c:1519:15: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Wunused-result]
 1519 |               chdir(currentpwd);
      |               ^~~~~~~~~~~~~~~~~
src/showmenus.c:1569:15: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Wunused-result]
 1569 |               chdir(currentpwd);
      |               ^~~~~~~~~~~~~~~~~
src/showmenus.c:1581:15: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Wunused-result]
 1581 |               chdir(currentpwd);
      |               ^~~~~~~~~~~~~~~~~
src/showfunctions.c: In function 'get_dir':
src/showfunctions.c:1607:33: warning: format '%d' expects argument of type 'int', but argument 3 has type '__nlink_t' {aka 'long unsigned int'} [-Wformat=]
 1607 |             sprintf(hlinkstr, "%d", buffer.st_nlink);
      |                                ~^   ~~~~~~~~~~~~~~~
      |                                 |         |
      |                                 int       __nlink_t {aka long unsigned int}
      |                                %ld
src/showfunctions.c: In function 'writeResultStruct':
src/showfunctions.c:547:5: warning: ignoring return value of 'readlink', declared with attribute warn_unused_result [-Wunused-result]
  547 |     readlink(filename, ob[count].slink, cslinklen);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/showfunctions.c: In function 'LaunchShell':
src/showfunctions.c:961:3: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
  961 |   write(STDOUT_FILENO, "\nUse 'exit' to return to Show.\n\n", 32);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/showfunctions.c:962:3: warning: ignoring return value of 'system', declared with attribute warn_unused_result [-Wunused-result]
  962 |   system(getenv("SHELL"));
      |   ^~~~~~~~~~~~~~~~~~~~~~~
src/showfunctions.c: In function 'LaunchExecutable':
src/showfunctions.c:971:3: warning: ignoring return value of 'system', declared with attribute warn_unused_result [-Wunused-result]
  971 |   system("clear"); // Just to be sure
      |   ^~~~~~~~~~~~~~~
src/showfunctions.c:972:3: warning: ignoring return value of 'system', declared with attribute warn_unused_result [-Wunused-result]
  972 |   system(command);
      |   ^~~~~~~~~~~~~~~
src/showfunctions.c: In function 'get_dir':
src/showfunctions.c:1636:13: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Wunused-result]
 1636 |             chdir(path);
      |             ^~~~~~~~~~~
src/showfunctions.c:1681:7: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result [-Wunused-result]
 1681 |       chdir(path);
      |       ^~~~~~~~~~~
x86_64-pc-linux-gnu-gcc -DSYSCONFIG=\"/etc\" -DDATADIR=\"/usr/share/dfshow\" -D_XOPEN_SOURCE_EXTENDED -march=native -mtune=native -O2 -pipe -fno-common  -Wl,-O1 -Wl,--as-needed -o bin/show src/show.o src/showfunctions.o src/showmenus.o src/colors.o src/common.o -lncursesw -lm -lconfig -ltinfow
/usr/lib/gcc/x86_64-pc-linux-gnu/9.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: src/colors.o:(.bss+0x20): multiple definition of `errmessage'; src/showmenus.o:(.bss+0x320): first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:462: bin/show] Error 1
make[1]: Leaving directory '/var/tmp/portage/app-misc/dfshow-0.8.2_beta/work/dfshow-0.8.2-beta'
make: *** [Makefile:340: all] Error 2
@insanitywholesale
Copy link
Contributor Author

for some context as to why -fno-common was used, it will be enabled by default with gcc10 so this is just planning ahead and testing a bit. I managed to fix the issue locally by changing char errmessage[256]; to extern char errmessage[256]; in src/showmenus.c but since I'm not a good programmer, let alone in C, I thought I should mention it and leave the final decision for how to fix this up to you.

@roberthawdon roberthawdon self-assigned this Apr 4, 2020
@roberthawdon roberthawdon added the bug Something isn't working label Apr 4, 2020
@roberthawdon roberthawdon added this to the v0.9.0 milestone Apr 4, 2020
@roberthawdon
Copy link
Owner

Thanks for the submission, the fix has been pushed into the master branch. Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants