Operating System - HP-UX
1819777 Members
3724 Online
109607 Solutions
New Discussion

Re: Bacula: try to compile on hpux11-31

 
SOLVED
Go to solution
uxbeginner22
Trusted Contributor

Bacula: try to compile on hpux11-31

When i try to compile latest bacula(5.0.12)

on hpux-11.31 i get

 

==>Entering directory /usr/local/src/bacula/bacula-5.2.13/src/lib
Compiling attr.c
attr.c: In function 'ATTR* new_attr(JCR*)':
attr.c:50: error: 'getuid' was not declared in this scope

 

someone had succes compiling bacula?

Thanks

 

 

P.S. This thread has been moved from HP-UX > General  to HP-UX > languages. - Hp Forum Moderator

31 REPLIES 31
Dennis Handly
Acclaimed Contributor

Re: Bacula: try to compile on HP-UX 11-31

Has <unistd.h> been included in the source?

uxbeginner22
Trusted Contributor

Re: Bacula: try to compile on HP-UX 11-31

Yes

 

config.log:| # include <unistd.h>

 

Dennis Handly
Acclaimed Contributor

Re: Bacula: try to compile on HP-UX 11-31

>config.log:| # include <unistd.h>

 

Has it been included in attr.c?

uxbeginner22
Trusted Contributor

Re: Bacula: try to compile on HP-UX 11-31

No it wasn't,now is working.

Thanks

 

 

uxbeginner22
Trusted Contributor

Re: Bacula: try to compile on HP-UX 11-31

My mistake..includedir was wrong.
With correct include dir compile fine
Dennis Handly
Acclaimed Contributor

Re: Bacula: try to compile on HP-UX 11-31

>now is working.  Thanks

 

If the answers were helpful, please click on the Kudos stars.

uxbeginner22
Trusted Contributor

Re: Bacula: try to compile on hpux11-31

New error

 

Compiling btime.c
btime.c: In function 'char* bstrftime(char*, int, int64_t)':
btime.c:52: error: 'localtime_r' was not declared in this scope
btime.c: In function 'char* bstrftimes(char*, int, int64_t)':
btime.c:64: error: 'localtime_r' was not declared in this scope
btime.c: In function 'char* bstrftime_dn(char*, int, int64_t)':
btime.c:76: error: 'localtime_r' was not declared in this scope
btime.c: In function 'char* bstrftime_ny(char*, int, int64_t)':
btime.c:88: error: 'localtime_r' was not declared in this scope
btime.c: In function 'char* bstrftime_nc(char*, int, int64_t)':
btime.c:102: error: 'localtime_r' was not declared in this scope
btime.c: In function 'char* bstrutime(char*, int, int64_t)':
btime.c:121: error: 'localtime_r' was not declared in this scope
btime.c: In function 'int tm_woy(time_t)':
btime.c:250: error: 'localtime_r' was not declared in this scope
btime.c: In function 'void get_current_time(date_time*)':
btime.c:275: error: 'gmtime_r' was not declared in this scope
*** Codice di uscita errore 1

On bacula 7.2.0

i use this configure

 

CPPFLAGS='-I/usr/include' ./configure --enable-client-only \
--prefix=/opt/bacula \
--sysconfdir=/etc/opt/bacula \
--localstatedir=/var/opt/bacula \
--mandir=/opt/bacula/man \
--docdir=/opt/bacula/docs

If use configure without CPPFLAGS give same error

Dennis Handly
Acclaimed Contributor

Re: Bacula: try to compile on HP-UX 11.31

>error: 'localtime_r' was not declared in this scope

 

To get the _r versions of these functions you probably have to compile with cc -mt.

For gcc that probably maps to: -D_POSIX_C_SOURCE=199506L

 

http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/HTML/options.htm#opt-mt

uxbeginner22
Trusted Contributor

Re: Bacula: try to compile on HP-UX 11.31

Same error.

Dennis Handly
Acclaimed Contributor

Re: Bacula: try to compile on HP-UX 11.31

>Same error.

 

Compile with -E and save the output.

Search for the missing functions but without the "_r".  They should be in one file, time.h.

Then look at that file and see if the "_r" functions are there and what macro they are guarded with.

uxbeginner22
Trusted Contributor

Re: Bacula: try to compile on HP-UX 11.31

Please how to compile with -E?

If i try ansi CC -E or gcc -E give me

the error "cannot create executables"

 

Dennis Handly
Acclaimed Contributor

Re: Bacula: try to compile on HP-UX 11.31

>Please how to compile with -E?

 

You need to extract the complete compilation line out of the make output and then add -E to it.

uxbeginner22
Trusted Contributor

Re: Bacula: try to compile on HP-UX 11.31

Ok thanks,i will try it now

uxbeginner22
Trusted Contributor

Re: Bacula: try to compile on HP-UX 11.31

I have found a solution for first error

http://www.backupcentral.com/phpBB2/two-way-mirrors-of-external-mailing-lists-3/bacula-25/problems-compiling-on-hpux-with-fix-105989/

Now give another error

 

gmake[1]: Leaving directory '/tmp/build-bacula/bacula-7.2.0/src/lib'
==>Entering directory /tmp/build-bacula/bacula-7.2.0/src/findlib
gmake[1]: Entering directory '/tmp/build-bacula/bacula-7.2.0/src/findlib'
Compiling attribs.c
attribs.c: In function 'bool set_mod_own_time(JCR*, BFILE*, ATTR*)':
attribs.c:129: error: 'lchmod' was not declared in this scope
Makefile:150: recipe for target 'attribs.lo' failed
gmake[1]: *** [attribs.lo] Error 1
gmake[1]: Leaving directory '/tmp/build-bacula/bacula-7.2.0/src/findlib'
Dennis Handly
Acclaimed Contributor

Re: Bacula: try to compile on HP-UX 11.31

> attribs.c:129: error: 'lchmod' was not declared in this scope

 

There is a man page for lchown(2) but none for lchmod(2).

There is no prototype for lchmod(2) but there seems to be a libc function for it but without documentation it isn't supported.

uxbeginner22
Trusted Contributor

Re: Bacula: try to compile on HP-UX 11.31

Downgrading to old 5.2 i get this error message

 

>Entering directory /tmp/build-bacula/bacula-5.2.13/src/filed
Linking bacula-fd ...
	/tmp/build-bacula/bacula-5.2.13/libtool --silent --tag=CXX --mode=link /usr/local/bin/g++   -L../lib -L../findlib -o bacula-fd filed.o authenticate.o acl.o backup.o estimate.o  fd_plugins.o accurate.o  filed_conf.o heartbeat.o job.o pythonfd.o  restore.o status.o verify.o verify_vol.o xattr.o \
	     -lbacfind -lbacpy -lbaccfg -lbac -lm  -lpthread  \
	     -lssl -lcrypto   
ld: Unsatisfied symbol "regerror(int, re_pattern_buffer const*, char*, unsigned long)" in file job.o
ld: (Warning) Unsatisfied symbol "regexec(re_pattern_buffer const*, char const*, unsigned long, regmatch_t*, int)" in file /tmp/build-bacula/bacula-5.2.13/src/findlib/.libs/libbacfind.so
ld: Unsatisfied symbol "regcomp(re_pattern_buffer*, char const*, int)" in file job.o
ld: (Warning) Unsatisfied symbol "posix_fadvise(int, long long, long long, int)" in file /tmp/build-bacula/bacula-5.2.13/src/lib/.libs/libbac.so
ld: Unsatisfied symbol "regfree(re_pattern_buffer*)" in file job.o
2 warnings.
3 errors.
collect2: ld returned 1 exit status
*** Codice di uscita errore 1

No way to get bacula on hpux?

uxbeginner22
Trusted Contributor

Re: Bacula: try to compile on HP-UX 11.31

Solved also this error with this configure

 

./configure --enable-client-only --prefix=/opt/bacula --sysconfdir=/etc/opt/bacula --localstatedir=/var/opt/bacula --with-working-dir=/var/opt/bacula/working --with-scriptdir=/var/opt/bacula/scripts --mandir=/opt/bacula/man --docdir=/opt/bacula/docs CPPFLAGS='-I/usr/local/include' LDFLAGS='-L/usr/local/lib'

gmake LDFLAGS="-lregex"

Solution found finally?Nope,another error!

 

Compiling acl.c
Compiling backup.c
backup.c: In function ‘bool setup_compression(bctx_t&)’:
backup.c:1099: error: ‘struct bctx_t’ has no member named ‘max_compress_len’
backup.c:1041: warning: unused variable ‘jcr’
Makefile:156: recipe for target 'backup.o' failed
gmake[1]: *** [backup.o] Error 1
gmake[1]: Leaving directory '/home/giuseppe/bacula/bin/bacula-7.2.0/src/filed'
uxbeginner22
Trusted Contributor

Re: Bacula: try to compile on HP-UX 11.31

The error "fixed" with this configure

 

./configure --enable-client-only --prefix=/opt/bacula --sysconfdir=/etc/opt/bacula --localstatedir=/var/opt/bacula --wit
h-working-dir=/var/opt/bacula/working --with-scriptdir=/var/opt/bacula/scripts --mandir=/opt/bacula/man --docdir=/opt/ba
cula/docs CPPFLAGS='-I/usr/local/include -I /usr/local/include/readline -I /usr/local/include/lzo'  LDFLAGS='-L/usr/loca
l/lib -L /usr/local/lib/hpux32'

But still give me the regex error,even with LDFLAGS='-lregex'

 

