0

I want to manually compile the login command (with the exact CC and LD commands).

https://packages.ubuntu.com/groovy/login

/tmp/shadow_4.8.1.orig/src$ make VERBOSE=1
  CC       login.o
  CCLD     login

The above command doesn't show the exact command. When I run the following, I see the following error.

$ gcc -o login login.c
login.c:33:10: fatal error: config.h: No such file or directory
   33 | #include <config.h>
      |          ^~~~~~~~~~
compilation terminated.

Could anybody show me how to get the exact commands used to compile the program login? Thanks.

1 Answer 1

0

In this case, where the build is configured by automake, you need V=1 not VERBOSE=1:

$ make V=1 login
gcc -DHAVE_CONFIG_H -I. -I..  -I../lib -I../libmisc -DLOCALEDIR=\"/usr/share/locale\"   -g -O2 -MT login.o -MD -MP -MF .deps/login.Tpo -c -o login.o login.c
login.c: In function ‘alarm_handler’:
login.c:424:2: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
  424 |  write (STDERR_FILENO, tmsg, strlen (tmsg));
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mv -f .deps/login.Tpo .deps/login.Po
gcc -DHAVE_CONFIG_H -I. -I..  -I../lib -I../libmisc -DLOCALEDIR=\"/usr/share/locale\"   -g -O2 -MT login_nopam.o -MD -MP -MF .deps/login_nopam.Tpo -c -o login_nopam.o login_nopam.c
login_nopam.c: In function ‘netgroup_match’:
login_nopam.c:198:3: warning: ignoring return value of ‘getdomainname’, declared with attribute warn_unused_result [-Wunused-result]
  198 |   getdomainname (domain, MAXHOSTNAMELEN);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mv -f .deps/login_nopam.Tpo .deps/login_nopam.Po
/bin/bash ../libtool  --tag=CC   --mode=link gcc  -g -O2   -o login login.o login_nopam.o  ../libmisc/libmisc.a ../lib/libshadow.la    -lcrypt
libtool: link: gcc -g -O2 -o login login.o login_nopam.o  ../libmisc/libmisc.a ../lib/.libs/libshadow.a -lcrypt

To build the whole package, change to the src directory's parent directory and run

./configure
make

See also:

7
  • Where is V defined? It depends on login_nopam.o ../libmisc/libmisc.a ../lib/.libs/libshadow.a, which can depend on other files as well. How to get the complete commands to compile login including all the dependencies? Mar 19, 2021 at 2:00
  • @user1424739 I have added a link to the automake documentation about the V parameter. To build the libraries, run ./configure and make in the parent directory like I already mentioned. Mar 19, 2021 at 2:09
  • You misunderstood my second question. I am asking how to get all the raw commands (and only those commands but not any other irrelevant commands) (so that I can manually compile the dependencies) instead of just compiling the dependencies. Mar 19, 2021 at 2:11
  • @user1424739 ... so add V=1 to the make command in the parent dir... or in the lib dir? You may need to make clean or touch the relevant source file(s) to force re-compilation if you already built them without V=1 Mar 19, 2021 at 2:16
  • So, there is no automatic way to trace back to all the dependencies and their dependencies? To trace back one more level of dependency, I have to do it manually as you mentioned to remove some intermediate files? Mar 19, 2021 at 2:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .