Bosse_B
Posts: 631
Joined: Thu Jan 30, 2014 9:53 am

Errors trying to build an opensource package on Raspbian Jessie

Thu Dec 07, 2017 10:27 am

I am trying to build the cvsnt package on my RPi3 running Raspbian Jessie.
I need the cvsnt cvs executable in order to transfer a CVSNT repository to Subversion using cvs2svn and it seems no longer possible to install cvsnt via apt-get.
I know I could do that a number of years ago, but now no longer.
So I retrieved the sources from an Internet archive as a tarball and expanded this on my RPi3 unit.
As instructed by the INSTALL file I did this inside the project directory:

Code: Select all

./configure  (this worked without errors)
make clean (this also worked without errors)
make
The last command worked for a while but then threw a number of errors and exited.
The complete error output is as shown below and the strange thing is that it complains about missing a number of standard C functions!

How could this happen? I get the exact same errors when trying to make on a new Ubuntu Server 16.04.3 LTS box, but since that is running a 64 bit operating system I thought that I should try on Raspbian, which is 32 bit.

I am not a C++ programmer so I have a very small chance of uncovering the cause of this problem, this is why I ask here for some advice.
Here is an excerpt of the messages on screen where the error output started:

Code: Select all

mkdir .libs
 g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I../../src -I../../lib -g -O2 -c ../mdns_mini.cpp -MT mdns_mini.lo -MD -MP -MF .deps/mdns_mini.TPlo  -fPIC -DPIC -o .libs/mdns_mini.o
In file included from ../mdns_mini.cpp:22:0:
../cvs_string.h: In static member function 'static int cvs::filename_char_traits::compare(const char*, const char*, size_t)':
../cvs_string.h:48:108: error: 'strncmp' was not declared in this scope
   static CVSAPI_EXPORT int compare( const char* s1,  const char* s2, size_t n ) { return fnncmp( s1, s2, n ); }
                                                                                                            ^
../cvs_string.h: In static member function 'static int cvs::username_char_traits::compare(const char*, const char*, size_t)':
../cvs_string.h:63:110: error: 'strncmp' was not declared in this scope
   static CVSAPI_EXPORT int compare( const char* s1,  const char* s2, size_t n ) { return userncmp( s1, s2, n ); }
                                                                                                              ^
In file included from ../mdns_mini.cpp:22:0:
../cvs_string.h: In function 'void cvs::vsprintf(_Typ&, size_t, const char*, va_list)':
../cvs_string.h:97:44: error: there are no arguments to 'strlen' that depend on a template parameter, so a declaration of 'strlen' must be available [-fpermissive]
   str.resize(size_hint?size_hint:strlen(fmt)+256);
                                            ^
../cvs_string.h:97:44: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
../cvs_string.h:106:14: error: '::vsnprintf' has not been declared
    int res = ::vsnprintf((char*)str.data(), str.size(), fmt, xva);
              ^
../cvs_string.h: In member function 'void cvs::wide::utf82ucs2(const char*)':
../cvs_string.h:181:28: error: 'strlen' was not declared in this scope
    w_str.reserve(strlen(src));
                            ^
../mdns_mini.cpp: In member function 'virtual int CMdnsHelperMini::publish(const char*, const char*, const char*, int, const char*)':
../mdns_mini.cpp:103:33: error: 'strncpy' was not declared in this scope
  strncpy(tmp,service,sizeof(tmp));
                                 ^
../mdns_mini.cpp:104:24: error: 'strlen' was not declared in this scope
  char *p=tmp+strlen(tmp)-1;
                        ^
../mdns_mini.cpp:106:42: error: 'strcmp' was not declared in this scope
  if(strlen(tmp)>6 && !strcmp(p-5,".local")) *(p-5)='\0';
                                          ^
../mdns_mini.cpp:112:34: error: 'strdup' was not declared in this scope
  serv->Instance = strdup(instance);
                                  ^
../mdns_mini.cpp:120:24: error: 'strcpy' was not declared in this scope
   strcpy(host,"unknown");
                        ^
../mdns_mini.cpp:121:19: error: 'strchr' was not declared in this scope
  p=strchr(host,'.');
                   ^
../mdns_mini.cpp:124:22: error: 'strcat' was not declared in this scope
  strcat(host,".local");
                      ^
../mdns_mini.cpp:131:25: error: 'strcpy' was not declared in this scope
    strcpy(host,"unknown");
                         ^
../mdns_mini.cpp:153:74: error: 'memcpy' was not declared in this scope
    memcpy(serv->ipv6->address,&sin->sin6_addr,sizeof(serv->ipv6->address));
                                                                          ^
../mdns_mini.cpp:162:74: error: 'memcpy' was not declared in this scope
     memcpy(serv->ipv4->address,&sin->sin_addr,sizeof(serv->ipv4->address));
                                                                          ^
../mdns_mini.cpp:166:82: error: 'printf' was not declared in this scope
     printf("Hostname %s returned loopback address!  Invalid DNS configuration.\n");
                                                                                  ^
Makefile:342: recipe for target 'mdns_mini.lo' failed
make[3]: *** [mdns_mini.lo] Error 1
I am also attaching the files mentioned above, maybe someone with C++ experience can spot the problem?
Attachments
cvsapi.zip
Sources for cvs_string and mdns_mini
(7.35 KiB) Downloaded 3 times
Bo Berglund
Sweden

Bosse_B
Posts: 631
Joined: Thu Jan 30, 2014 9:53 am

Re: Errors trying to build an opensource package on Raspbian Jessie

Thu Dec 07, 2017 11:16 am

I started from the source tarball cvsnt_2.5.03.2382.orig.tar.gz (from debian)
which expanded into ~/dev/cvsnt_2.5.03.2382

I also have access to a few diff file (patches?) like these:
cvsnt_2.5.03.2382-3.3.diff.gz (from ubuntu)
cvsnt_2.5.03.2382-3.3+lenny1.diff.gz (from debian)

But I have never ever used the patch utility so I don't know how to handle these.
They might contain solutions to the problems when building the project....

Can someone please tell me the proper command to apply the second diff file (cvsnt_2.5.03.2382-3.3+lenny1.diff) to the extracted source original?
Bo Berglund
Sweden

Bosse_B
Posts: 631
Joined: Thu Jan 30, 2014 9:53 am

Re: Errors trying to build an opensource package on Raspbian Jessie

Thu Dec 07, 2017 1:53 pm

I managed to apply the patch as follows (executed at the top level of the sources):

Code: Select all

 patch -p1 < ../cvsnt_2.5.03.2382-3.3+lenny1.diff
After this I made this:

Code: Select all

./configure
make clean
make
Now a lot of the errors disappeared but there are still these two left when make exits:

Code: Select all

mkdir .libs
 g++ -DHAVE_CONFIG_H -I. -I. -I../.. -I../../src -I../../lib -g -O2 -c ../mdns_mini.cpp -MT mdns_mini.lo -MD -MP -MF .deps/mdns_mini.TPlo  -fPIC -DPIC -o .libs/mdns_mini.o
In file included from ../mdns_mini.cpp:22:0:
../cvs_string.h: In function 'void cvs::vsprintf(_Typ&, size_t, const char*, va_list)':
../cvs_string.h:107:14: error: '::vsnprintf' has not been declared
    int res = ::vsnprintf((char*)str.data(), str.size(), fmt, xva);
              ^
../mdns_mini.cpp: In member function 'virtual int CMdnsHelperMini::publish(const char*, const char*, const char*, int, const char*)':
../mdns_mini.cpp:166:82: error: 'printf' was not declared in this scope
     printf("Hostname %s returned loopback address!  Invalid DNS configuration.\n");
                                                                                  ^
Makefile:342: recipe for target 'mdns_mini.lo' failed
make[3]: *** [mdns_mini.lo] Error 1
make[3]: Leaving directory '/home/pi/dev/cvsnt-2.5.03.2382/cvsapi/mdns'
Makefile:746: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/home/pi/dev/cvsnt-2.5.03.2382/cvsapi'
Makefile:271: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/pi/dev/cvsnt-2.5.03.2382'
Makefile:213: recipe for target 'all' failed
make: *** [all] Error 2
As you see there are still two standard functions that are not found:

Code: Select all

error: '::vsnprintf' has not been declared
error: 'printf' was not declared in this scope
So the applied patch managed to get rid of the string handling undeclared identifiers, but it did not succeed fully, so now there must be a difference between the gcc libraries in my RPi3 and the libraries used on i386 when building for Debian.
Can someone please tell me what to include to get rid of this?
I googled for vsnprintf and found that the include should be
#include <stdarg.h>
But that is unfortunately already in place...
Regarding printf I added
#include <stdio>
into the cvs_string.h file and by magic that got rid of the above errors.
But now I have these instead...

Code: Select all

mkdir .libs
 g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../src -I../src -I../lib -I../cvsapi -I../cvstools -DCVS_CONFIG_DIR=\"/etc/cvsnt\" -DCVS_LIBRARY_DIR=\"/usr/local/lib/cvsnt\" -I../libltdl -g -O2 -c info_trigger.cpp -MT info_trigger.lo -MD -MP -MF .deps/info_trigger.TPlo  -fPIC -DPIC -o .libs/info_trigger.o
info_trigger.cpp: In function 'int init(const trigger_interface_t*, const char*, const char*, const char*, const char*, const char*, const char*, const char*, const char*, int, const char**, const char**, const char*, const char*)':
info_trigger.cpp:613:18: error: 'PATH_MAX' was not declared in this scope
  static char cwd[PATH_MAX];
                  ^
info_trigger.cpp:614:9: error: 'cwd' was not declared in this scope
  getcwd(cwd,sizeof(cwd));
         ^
Makefile:303: recipe for target 'info_trigger.lo' failed
make[2]: *** [info_trigger.lo] Error 1
make[2]: Leaving directory '/home/pi/dev/cvsnt-2.5.03.2382/triggers'
Makefile:271: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/pi/dev/cvsnt-2.5.03.2382'
Makefile:213: recipe for target 'all' failed
make: *** [all] Error 2
So I guess that PATH_MAX is a problem with the configure file and then the cwd error is a follow-up on that?

Noone here has managed to do this?
Bo Berglund
Sweden

User avatar
topguy
Posts: 3704
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Errors trying to build an opensource package on Raspbian Jessie

Thu Dec 07, 2017 2:01 pm

- I downloaded both the orig source package and the debian patch.
- I unpackaged source. ( tar -zxf )
- I uncompressed the patch. ( gunzip )
- I tested patching with "patch --dry-run" to check there was no errors.
- then I actually patched without "--dry-run".

Code: Select all

wget http://archive.debian.org/debian//pool/main/c/cvsnt/cvsnt_2.5.03.2382.orig.tar.gz
tar -zxf cvsnt_2.5.03.2382.orig.tar.gz
wget http://archive.debian.org/debian//pool/main/c/cvsnt/cvsnt_2.5.03.2382-3.3+lenny1.diff.gz
gunzip cvsnt_2.5.03.2382-3.3+lenny1.diff.gz
patch --dry-run -up0 < cvsnt_2.5.03.2382-3.3+lenny1.diff
patch -up0 < cvsnt_2.5.03.2382-3.3+lenny1.diff
This was the output of patching with no errors.

Code: Select all

pi@raspberrypi:~/dev $ patch -up0 < cvsnt_2.5.03.2382-3.3+lenny1.diff
patching file cvsnt-2.5.03.2382/configure
patching file cvsnt-2.5.03.2382/config.sub
patching file cvsnt-2.5.03.2382/config.guess
patching file cvsnt-2.5.03.2382/configure.in
patching file cvsnt-2.5.03.2382/zlib/zconf.h
patching file cvsnt-2.5.03.2382/src/perms.cpp
patching file cvsnt-2.5.03.2382/debian/postrm
patching file cvsnt-2.5.03.2382/debian/prerm
patching file cvsnt-2.5.03.2382/debian/cvsnt.pam
patching file cvsnt-2.5.03.2382/debian/control
patching file cvsnt-2.5.03.2382/debian/preinst
patching file cvsnt-2.5.03.2382/debian/postinst
patching file cvsnt-2.5.03.2382/debian/docs
patching file cvsnt-2.5.03.2382/debian/changelog
patching file cvsnt-2.5.03.2382/debian/init.d
patching file cvsnt-2.5.03.2382/debian/rules
patching file cvsnt-2.5.03.2382/debian/copyright
patching file cvsnt-2.5.03.2382/debian/compat
patching file cvsnt-2.5.03.2382/debian/README.Debian
patching file cvsnt-2.5.03.2382/cvsapi/cvs_string.h
patching file cvsnt-2.5.03.2382/cvsapi/StringDiff.loT
patching file cvsnt-2.5.03.2382/cvsapi/diff/StringDiff.cpp
patching file cvsnt-2.5.03.2382/cvsapi/diff/DiffBase.cpp
patching file cvsnt-2.5.03.2382/cvsapi/diff/StringDiff.h
patching file cvsnt-2.5.03.2382/cvsapi/diff/DiffBase.h
patching file cvsnt-2.5.03.2382/cvsapi/odbc/OdbcConnection.cpp
patching file cvsnt-2.5.03.2382/cvsapi/odbc/OdbcRecordset.h
patching file cvsnt-2.5.03.2382/cvsapi/odbc/OdbcConnection.h
patching file cvsnt-2.5.03.2382/cvsdelta/cvsdelta.h
patching file cvsnt-2.5.03.2382/man/cvslockd.1
patching file cvsnt-2.5.03.2382/man/Plugins.5
patching file cvsnt-2.5.03.2382/man/PServer.5
patching file cvsnt-2.5.03.2382/man/Makefile.in

User avatar
topguy
Posts: 3704
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Errors trying to build an opensource package on Raspbian Jessie

Thu Dec 07, 2017 2:44 pm

I see you found the same way while I was testing..

PATH_MAX can be fixed by adding #include <linux/limits.h>

But then you get to a place where you have to remove a "const" from a couple of function definitions.
And then I get an an error where I dont bother anymore ... :-)

Bosse_B
Posts: 631
Joined: Thu Jan 30, 2014 9:53 am

Re: Errors trying to build an opensource package on Raspbian Jessie

Fri Dec 08, 2017 7:39 am

topguy wrote:
Thu Dec 07, 2017 2:44 pm
But then you get to a place where you have to remove a "const" from a couple of function definitions.
And then I get an an error where I dont bother anymore ... :-)
Yes, I gave up on that idea!
Luckily I have access to a 7 years old virtual machine running Ubuntu10 where cvsnt *is* installed so I will use that for my conversion.
It was not easy to modify to get SSH access but I managed to do that in the end.
So now I can use PuTTY to interface to it and send files to and from it using SFTP.
Bo Berglund
Sweden

Return to “C/C++”

Who is online

Users browsing this forum: No registered users and 6 guests