libtool --silent --tag=CXX --mode=link /usr/local/bin/g++ -lregex  -L../lib -L../cats -o bconsole console.o console_conf.o authenticate.o  \
        -lbaccfg -lbac -lm -lpthread  -lintl -lintl \
      -lssl -lcrypto
ld: (Warning) Unsatisfied symbol "regerror(int, re_pattern_buffer const*, char*, unsigned long)" in file /home/giuseppe/bacula/src/bacula-5.2.13/src/lib/.libs/libbac.so
ld: (Warning) Unsatisfied symbol "regexec(re_pattern_buffer const*, char const*, unsigned long, regmatch_t*, int)" in file /home/giuseppe/bacula/src/bacula-5.2.13/src/lib/.libs/libbac.so
ld: (Warning) Unsatisfied symbol "regcomp(re_pattern_buffer*, char const*, int)" in file /home/giuseppe/bacula/src/bacula-5.2.13/src/lib/.libs/libbac.so
ld: (Warning) Unsatisfied symbol "posix_fadvise(int, long long, long long, int)" in file /home/giuseppe/bacula/src/bacula-5.2.13/src/lib/.libs/libbac.so
ld: (Warning) Unsatisfied symbol "regfree(re_pattern_buffer*)" in file /home/giuseppe/bacula/src/bacula-5.2.13/src/lib/.libs/libbac.so
5 warnings.
==== Make of console is good ====

 

 

uxbeginner22
Trusted Contributor
Solution

Re: Bacula: try to compile on hpux11-31

Solution found,the package regex(gnu regex from http://hpux.connect.org.uk/)  must be removed before install bacula,then you can reinstall it

Using this configure works fine,i try it on bacula-git,i don't know if works fine on bacula-7.2

 

./configure --enable-client-only --prefix=/opt/bacula --sysconfdir=/etc/opt/bacula --localstatedir=/var/opt/bacula --with-working-dir=/var/opt/bacula/working --with-scriptdir=/var/opt/bacula/scripts --mandir=/opt/bacula/man --docdir=/opt/bacula/docs --disable-conio CPPFLAGS='-I/usr/local/include -I /usr/local/include/readline -I /usr/local/include/lzo'  LDFLAGS='-L/usr/local/lib'
gmake -j3

You need this patch,i don't know what happen if lchmod is removed,i will try with test backups

 

--- bacula-7.0.5/src/bacula.h   2015-08-13 15:52:24 +0200
+++ bacula-7.0.5/src/bacula.h   2015-10-05 19:21:09 +0200
@@ -72,7 +72,7 @@
 #endif
 #if HAVE_UNISTD_H
 #  ifdef HAVE_HPUX_OS
-#  undef _INCLUDE_POSIX1C_SOURCE
+/*#  undef _INCLUDE_POSIX1C_SOURCE*/
 #  endif
 #include <unistd.h>
 #endif
@@ -95,6 +95,7 @@
 #if defined(_MSC_VER)
 extern "C" {
 #include "getopt.h"
+#include "fcntl.h"
 }
 #endif
 
--- bacula-7.0.5/configure      2015-10-07 17:44:44 +0200
+++ bacula-7.0.5/configure      2015-10-07 17:44:57 +0200
@@ -22604,7 +22604,7 @@
 fi
 done
 
-for ac_func in lstat lchown lchmod futimes fchmod fchown
+for ac_func in lstat lchown futimes fchmod fchown
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

 

uxbeginner22
Trusted Contributor

Re: Bacula: try to compile on hpux11-31

I found another  solution here

https://groups.google.com/forum/?hl=de#!topic/bareos-devel/z__p6DoZAJQ

But how to force chmod instead of lchmod?

 

uxbeginner22
Trusted Contributor

Re: Bacula: try to compile on hpux11-31

New error

 

/usr/lib/hpux32/dld.so: Unsatisfied code symbol '_Z13posix_fadviseixxi' in load module '/opt/bacula/lib/libbacfind-7.4.0.so'.

 

How to solve?Thanks

Dennis Handly
Acclaimed Contributor

Re: Bacula: try to compile on HP-UX 11-31 <fcntl.h> not C++ified

>How to solve?

 

So where is posix_fadvise(int, long long, long long, int) suppose to be defined?

It appears this is a Linux function.  Perhaps someone forgot to stub it out on HP-UX AND declare as extern "C".

uxbeginner22
Trusted Contributor

Re: Bacula: try to compile on HP-UX 11-31

I have manpage on hpux

man -k posix|grep -i advi
posix_fadvise(), posix_fadvise64()(2)   - file advisory information
Dennis Handly
Acclaimed Contributor

Re: Bacula: try to compile on HP-UX 11-31 <fcntl.h> not C++ified

>I have manpage on HP-UX

 

Ah, it looks like someone didn't put the new prototypes in the right place.  They aren't C++ified correctly.

You'll have to modify /usr/include/sys/fcntl.h.  (And notify Support about this bug.)