Trying to build BR-CAD. Cmake out of memory?

So I was trying to build BRL-CAD with osc build command.

The spec file is in the branch here:
https://build.opensuse.org/package/show/home:andythe_great:branches:home:brlcad/BRL-CAD

Some digging on “ReserveShadowMemoryRange failed while trying to map” and “Perhaps you’re using ulimit -v” suggest that is could be a memory limit which building of BRL-CAD exceeds.

Is that really a problem? How do I raise limit?
My computer still have plenty of memory when building it.
Maybe building BRL-CAD might not be a best choice.

CMake Error at misc/CMake/BRLCAD_Util.cmake:90 (_message):
   53s]   Could not run hostname reporting utility: ==1629==ERROR: AddressSanitizer
   53s]   failed to allocate 0xdfff0001000 (15392894357504) bytes at address
   53s]   2008fff7000 (errno: 12)
   53s] 
   53s]   ==1629==ReserveShadowMemoryRange failed while trying to map 0xdfff0001000
   53s]   bytes.  Perhaps you're using ulimit -v
   53s] 
   53s]   Child aborted
   53s] Call Stack (most recent call first):
   53s]   CMakeLists.txt:3035 (message)
   53s] 
   53s] 
   53s] -- Configuring incomplete, errors occurred!
   53s] See also "/home/abuild/rpmbuild/BUILD/trunk-7.30.0.74914/build/CMakeFiles/CMakeOutput.log".
   53s] See also "/home/abuild/rpmbuild/BUILD/trunk-7.30.0.74914/build/CMakeFiles/CMakeError.log".
   53s] error: Bad exit status from /var/tmp/rpm-tmp.itTTya (%build)
   53s] 
   53s] 
   53s] RPM build errors:
   53s]     Bad exit status from /var/tmp/rpm-tmp.itTTya (%build)
   53s] 
   53s] linux-edcv failed "build brlcad.spec" at Sun Feb 16 16:23:16 UTC 2020.



Hi
A _constraints file;
https://openbuildservice.org/help/manuals/obs-reference-guide/cha.obs.build_job_constraints.html

For example;
https://build.opensuse.org/package/view_file/home:malcolmlewis:TESTING/tizonia/_constraints?expand=1

Thanks for the tip, but it seems the memory constraints might not be the case.
C++ is hard

Hi
When it builds locally, how much ram is it using?

Hello,

Before building my pc idle at 2.2 Gb (because Firefox and stuff) then when building it stayed at a constant of 2.2 GB with a small increase to 2.3 GB. I have 8 GB RAM in total.
I there an option to get more info out of this error?

Hi
Likely the %cmake macro adding some options that make it fail (a bug perhaps…), just use cmake instead… one thing I suggest before building it just add an exit in the spec so you can go and look at what has been selected for building;


osc lbl | less

  218s] ------------ BRL-CAD Release 7.30.5, Build 20200217 - Release Build ------------
  218s] 
  218s]         Prefix: /opt/brlcad
  218s]       Binaries: /opt/brlcad/bin
  218s]      Libraries: /opt/brlcad/lib
  218s]   Manual pages: /opt/brlcad/share/man
  218s] Data resources: /opt/brlcad/share
  218s]  
  218s] CC       = /usr/bin/cc
  218s] CXX      = /usr/bin/c++
  218s] CFLAGS   = -std=c11 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -pipe
  218s]            -fno-strict-aliasing -fno-common -fexceptions -m64 -g -ggdb3 -O3
  218s]            -fipa-pta -fstrength-reduce -fexpensive-optimizations
  218s]            -finline-functions -flto -fno-omit-frame-pointer -pedantic
  218s]            -pedantic-errors -Wall -Wextra -Wundef -Wfloat-equal -Wshadow
  218s]            -Wbad-function-cast -Wc++-compat -Winline -Wno-long-long
  218s]            -Wno-variadic-macros -Werror
  218s] CXXFLAGS = -std=c++11 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 -pipe
  218s]            -fno-strict-aliasing -fno-common -fexceptions -ftemplate-depth-128
  218s]            -m64 -g -ggdb3 -O3 -fipa-pta -fstrength-reduce
  218s]            -fexpensive-optimizations -finline-functions -flto
  218s]            -fno-omit-frame-pointer -pedantic -Wall -Wextra -Wundef
  218s]            -Wfloat-equal -Wshadow -Wno-inline -Wno-long-long
  218s]            -Wno-variadic-macros -Werror
  218s] LDFLAGS  = -m64 -g -ggdb3
  218s]  
  218s]  
  218s] Compile Tcl ........................: ON
  218s] Compile Tk .........................: OFF
  218s] Compile Itcl/Itk ...................: ON (Itcl only)
  218s] Compile Iwidgets ...................: OFF
  218s] Compile Tkhtml .....................: OFF
  218s] Compile tkpng ......................: OFF
  218s] Compile Tktable ....................: OFF
  218s] Compile libpng .....................: ON
  218s] Compile libregex ...................: ON
  218s] Compile zlib .......................: ON
  218s] Compile termlib ....................: ON
  218s] Compile Utah Raster Toolkit ........: ON
  218s] Compile openNURBS ..................: ON
  218s] Compile STEPcode....................: ON
  218s]  
  218s] OpenGL support (optional) ..........: OFF
  218s] X11 support (optional) .............: OFF
  218s] Qt support (optional) ..............: OFF
  218s] Run-time debuggability (optional) ..: ON
  218s]  
  218s] Build 32/64-bit release ............: 64BIT (Auto)
  218s] Build optimized release ............: ON
  218s] Build static libraries .............: ON
  218s] Build dynamic libraries ............: ON
  218s] Install example geometry models ....: ON
  218s] Generate extra docs ................: ON (html/man)
  218s]  
  218s] Elapsed configuration time: 1 minute 17 seconds 

Try;


%prep
%autosetup

%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
mkdir -p build
cd build
cmake -DBRLCAD_BUNDLED_LIBS=ON \
       -DBRLCAD_BUNDLED_LIBS=Bundled \
       -DBRLCAD_ENABLE_OPENGL=ON \
       -DBRLCAD_FLAGS_OPTIMIZATION=ON \
       -DCMAKE_INSTALL_PREFIX=/opt/brlcad \
       -DCMAKE_BUILD_TYPE="Release" \
       ..
make %{?_smp_mflags}

%install
%cmake_install
%fdupes -s %{buildroot}

%files
%doc AUTHORS BUGS ChangeLog CHANGES HACKING NEWS README TODO
%license COPYING
/opt/brlcad

Thanks, it kinda build now.
The only problem left is to put certain file to a devel package. It won’t let me build if there is over 1000 of them.

E: devel-file-in-non-devel-package (Badness: 50)
E: lto-no-text-in-archive (Badness: 10000) What does this mean?

The problem is there is over 10000 of these files is there a way to automate this?

I believe I have to do something like this.


Name:           brlcad
Version:        7.30.0.74914
Release:        0
Summary:        BRL-CAD Open Source Solid Modeling
License:        LGPL, BSD
Group:          Productivity/Graphics/CAD
URL:            https://brlcad.org
Source:         trunk-%{version}.tar.xz
BuildRequires:  bison
BuildRequires:  gcc-c++
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  flex
BuildRequires:  make
BuildRequires:  sed
Requires:       %{name}-libs0 = %{version}-%{release}

%description
BRL-CAD is a powerful cross-platform open source solid modeling system
that includes interactive geometry editing, high-performance
ray-tracing for rendering and geometric analysis, image and
signal-processing tools, a system performance analysis benchmark
suite, libraries for robust geometric representation, with more than
25 years of active development.


%package  devel
Summary:        Development files of %{name}
Group:          Development/Libraries/C and C++

%description devel
This package contains libraries and header files for developing
applications that use BRL-CAD.

%prep
%autosetup -n trunk-%{version}

%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
mkdir -p build
cd build
cmake -DBRLCAD_BUNDLED_LIBS=ON \
       -DBRLCAD_BUNDLED_LIBS=Bundled \
       -DBRLCAD_ENABLE_OPENGL=ON \
       -DBRLCAD_FLAGS_OPTIMIZATION=ON \
       -DCMAKE_INSTALL_PREFIX=/opt/brlcad \
       -DCMAKE_BUILD_TYPE="Release" \
       ..
make %{?_smp_mflags}

%install
%cmake_install
%fdupes -s %{buildroot}

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files devel
/opt/brlcad/include/brlcad/*.h
/opt/brlcad/include/brlcad/analyze/*.h
/opt/brlcad/include/brlcad/bg/*.h
/opt/brlcad/include/brlcad/bn/*.h
/opt/brlcad/include/brlcad/brep/*.h
/opt/brlcad/include/brlcad/bu/*.h
/opt/brlcad/include/brlcad/dm/*.h
/opt/etc/etc/etc...

%files
%doc AUTHORS BUGS ChangeLog CHANGES HACKING NEWS README TODO
%license COPYING
/opt/brlcad



But this seems wrong somehow. To include every combination of devel package directory is weird.

Also, why did you use %{?_smp_mflags}
Because spec-cleaner suggest me to use %make_build

And what does /opt/brlcad at the very end do?

Thanks.

maybe something like this?


%{_includedir}/*.h
%{_includedir}/*/*.h
%{_includedir}/*/*/*.h
%{_includedir}/*/*/*/*.h
%{_libdir}/*.h

Hmmm, no that doesn’t work

Hi
Give me a few, been working today :wink:

Hi,
Take your time.

The service is down right now. Server returned an error: HTTP Error 503: Service Unavailable

Any way this is my latest spec


#
# spec file for package brlcad
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2004-2012 United States Government as represented by
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           brlcad
Version:        7.30.0.74914
Release:        0
Summary:        BRL-CAD Open Source Solid Modeling
License:        LGPL, BSD
Group:          Productivity/Graphics/CAD
URL:            https://brlcad.org
Source:         trunk-%{version}.tar.xz
BuildRequires:  bison
BuildRequires:  gcc-c++
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  flex
BuildRequires:  make
BuildRequires:  sed

%define brl_prefix /opt/brlcad

%description
BRL-CAD is a powerful cross-platform open source solid modeling system
that includes interactive geometry editing, high-performance
ray-tracing for rendering and geometric analysis, image and
signal-processing tools, a system performance analysis benchmark
suite, libraries for robust geometric representation, with more than
25 years of active development.


%package  devel
Summary:        Development files of %{name}
Group:          Development/Libraries/C and C++

%description devel
This package contains libraries and header files for developing
applications that use BRL-CAD.

%prep
%autosetup -n trunk-%{version}

%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
mkdir -p build
cd build
cmake -DBRLCAD_BUNDLED_LIBS=ON \
       -DBRLCAD_BUNDLED_LIBS=Bundled \
       -DBRLCAD_ENABLE_OPENGL=ON \
       -DBRLCAD_FLAGS_OPTIMIZATION=ON \
       -DCMAKE_INSTALL_PREFIX=/opt/brlcad \
       -DCMAKE_BUILD_TYPE="Release" \
       ..
make %{?_smp_mflags}

%install
%cmake_install
%fdupes -s %{buildroot}

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files devel
/opt/brlcad/lib/*.a
/opt/brlcad/lib/*.so
/opt/brlcad/include/*

%files
%doc AUTHORS BUGS ChangeLog CHANGES HACKING NEWS README TODO
%license COPYING
/opt/brlcad

%changelog


I could not test it because service down at the moment.

Hi
Use a local build… osc build -o :wink: Think I have it all building now and clean up the warnings…

I can not clean the devel-file-in-non-devel-package and E: lto-no-text-in-archive error even if I add

%files devel
%{brlcad_prefix}/lib/*.a
%{brlcad_prefix}/lib/*.so
%{brlcad_prefix}/include/*

Here is my latest spec file.

#
# spec file for package brlcad
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2004-2012 United States Government as represented by
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


Name:           brlcad
Version:        7.30.0.74914
Release:        0
Summary:        BRL-CAD Open Source Solid Modeling
License:        BSD-3-Clause and GPL-2.1-or-later
Group:          Productivity/Graphics/CAD
URL:            https://brlcad.org
Source:         trunk-%{version}.tar.xz
BuildRequires:  bison
BuildRequires:  gcc-c++
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  flex
BuildRequires:  make
BuildRequires:  sed

%define brlcad_prefix /opt/brlcad

%description
BRL-CAD is a powerful cross-platform open source solid modeling system
that includes interactive geometry editing, high-performance
ray-tracing for rendering and geometric analysis, image and
signal-processing tools, a system performance analysis benchmark
suite, libraries for robust geometric representation, with more than
25 years of active development.


%package  devel
Summary:        Development files of %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}-%{release}

%description devel
This package contains libraries and header files for developing
applications that use BRL-CAD.

%prep
%autosetup -n trunk-%{version}

%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
mkdir -p build
cd build
cmake -DBRLCAD_BUNDLED_LIBS=ON \
       -DBRLCAD_BUNDLED_LIBS=Bundled \
       -DBRLCAD_ENABLE_OPENGL=ON \
       -DBRLCAD_FLAGS_OPTIMIZATION=ON \
       -DCMAKE_INSTALL_PREFIX=/opt/brlcad \
       -DCMAKE_BUILD_TYPE="Release" \
       ..
make %{?_smp_mflags}

%install
%cmake_install
%fdupes -s %{buildroot}

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files devel
%{brlcad_prefix}/lib/*.a
%{brlcad_prefix}/lib/*.so
%{brlcad_prefix}/include/*

%files
%doc AUTHORS BUGS ChangeLog CHANGES HACKING NEWS README TODO
%license doc/legal/bdl.txt doc/legal/bsd.txt doc/legal/lgpl.txt COPYING 
/opt/brlcad

%changelog

Hi
The files I used for a successful build (with warnings) along with a rpmlintrc file to set badness to zero (Ref: https://en.opensuse.org/openSUSE:Packaging_checks)

https://build.opensuse.org/package/show/home:malcolmlewis:TESTING/pkg_1

There are issues with the code since it does fail if adding openSUSE build flags (%{optflags}) so issues are masked and need to be fixed, likewise for the rpmlintrc file with the static libs, if they are not needed, then would look and see if can be disabled.

It’s also set to not publish, just build for Tumbleweed, which it did… looks like OBS is rebuilding (unresolvable) but there are built rpms :wink:
https://build.opensuse.org/package/binaries/home:malcolmlewis:TESTING/pkg_1/openSUSE_Tumbleweed

Thanks so much it build now.
How many human sacrifice to learn this?

What does lto-no-text-in-archive means anyway? Is it ok to set it to zero? Googled yield no conclusive result.

This archive does not contain a non-empty .text section.  The archive was not created with -ffat-lto-objects option.

But spec file does have -ffat-lto-objects flag on it isn’t it?

Hi
The code needs patching AFAIK to meet this new requirement, probably worth an upstream bug report… I set the badness to 0 to let it pass rpmlint…

About the _service file.

Why does localonly mode failed when <param name=“filename”>brlcad</param> is added? If I remove the filename parameter, it will not fail.

<services>
  <service mode="localonly" name="obs_scm">
    <param name="url">svn://svn.code.sf.net/p/brlcad/code/brlcad/trunk</param>
    <param name="scm">svn</param>
    <param name="revision">74927</param>
    <param name="filename">brlcad</param>
    <param name="versionprefix">7.30.5</param>
  </service>
  <service mode="localonly" name="tar" />
  <service mode="localonly" name="recompress">
    <param name="file">*.tar</param>
    <param name="compression">xz</param>
  </service>
  <service mode="localonly" name="set_version" />
</services>

Hi
Never use localonly, enable or disabled, then to build locally just use the osc command (osc build).

The download archive will only be left with .obscpio is not ideal for submitting package to factory isn’t it? From what I understand, I have to rename the file manually? Would that be acceptable?

Hi
No that is the preferred archive method these days, all my recent submissions are of this type…