vermaneerajin / shellinabox

Automatically exported from code.google.com/p/shellinabox
Other
0 stars 0 forks source link

Fail to compile under FreeBSD 9-current ( #72

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I'm the port maintainer of Shell in a box for FreeBSD, and I meet a problem for 
compile it under FreeBSD 9-current (no problem for FreeBSD 7.x and 8x).
The problem is that FreeBSD 9-current add utmpx.h (previous release used utmp.h 
only).

And the FreeBSD utmpx doesn't support the updwtmpx() function.
You can found more infomation about FreeBSD utmpx here: 
http://80386.nl/unix/utmpx/

This prevent to build shell in a box.
Here is the full build log:
http://pointyhat.freebsd.org/errorlogs/i386-errorlogs/a.9.20100707083935/shellin
abox-2.10.log

And her is an extract of this log:
shellinabox/launcher.c:522: undefined reference to `updwtmpx'
launcher.o(.text+0x1554): In function `internalLogin':
shellinabox/launcher.c:1030: undefined reference to `updwtmpx'
launcher.o(.text+0x2db7): In function `childProcess':
shellinabox/launcher.c:1314: undefined reference to `updwtmpx'
*** Error code 1

I'm not a C developer, and I didn't know auto-tools, but a solution can be to 
test the support of updwtmpx (configure.ac ??) and to modify the launcher.c for 
avoid to call updwtmpx if not supported.

Thanks for your excellent software that I'm using every day!

Regards,

Olivier

Original issue reported on code.google.com by cochard on 8 Jul 2010 at 4:06

GoogleCodeExporter commented 8 years ago
Let me know if the most recent version of the code in Subversion fixes the 
problem?

Without knowing exactly how FreeBSD defines the "utmp" and "utmpx" structures, 
I had to guess a little bit. And this might or might not be the correct 
solution for FreeBSD.

If it still doesn't work, send me a copy of 1) your "config.h" file, 2) the 
full list of compiler errors, and 3) try to find the header files that define 
"struct utmp" and "struct utmpx".

Original comment by zod...@gmail.com on 8 Jul 2010 at 5:56

GoogleCodeExporter commented 8 years ago
Excellent and very fast :-)
I didn't have the updwtmpx error using the code from the svn.

But I've got a new compilation error that I never see before, here is how the 
end of the compilation failed:

(etc...)
libtool: link: gcc -g -std=gnu99 -Wall -Os -o shellinaboxd shellinaboxd.o 
externalfile.o launcher.o privileges.o service.o session.o usercss.o 
shellinabox/cgi_root.o shellinabox/root_page.o shellinabox/vt100.o 
shellinabox/shell_in_a_box.o shellinabox/styles.o shellinabox/print-styles.o 
shellinabox/enabled.o shellinabox/favicon.o shellinabox/beep.o  
./.libs/liblogging.a ./.libs/libhttp.a -lz -lutil
preprocess ./shellinabox/shellinaboxd.man.in >shellinaboxd.1
ln "" "./demo/beep.wav"
ln: : No such file or directory
*** Error code 1

Regards,

Olivier

Original comment by cochard on 8 Jul 2010 at 7:30

GoogleCodeExporter commented 8 years ago
That is very strange indeed.

You should have the following lines in your "Makefile":

${top_srcdir}/demo/beep.wav: ${top_srcdir}/shellinabox/beep.wav
        @rm -f "$@"
        ln "$<" "$@"

And unless your "make" utility doesn't know how to parse "$<", there really 
isn't any way that this could fail. As far as I can tell, "$<" has been in 
"make" from day one. I don't think, BSD would do anything different here.

So, I am really a little puzzled.

Maybe, you could check out a completely fresh tree and see if the problem 
persists?

Original comment by zod...@gmail.com on 8 Jul 2010 at 7:41

GoogleCodeExporter commented 8 years ago
Ok, I've tried to build the shellinabox-svn source on a FreeBSD 8.1 in place of 
FreeBSD 9-current: I have the same problem… 

But the shellinabox 2.10 source build fine on FreeBSD 8.1, and the Makefile of 
shellinabox 2.10 include the same "ln "$<" "$@" lines !

Then, still under FreeBSD 8.1, I've try to found where is the problem by 
comparing the output of configure, and I've got only one line difference on the 
shellinabox-svn configure output:
checking for gethostbyname_r... yes

There is no difference with the make output too (with the exception of the last 
error in make).

But the Makefile generated after the ./configure contains lot's of difference.
I will contact some FreeBSD C developers for helping me on understanding this 
problem and kept you updated.

But, anyway, this error is produce after that the shellinaboxd binary file was 
generated ? Can I test the bin shellinaboxd even with this error ?

Regards,

Original comment by cochard on 9 Jul 2010 at 6:04

GoogleCodeExporter commented 8 years ago
Speaking about the first problem, you can find the FreeBSD-CURRENT
definition of struct utmpx at [1]; struct utmp and utmp.h where removed
completely.

Speaking about the second error, I do also have it... sometimes. And
sometimes it's not there, but if I rm demo/beep.wav and run make again,
the error is back. Moreover, if I rm any of the demo files and try to
recreate them with "make ./demo/<file>", the same error happens. Not
with GNU make though.

Anyway, I think that $< ("implied source") in the rule you cited
should actually be $> ("all sources") instead. Implied source should
only be used with suffix rules, and changing it to $> fixes the issue.

[1] http://svn.freebsd.org/viewvc/base/head/include/utmpx.h?view=markup

Original comment by vmage...@gmail.com on 9 Jul 2010 at 11:07

GoogleCodeExporter commented 8 years ago
vmagerya, thank you for that helpful information. I just committed another 
change that should make the updwtmpx() wrapper function more 
standards-compliant.

Although, given what you told me, it sounds as if current BSDs don't even need 
it. Apparently, pututxline() includes support for updating the wtmp file. 
That's actually nicer than on Linux and other SysV systems.

As for the Makefile, I don't see support for $> in GNU Make, but it does have 
$^. Maybe, that's what you meant? I changed the Makefile, and it still does the 
right thing for GNU Make. Can you test whether this works on BSD now? Thanks.

Original comment by zod...@gmail.com on 9 Jul 2010 at 3:53

GoogleCodeExporter commented 8 years ago
Yes, it seems that updwtmpx is not needed on FreeBSD, but I don't run
CURRENT, so I can't really test if it does the right thing there.

As for $> vs. $^, it seems that BSD make and GNU make diverge on this
point: there is no $^ in BSD make... Digging a little further, POSIX
doesn't appear to require either of those variables, so I guess you'll
have to use $? ("out-of-date sources").

Check out the BSD make manpage at [1] (the one at freebsd.org is
misformatted for some reason, so the link is to a third-party site).

[1] http://nixdoc.net/man-pages/FreeBSD/man1/make.1.html

Original comment by vmage...@gmail.com on 9 Jul 2010 at 5:15

GoogleCodeExporter commented 8 years ago
OK, let me know, if this is better now.

Original comment by zod...@gmail.com on 9 Jul 2010 at 5:22

GoogleCodeExporter commented 8 years ago
Works for me.

Original comment by vmage...@gmail.com on 9 Jul 2010 at 5:40

GoogleCodeExporter commented 8 years ago
Works for me on FreeBSD 9-current and FreeBSD 8.1-RC2 too!
Thanks a lot's for you reactivity Markus, and thanks Vitaly for your help.

Markus:  When do you plan to release the next version ?

Original comment by cochard on 10 Jul 2010 at 10:06