OVAL build issue

Help
Anonymous
2011-05-09
2013-06-12
  • Anonymous - 2011-05-09

    I am getting the following errors when i compile the OVAL checked out code. Not sure what version is it .

    /opensource/ovaldi/project/linux$ make
    g++  -Wall -O -DLINUX -I/usr/local/include -I/usr/include -I../../src/linux -I../../src -I../../src/probes/unix -I../../src/probes/linux -I../../src/probes/independent -I/usr/include/pcre -DPACKAGE_DPKG  -c -o ../../src/probes/linux/SelinuxBooleanProbe.o ../../src/probes/linux/SelinuxBooleanProbe.cpp
    ../../src/probes/linux/SelinuxBooleanProbe.cpp:43: error: expected constructor, destructor, or type conversion before ‘<’ token
    ../../src/probes/linux/SelinuxBooleanProbe.cpp:116: error: expected constructor, destructor, or type conversion before ‘<’ token
    ../../src/probes/linux/SelinuxBooleanProbe.cpp: In function ‘void<unnamed>::GetBooleansByName(const StringVector&, ObjectEntity*, ItemVector*)’:
    ../../src/probes/linux/SelinuxBooleanProbe.cpp:142: error: ‘auto_ptr’ was not declared in this scope
    ../../src/probes/linux/SelinuxBooleanProbe.cpp:142: error: expected primary-expression before ‘>’ token
    ../../src/probes/linux/SelinuxBooleanProbe.cpp:144: error: ‘nameItemEntity’ was not declared in this scope
    ../../src/probes/linux/SelinuxBooleanProbe.cpp:150: error: expected primary-expression before ‘>’ token
    ../../src/probes/linux/SelinuxBooleanProbe.cpp:150: error: ‘item’ was not declared in this scope
    ../../src/probes/linux/SelinuxBooleanProbe.cpp:150: error: ‘::CreateItem’ has not been declared
    make: ***  Error 1

      I am building oval on ubuntu maverick meerkat.

    Thank you
    Ranganath

     
  • Michael Chisholm

    Although I couldn't reproduce this, it does look like I forgot to #include <memory> in that file.  I suspect that might have caused the problem.  I've added it.

     
  • Panos

    Panos - 2012-02-10

    Hello,

    I am trying to install ovaldi-2.10.1 on a Ubuntu 11. I have installed all dependencies. I am still seeing

    -lxerces-c -lxalan-c -lpcre -lpopt -lgcrypt -lldap -lblkid -lapt-pkg -o Release/ovaldi
    ../../src/probes/linux/SelinuxBooleanProbe.o: In function `SelinuxBooleanProbe::SelinuxBooleanProbe()':
    SelinuxBooleanProbe.cpp:(.text+0x6d): undefined reference to `security_load_booleans'
    ../../src/probes/linux/SelinuxBooleanProbe.o: In function `(anonymous namespace)::GetBooleansByName(std::vector<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, ObjectEntity*, std::vector<Item*, std::allocator<Item*> >*)':
    SelinuxBooleanProbe.cpp:(.text+0x4e4): undefined reference to `security_get_boolean_active'
    SelinuxBooleanProbe.cpp:(.text+0x4f2): undefined reference to `security_get_boolean_pending'
    ../../src/probes/linux/SelinuxBooleanProbe.o: In function `SelinuxBooleanProbe::CollectItems(Object*)':
    SelinuxBooleanProbe.cpp:(.text+0x11c6): undefined reference to `security_get_boolean_names'
    ../../src/probes/linux/SelinuxSecurityContextProbe.o: In function `(anonymous namespace)::ContextGuard::~ContextGuard()':
    SelinuxSecurityContextProbe.cpp:(.text+0x13): undefined reference to `context_free'
    ../../src/probes/linux/SelinuxSecurityContextProbe.o: In function `(anonymous namespace)::SecurityContextGuard::~SecurityContextGuard()':
    SelinuxSecurityContextProbe.cpp:(.text+0x29): undefined reference to `freecon'
    ../../src/probes/linux/SelinuxSecurityContextProbe.o: In function `(anonymous namespace)::CompleteItem(std::vector<ItemEntity*, std::allocator<ItemEntity*> >*, context_s_t*, context_s_t*)':
    SelinuxSecurityContextProbe.cpp:(.text+0xdad): undefined reference to `context_user_get'
    SelinuxSecurityContextProbe.cpp:(.text+0xee9): undefined reference to `context_role_get'
    SelinuxSecurityContextProbe.cpp:(.text+0x1025): undefined reference to `context_type_get'
    SelinuxSecurityContextProbe.cpp:(.text+0x1142): undefined reference to `context_range_get'
    SelinuxSecurityContextProbe.cpp:(.text+0x1bf5): undefined reference to `context_range_get'
    ../../src/probes/linux/SelinuxSecurityContextProbe.o: In function `(anonymous namespace)::CompleteFileItem(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
    SelinuxSecurityContextProbe.cpp:(.text+0x3599): undefined reference to `getfilecon'
    SelinuxSecurityContextProbe.cpp:(.text+0x3698): undefined reference to `getfilecon_raw'
    SelinuxSecurityContextProbe.cpp:(.text+0x37b5): undefined reference to `context_new'
    SelinuxSecurityContextProbe.cpp:(.text+0x395b): undefined reference to `context_new'
    SelinuxSecurityContextProbe.cpp:(.text+0x3b15): undefined reference to `context_free'
    SelinuxSecurityContextProbe.cpp:(.text+0x3b28): undefined reference to `context_free'
    SelinuxSecurityContextProbe.cpp:(.text+0x3b3b): undefined reference to `freecon'
    SelinuxSecurityContextProbe.cpp:(.text+0x3b4e): undefined reference to `freecon'
    ../../src/probes/linux/SelinuxSecurityContextProbe.o: In function `(anonymous namespace)::CompletePidItem(std::vector<ItemEntity*, std::allocator<ItemEntity*> >*, int)':
    SelinuxSecurityContextProbe.cpp:(.text+0x41e6): undefined reference to `getpidcon'
    SelinuxSecurityContextProbe.cpp:(.text+0x429e): undefined reference to `getpidcon_raw'
    SelinuxSecurityContextProbe.cpp:(.text+0x4356): undefined reference to `context_new'
    SelinuxSecurityContextProbe.cpp:(.text+0x44f0): undefined reference to `context_new'
    SelinuxSecurityContextProbe.cpp:(.text+0x4693): undefined reference to `context_free'
    SelinuxSecurityContextProbe.cpp:(.text+0x46a3): undefined reference to `context_free'
    SelinuxSecurityContextProbe.cpp:(.text+0x46b3): undefined reference to `freecon'
    SelinuxSecurityContextProbe.cpp:(.text+0x46c7): undefined reference to `freecon'
    collect2: ld returned 1 exit status

    But my ../../src/probes/linux/SelinuxBooleanProbe.cpp has the #include <memory> in it.
    Any ideas on how to fix it?

    Thank you,
    PK

     
  • Sandeep Rathan

    Sandeep Rathan - 2012-02-10

    Try adding -lselinux in Makefile along with existing libs.

     
  • Panos

    Panos - 2012-02-10

    Thank you rsandeep, that fixed it.

    Just for completeness I added -lselinux in the LIBS in my make file. So it became something like

    else ifneq (${PACKAGE_DPKG}, )
    LIBS += -lapt-pkg -lselinux

    Note that I had commented out the PACKAGE_RPM definition because it was causing other errors. So, I added -lselinux in the LIBS definition under the PACKAGE_DPKG else ifneq.

    Thanks a lot,
    PK

     
  • David Rothenberg

    Pankab,
    I am interested in which errors you say PACKAGE_RPM was giving you. Despite being Ubuntu and not having RPM, the line above it that reads "PACKAGE_RPM = $(shell /usr/bin/env rpm -version 2>/dev/null)" should correctly set the flag for whether or not it is installed on the system (contains version string if exists, stderr directed to dev/null if not). The selinux package should also be able to be appended outside of the dpkg check if preferred. Lastly, not that it was broken before, but I noticed from that "else ifneq" that you are using a pre 5.10.1 makefile if you wish to update that. The newest version reorders the logic to support the case where both rpm and dpkg are installed instead of the old logic which would disable both(dpkg installed so disable rpm and vice versa).

     
  • Panos

    Panos - 2012-02-10

    I appreciate your responsiveness.

    Strange, I downloaded the ovaldi-5.10.1-src.zip and the Makefile line is still the same

    else ifneq (${PACKAGE_DPKG}, )
        LIBS += -lapt-pkg
    

    Could the error with PACKAGE_RPM in there be because I had done

    apt-get install rpm
    apt-get install alien
    

    I didn't keep all the errors. But they were very similar to what I saw here http://sourceforge.net/apps/mediawiki/ovaldi/index.php?title=Build_notes that follow

    g++ -Wall -O -DLINUX -I/usr/local/include -I/usr/include -I../../src/linux -I../../src -I../../src/probes/unix -I../../src/probes/linux -I../../src/probes/independent -DPACKAGE_RPM -c -o ../../src/probes/linux/InetListeningServersProbe.o ../../src/probes/linux/InetListeningServersProbe.cpp ../../src/probes/linux/InetListeningServersProbe.cpp: In member function StringVector* InetListeningServersProbe::GetProtocols(ObjectEntity*): ../../src/probes/linux/InetListeningServersProbe.cpp:310: warning: the address of allProtocols will always evaluate as true ../../src/probes/linux/InetListeningServersProbe.cpp: In member function StringVector* InetListeningServersProbe::GetLocalAddresses(std::string, ObjectEntity*): ../../src/probes/linux/InetListeningServersProbe.cpp:422: warning: the address of allLocalAddresses will always evaluate as true ../../src/probes/linux/InetListeningServersProbe.cpp: In member function StringVector* InetListeningServersProbe::GetLocalPorts(std::string, std::string, ObjectEntity*): ../../src/probes/linux/InetListeningServersProbe.cpp:538: warning: the address of allLocalPorts will always evaluate as true g++ -Wall -O -DLINUX -I/usr/local/include -I/usr/include -I../../src/linux -I../../src -I../../src/probes/unix -I../../src/probes/linux -I../../src/probes/independent -DPACKAGE_RPM -c -o ../../src/probes/linux/RPMInfoProbe.o ../../src/probes/linux/RPMInfoProbe.cpp ../../src/probes/linux/RPMInfoProbe.cpp: In member function StringVector* RPMInfoProbe::GetRPMNames(ObjectEntity*): ../../src/probes/linux/RPMInfoProbe.cpp:181: warning: the address of allNames will always evaluate as true ../../src/probes/linux/RPMInfoProbe.cpp: In member function char* RPMInfoProbe::readHeaderString(headerToken_s*, int_32): ../../src/probes/linux/RPMInfoProbe.cpp:391: error: headerGetEntry was not declared in this scope ../../src/probes/linux/RPMInfoProbe.cpp: In member function int_32 RPMInfoProbe::readHeaderInt32(headerToken_s*, int_32): ../../src/probes/linux/RPMInfoProbe.cpp:413: error: headerGetEntry was not declared in this scope ../../src/probes/linux/RPMInfoProbe.cpp: In member function void RPMInfoProbe::ChildGetSigKeyId(int, int, std::string): ../../src/probes/linux/RPMInfoProbe.cpp:456: warning: deprecated conversion from string constant to char* ../../src/probes/linux/RPMInfoProbe.cpp:457: warning: deprecated conversion from string constant to char* ../../src/probes/linux/RPMInfoProbe.cpp:458: warning: deprecated conversion from string constant to char* ../../src/probes/linux/RPMInfoProbe.cpp:498: error: invalid conversion from const char** to char* const* ../../src/probes/linux/RPMInfoProbe.cpp:498: error: initializing argument 3 of int rpmcliQuery(rpmts_s*, rpmQVKArguments_s*, char* const*)
    

    Rgs,
    PK

     
  • David Rothenberg

    That would be the case where the RPM package was found first and disabled the dpkg libraries since both were installed. My mistake with the version listing as well, I should have clarified that it was fixed with the 5.10.1 build 1 release (5.10.1.1). Please see if downloading the following file (plus the selinux library inclusion line rsandeep suggested) fixes your problems without the need to comment anything out: http://ovaldi.svn.sourceforge.net/viewvc/ovaldi/trunk/project/linux/Makefile?revision=1237&view=markup

     
  • Panos

    Panos - 2012-02-13

    No go.
    I went to 5.10.1.1 and if I don't comment out the PACKAGE_RPM from in the Makefile, it fails with

    g++  -Wall -O -DLINUX -I/usr/local/include -I/usr/include -I../../src/linux -I../../src -I../../src/probes/unix -I../../src/probes/linux -I../../src/probes/independent -I../../src/unix -DPACKAGE_RPM -DPACKAGE_DPKG  -c -o ../../src/probes/linux/RPMInfoProbe.o ../../src/probes/linux/RPMInfoProbe.cpp
    ../../src/probes/linux/RPMInfoProbe.cpp: In member function bool RPMInfoProbe::readHeaderString(Header, int_32, std::string*):
    ../../src/probes/linux/RPMInfoProbe.cpp:359:23: error: headerGetEntry was not declared in this scope
    ../../src/probes/linux/RPMInfoProbe.cpp: In member function int_32 RPMInfoProbe::readHeaderInt32(Header, int_32):
    ../../src/probes/linux/RPMInfoProbe.cpp:381:20: error: headerGetEntry was not declared in this scope
    ../../src/probes/linux/RPMInfoProbe.cpp: In member function void RPMInfoProbe::ChildGetSigKeyId(int, int, std::string):
    ../../src/probes/linux/RPMInfoProbe.cpp:424:15: warning: deprecated conversion from string constant to char* [-Wwrite-strings]
    ../../src/probes/linux/RPMInfoProbe.cpp:425:15: warning: deprecated conversion from string constant to char* [-Wwrite-strings]
    ../../src/probes/linux/RPMInfoProbe.cpp:426:15: warning: deprecated conversion from string constant to char* [-Wwrite-strings]
    ../../src/probes/linux/RPMInfoProbe.cpp:465:65: error: invalid conversion from const char** to ARGV_const_t {aka char* const*} [-fpermissive]
    /usr/include/rpm/rpmcli.h:235:5: error:   initializing argument 3 of ‘int rpmcliQuery(rpmts, QVA_t, ARGV_const_t)’ [-fpermissive]
    make: *** [../../src/probes/linux/RPMInfoProbe.o] Error 1
    

    Even after commenting out PACKAGE_RPM, there are further errors

    ../../src/linux/ProbeFactory.o: In function `ProbeFactory::GetProbe(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
    ProbeFactory.cpp:(.text+0x330): undefined reference to `RPMInfoProbe::Instance()'
    ProbeFactory.cpp:(.text+0x352): undefined reference to `RPMVerifyProbe::Instance()'
    ProbeFactory.cpp:(.text+0x374): undefined reference to `RPMVerifyFileProbe::Instance()'
    ProbeFactory.cpp:(.text+0x396): undefined reference to `RPMVerifyPackageProbe::Instance()'
    collect2: ld returned 1 exit status
    

    Just for completeness the files in 5.10.1.1

    ../../src/CountFunction.cpp
    ../../src/AbsFileFinder.cpp
    ../../src/UniqueFunction.cpp

    are missing #include <memory> and they throw compilation errors.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks