Skip to content

BUILD_ALWAYS causes install twice, to 2 dirs #625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
DarthGandalf opened this issue Mar 26, 2025 · 27 comments
Open

BUILD_ALWAYS causes install twice, to 2 dirs #625

DarthGandalf opened this issue Mar 26, 2025 · 27 comments

Comments

@DarthGandalf
Copy link

Describe the bug
I'm maintainer of Bear in Gentoo, and tried to package version 3.1.6, but some files are now installed twice:

drwxr-xr-x    - somebody somebody 26 мар 10:12 bear-3.1.6/image
drwxr-xr-x    - somebody somebody 26 мар 10:12 ├── mnt
drwxr-xr-x    - somebody somebody 26 мар 10:12 │  └── portagetmp
drwxr-xr-x    - somebody somebody 26 мар 10:12 │     └── portage
drwxr-xr-x    - somebody somebody 26 мар 10:12 │        └── dev-util
drwxr-xr-x    - somebody somebody 26 мар 10:12 │           └── bear-3.1.6
drwxr-xr-x    - somebody somebody 26 мар 10:12 │              └── work
drwxr-xr-x    - somebody somebody 26 мар 10:12 │                 └── Bear-3.1.6_build
drwxr-xr-x    - somebody somebody 26 мар 10:12 │                    └── stage
drwxr-xr-x    - somebody somebody 26 мар 10:12 │                       ├── bin
.rwxr-xr-x 1,1M somebody somebody 26 мар 10:12 │                       │  └── bear
drwxr-xr-x    - somebody somebody 26 мар 10:12 │                       ├── lib64
drwxr-xr-x    - somebody somebody 26 мар 10:12 │                       │  └── bear
.rwxr-xr-x  31k somebody somebody 26 мар 10:12 │                       │     ├── libexec.so
.rwxr-xr-x 378k somebody somebody 26 мар 10:12 │                       │     └── wrapper
drwxr-xr-x    - somebody somebody 26 мар 10:12 │                       └── share
drwxr-xr-x    - somebody somebody 26 мар 10:12 │                          └── man
drwxr-xr-x    - somebody somebody 26 мар 10:12 │                             └── man1
.rw-r--r-- 6,0k somebody somebody 23 мар 08:22 │                                ├── bear-citnames.1
.rw-r--r-- 3,4k somebody somebody 23 мар 08:22 │                                ├── bear-intercept.1
.rw-r--r-- 4,0k somebody somebody 23 мар 08:22 │                                └── bear.1
drwxr-xr-x    - somebody somebody 26 мар 10:12 └── usr
drwxr-xr-x    - somebody somebody 26 мар 10:12    ├── bin
.rwxr-xr-x 1,1M somebody somebody 26 мар 10:12    │  └── bear
drwxr-xr-x    - somebody somebody 26 мар 10:12    ├── lib
drwxr-xr-x    - somebody somebody 26 мар 10:12    │  └── debug
drwxr-xr-x    - somebody somebody 26 мар 10:12    │     ├── mnt
drwxr-xr-x    - somebody somebody 26 мар 10:12    │     │  └── portagetmp
drwxr-xr-x    - somebody somebody 26 мар 10:12    │     │     └── portage
drwxr-xr-x    - somebody somebody 26 мар 10:12    │     │        └── dev-util
drwxr-xr-x    - somebody somebody 26 мар 10:12    │     │           └── bear-3.1.6
drwxr-xr-x    - somebody somebody 26 мар 10:12    │     │              └── work
drwxr-xr-x    - somebody somebody 26 мар 10:12    │     │                 └── Bear-3.1.6_build
drwxr-xr-x    - somebody somebody 26 мар 10:12    │     │                    └── stage
drwxr-xr-x    - somebody somebody 26 мар 10:12    │     │                       ├── bin
.rw-r--r--  37M somebody somebody 26 мар 10:12    │     │                       │  └── bear.debug
drwxr-xr-x    - somebody somebody 26 мар 10:12    │     │                       └── lib64
drwxr-xr-x    - somebody somebody 26 мар 10:12    │     │                          └── bear
.rw-r--r-- 458k somebody somebody 26 мар 10:12    │     │                             ├── libexec.so.debug
.rw-r--r--  13M somebody somebody 26 мар 10:12    │     │                             └── wrapper.debug
drwxr-xr-x    - somebody somebody 26 мар 10:12    │     └── usr
drwxr-xr-x    - somebody somebody 26 мар 10:12    │        ├── bin
.rw-r--r--  37M somebody somebody 26 мар 10:12    │        │  └── bear.debug
drwxr-xr-x    - somebody somebody 26 мар 10:12    │        └── lib64
drwxr-xr-x    - somebody somebody 26 мар 10:12    │           └── bear
.rw-r--r-- 458k somebody somebody 26 мар 10:12    │              ├── libexec.so.debug
.rw-r--r--  13M somebody somebody 26 мар 10:12    │              └── wrapper.debug
drwxr-xr-x    - somebody somebody 26 мар 10:12    ├── lib64
drwxr-xr-x    - somebody somebody 26 мар 10:12    │  └── bear
.rwxr-xr-x  31k somebody somebody 26 мар 10:12    │     ├── libexec.so
.rwxr-xr-x 378k somebody somebody 26 мар 10:12    │     ├── wrapper
drwxr-xr-x    - somebody somebody 26 мар 10:12    │     └── wrapper.d
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── ar -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── as -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── bison -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── c++ -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── cc -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── clang -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── clang++ -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── cpp -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── ctangle -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── cweave -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── f77 -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── flang -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── flang-new -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── flex -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── ftnfe -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── g++ -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── gcc -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── gfortran -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── ifort -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── ifx -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── ld -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── lex -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── lint -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── m2c -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── makeinfo -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── nm -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── objcopy -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── objdump -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── pc -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── ranlib -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── readelf -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── strip -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── tangle -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── tex -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── tex2dvi -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        ├── weave -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 10:12    │        └── yacc -> ../wrapper
drwxr-xr-x    - somebody somebody 26 мар 10:12    └── share
drwxr-xr-x    - somebody somebody 26 мар 10:12       ├── doc
drwxr-xr-x    - somebody somebody 26 мар 10:12       │  └── bear-3.1.6
.rw-r--r-- 2,1k somebody somebody 23 мар 08:22       │     ├── CODE_OF_CONDUCT.md.bz2
.rw-r--r--  722 somebody somebody 23 мар 08:22       │     ├── CONTRIBUTING.md.bz2
.rw-r--r--  11k somebody somebody 23 мар 08:22       │     ├── COPYING.bz2
.rw-r--r-- 2,0k somebody somebody 23 мар 08:22       │     ├── INSTALL.md.bz2
.rw-r--r-- 1,5k somebody somebody 26 мар 10:12       │     └── README.md.bz2
drwxr-xr-x    - somebody somebody 26 мар 10:12       └── man
drwxr-xr-x    - somebody somebody 26 мар 10:12          └── man1
.rw-r--r-- 2,4k somebody somebody 23 мар 08:22             ├── bear-citnames.1.bz2
.rw-r--r-- 1,6k somebody somebody 23 мар 08:22             ├── bear-intercept.1.bz2
.rw-r--r-- 1,8k somebody somebody 23 мар 08:22             └── bear.1.bz2

Note the mnt/ subdirectory

As it was added in #607 CCing @inaki-amatria

To Reproduce
Steps to reproduce the behavior:
Just try to build?

Expected behavior
install shouldn't install an extra copy of files

Environment:

Additional context

  • Can you give us a reference to the project that you are running against this tool? [e.g. No if it's a close source project, but in case of an open source project a link to the sources could be nice.]
  • What build tools this project is using? [e.g. GNU make wtih configure script]
  • What architecture you are trying to compile for? [e.g. cross compiling]
  • Could you attach build logs? If you can re-run the command which failed (e.g. bear -- make) with extra verbose log switches (e.g. bear --verbose -- make) and send the output of it, that would help a lot.

Attaching both versions for easy comparison

3.1.5-build.log
3.1.6-build.log

Before you send...

  • Have you read the README.md file or man bear?
  • Have you looked what other open issues Bear has?
  • Are you sure that the build works without Bear?
@rizsotto
Copy link
Owner

Hey @DarthGandalf , thanks for testing it... I agree that change needs to be reverted. Raised a PR for that: #626

@inaki-amatria
Copy link
Contributor

Hi @rizsotto @DarthGandalf !

I don't think the change needs to be reverted, nor do I believe bear is being installed twice.

In my opinion, the issue lies in how CMake and Portage interact in this specific case. The project installs as expected, but an additional unstripped directory labeled "debug" appears. It seems that either Portage or the CMake cache used in Gentoo/Portage is causing CMake to install a debug version of the subproject alongside the main project.

I can't reproduce this issue with my CMake setup, which leads me to believe it may be related to unseen files in this bug report, such as the toolchain file or the CMake cache used with Portage.

@DarthGandalf
Copy link
Author

"debug" is not the problem, it's there because I'm using FEATURES=splitdebug

mnt/ is still present if I disable this feature:

drwxr-xr-x    - somebody somebody 26 мар 12:37 bear-3.1.6/image
drwxr-xr-x    - somebody somebody 26 мар 12:37 ├── mnt
drwxr-xr-x    - somebody somebody 26 мар 12:37 │  └── portagetmp
drwxr-xr-x    - somebody somebody 26 мар 12:37 │     └── portage
drwxr-xr-x    - somebody somebody 26 мар 12:37 │        └── dev-util
drwxr-xr-x    - somebody somebody 26 мар 12:37 │           └── bear-3.1.6
drwxr-xr-x    - somebody somebody 26 мар 12:37 │              └── work
drwxr-xr-x    - somebody somebody 26 мар 12:37 │                 └── Bear-3.1.6_build
drwxr-xr-x    - somebody somebody 26 мар 12:37 │                    └── stage
drwxr-xr-x    - somebody somebody 26 мар 12:37 │                       ├── bin
.rwxr-xr-x 1,1M somebody somebody 26 мар 12:37 │                       │  └── bear
drwxr-xr-x    - somebody somebody 26 мар 12:37 │                       ├── lib64
drwxr-xr-x    - somebody somebody 26 мар 12:37 │                       │  └── bear
.rwxr-xr-x  31k somebody somebody 26 мар 12:37 │                       │     ├── libexec.so
.rwxr-xr-x 378k somebody somebody 26 мар 12:37 │                       │     └── wrapper
drwxr-xr-x    - somebody somebody 26 мар 12:37 │                       └── share
drwxr-xr-x    - somebody somebody 26 мар 12:37 │                          └── man
drwxr-xr-x    - somebody somebody 26 мар 12:37 │                             └── man1
.rw-r--r-- 6,0k somebody somebody 23 мар 08:22 │                                ├── bear-citnames.1
.rw-r--r-- 3,4k somebody somebody 23 мар 08:22 │                                ├── bear-intercept.1
.rw-r--r-- 4,0k somebody somebody 23 мар 08:22 │                                └── bear.1
drwxr-xr-x    - somebody somebody 26 мар 12:37 └── usr
drwxr-xr-x    - somebody somebody 26 мар 12:37    ├── bin
.rwxr-xr-x 1,1M somebody somebody 26 мар 12:37    │  └── bear
drwxr-xr-x    - somebody somebody 26 мар 12:37    ├── lib64
drwxr-xr-x    - somebody somebody 26 мар 12:37    │  └── bear
.rwxr-xr-x  31k somebody somebody 26 мар 12:37    │     ├── libexec.so
.rwxr-xr-x 378k somebody somebody 26 мар 12:37    │     ├── wrapper
drwxr-xr-x    - somebody somebody 26 мар 12:37    │     └── wrapper.d
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── ar -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── as -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── bison -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── c++ -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── cc -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── clang -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── clang++ -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── cpp -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── ctangle -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── cweave -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── f77 -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── flang -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── flang-new -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── flex -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── ftnfe -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── g++ -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── gcc -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── gfortran -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── ifort -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── ifx -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── ld -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── lex -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── lint -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── m2c -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── makeinfo -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── nm -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── objcopy -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── objdump -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── pc -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── ranlib -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── readelf -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── strip -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── tangle -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── tex -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── tex2dvi -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── weave -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        └── yacc -> ../wrapper
drwxr-xr-x    - somebody somebody 26 мар 12:37    └── share
drwxr-xr-x    - somebody somebody 26 мар 12:37       ├── doc
drwxr-xr-x    - somebody somebody 26 мар 12:37       │  └── bear-3.1.6
.rw-r--r-- 2,1k somebody somebody 23 мар 08:22       │     ├── CODE_OF_CONDUCT.md.bz2
.rw-r--r--  722 somebody somebody 23 мар 08:22       │     ├── CONTRIBUTING.md.bz2
.rw-r--r--  11k somebody somebody 23 мар 08:22       │     ├── COPYING.bz2
.rw-r--r-- 2,0k somebody somebody 23 мар 08:22       │     ├── INSTALL.md.bz2
.rw-r--r-- 1,5k somebody somebody 26 мар 12:37       │     └── README.md.bz2
drwxr-xr-x    - somebody somebody 26 мар 12:37       └── man
drwxr-xr-x    - somebody somebody 26 мар 12:37          └── man1
.rw-r--r-- 2,4k somebody somebody 23 мар 08:22             ├── bear-citnames.1.bz2
.rw-r--r-- 1,6k somebody somebody 23 мар 08:22             ├── bear-intercept.1.bz2
.rw-r--r-- 1,8k somebody somebody 23 мар 08:22             └── bear.1.bz2

@rizsotto
Copy link
Owner

Can this be different CMake versions?

@DarthGandalf
Copy link
Author

cmake 3.31.5 here

@inaki-amatria
Copy link
Contributor

inaki-amatria commented Mar 26, 2025

"debug" is not the problem, it's there because I'm using FEATURES=splitdebug

mnt/ is still present if I disable this feature:

drwxr-xr-x    - somebody somebody 26 мар 12:37 bear-3.1.6/image
drwxr-xr-x    - somebody somebody 26 мар 12:37 ├── mnt
drwxr-xr-x    - somebody somebody 26 мар 12:37 │  └── portagetmp
drwxr-xr-x    - somebody somebody 26 мар 12:37 │     └── portage
drwxr-xr-x    - somebody somebody 26 мар 12:37 │        └── dev-util
drwxr-xr-x    - somebody somebody 26 мар 12:37 │           └── bear-3.1.6
drwxr-xr-x    - somebody somebody 26 мар 12:37 │              └── work
drwxr-xr-x    - somebody somebody 26 мар 12:37 │                 └── Bear-3.1.6_build
drwxr-xr-x    - somebody somebody 26 мар 12:37 │                    └── stage
drwxr-xr-x    - somebody somebody 26 мар 12:37 │                       ├── bin
.rwxr-xr-x 1,1M somebody somebody 26 мар 12:37 │                       │  └── bear
drwxr-xr-x    - somebody somebody 26 мар 12:37 │                       ├── lib64
drwxr-xr-x    - somebody somebody 26 мар 12:37 │                       │  └── bear
.rwxr-xr-x  31k somebody somebody 26 мар 12:37 │                       │     ├── libexec.so
.rwxr-xr-x 378k somebody somebody 26 мар 12:37 │                       │     └── wrapper
drwxr-xr-x    - somebody somebody 26 мар 12:37 │                       └── share
drwxr-xr-x    - somebody somebody 26 мар 12:37 │                          └── man
drwxr-xr-x    - somebody somebody 26 мар 12:37 │                             └── man1
.rw-r--r-- 6,0k somebody somebody 23 мар 08:22 │                                ├── bear-citnames.1
.rw-r--r-- 3,4k somebody somebody 23 мар 08:22 │                                ├── bear-intercept.1
.rw-r--r-- 4,0k somebody somebody 23 мар 08:22 │                                └── bear.1
drwxr-xr-x    - somebody somebody 26 мар 12:37 └── usr
drwxr-xr-x    - somebody somebody 26 мар 12:37    ├── bin
.rwxr-xr-x 1,1M somebody somebody 26 мар 12:37    │  └── bear
drwxr-xr-x    - somebody somebody 26 мар 12:37    ├── lib64
drwxr-xr-x    - somebody somebody 26 мар 12:37    │  └── bear
.rwxr-xr-x  31k somebody somebody 26 мар 12:37    │     ├── libexec.so
.rwxr-xr-x 378k somebody somebody 26 мар 12:37    │     ├── wrapper
drwxr-xr-x    - somebody somebody 26 мар 12:37    │     └── wrapper.d
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── ar -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── as -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── bison -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── c++ -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── cc -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── clang -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── clang++ -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── cpp -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── ctangle -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── cweave -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── f77 -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── flang -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── flang-new -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── flex -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── ftnfe -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── g++ -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── gcc -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── gfortran -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── ifort -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── ifx -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── ld -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── lex -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── lint -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── m2c -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── makeinfo -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── nm -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── objcopy -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── objdump -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── pc -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── ranlib -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── readelf -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── strip -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── tangle -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── tex -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── tex2dvi -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        ├── weave -> ../wrapper
lrwxrwxrwx    - somebody somebody 26 мар 12:37    │        └── yacc -> ../wrapper
drwxr-xr-x    - somebody somebody 26 мар 12:37    └── share
drwxr-xr-x    - somebody somebody 26 мар 12:37       ├── doc
drwxr-xr-x    - somebody somebody 26 мар 12:37       │  └── bear-3.1.6
.rw-r--r-- 2,1k somebody somebody 23 мар 08:22       │     ├── CODE_OF_CONDUCT.md.bz2
.rw-r--r--  722 somebody somebody 23 мар 08:22       │     ├── CONTRIBUTING.md.bz2
.rw-r--r--  11k somebody somebody 23 мар 08:22       │     ├── COPYING.bz2
.rw-r--r-- 2,0k somebody somebody 23 мар 08:22       │     ├── INSTALL.md.bz2
.rw-r--r-- 1,5k somebody somebody 26 мар 12:37       │     └── README.md.bz2
drwxr-xr-x    - somebody somebody 26 мар 12:37       └── man
drwxr-xr-x    - somebody somebody 26 мар 12:37          └── man1
.rw-r--r-- 2,4k somebody somebody 23 мар 08:22             ├── bear-citnames.1.bz2
.rw-r--r-- 1,6k somebody somebody 23 мар 08:22             ├── bear-intercept.1.bz2
.rw-r--r-- 1,8k somebody somebody 23 мар 08:22             └── bear.1.bz2

I am sorry, but I don't see repeated files here! I see CMake installed the correct files under /usr and I see Portage didn't delete the temporary directory portagetmp. Please, correct me if I am wrong, I know absolutely nothing about Portage! I apologize in advance.

By the way, I am using CMake 3.31.6.

@DarthGandalf
Copy link
Author

I am sorry, but I don't see repeated, installed files here

no worries

I see CMake installed the correct files under /usr and I see Portage didn't delete the temporary directory portagetmp

This whole subtree I'm showing is under /mnt/portagetmp/portage/dev-util/bear-3.1.6 - the "image" subdir of it is what would be installed to / later.

The point is, "make install" (or "ninja install"?) now copies the staged copy of ExternalProject to DESTDIR, while it didn't do that before addition of BUILD_ALWAYS. I don't know why it does that.

@DarthGandalf
Copy link
Author

you can see in the log attached how this ExternalProject is installed:

ninja -v -j20 -l20 install
[1/4] cd /mnt/portagetmp/portage/dev-util/bear-3.1.6/work/Bear-3.1.6_build/subprojects/Build/BearSource && /usr/bin/cmake --build .
ninja: no work to do.
[2/4] cd /mnt/portagetmp/portage/dev-util/bear-3.1.6/work/Bear-3.1.6_build/subprojects/Build/BearSource && /usr/bin/cmake --build . --target install
[0/1] Install the project...
-- Install configuration: "RelWithDebInfo"
-- Installing: /mnt/portagetmp/portage/dev-util/bear-3.1.6/image/mnt/portagetmp/portage/dev-util/bear-3.1.6/work/Bear-3.1.6_build/stage/share/man/man1/bear-intercept.1
-- Installing: /mnt/portagetmp/portage/dev-util/bear-3.1.6/image/mnt/portagetmp/portage/dev-util/bear-3.1.6/work/Bear-3.1.6_build/stage/lib64/bear/wrapper
-- Installing: /mnt/portagetmp/portage/dev-util/bear-3.1.6/image/mnt/portagetmp/portage/dev-util/bear-3.1.6/work/Bear-3.1.6_build/stage/lib64/bear/wrapper.d
-- Installing: /mnt/portagetmp/portage/dev-util/bear-3.1.6/image/mnt/portagetmp/portage/dev-util/bear-3.1.6/work/Bear-3.1.6_build/stage/lib64/bear/libexec.so
...

@inaki-amatria
Copy link
Contributor

What is the value of PORTAGE_TMPDIR when you invoke Portage? Have you tried removing BUILD_ALWAYS and running Portage on Bear 3.1.6? If the issue lies on BUILD_ALWAYS, I agree with disabling it through a command line option. I don't agree with removing the option completely because it has been pretty useful on our side, as it ensures we don't build a version of Bear that is outdated!

@DarthGandalf
Copy link
Author

PORTAGE_TMPDIR is /mnt/portagetmp for me, that's why it builds everything under that dir. It shouldn't copy that path under the image/ subdir though.

Yes, it works when I remove BUILD_ALWAYS, see https://github.com/gentoo/gentoo/pull/41304/files#diff-b3fcdcbbd9014dbf08a087cb1f6bf2e86a9c9bc3832d2038242962571c59adb4

@DarthGandalf
Copy link
Author

@rizsotto what was the reason to use ExternalProject instead of add_subdirectory?

@inaki-amatria
Copy link
Contributor

Could you share all the configuration settings that Portage might be applying under the hood? I'd like to reproduce the issue locally. I strongly believe this is not related to BUILD_ALWAYS but rather to how it interacts with Bear's configuration within Portage. I noticed that you're using a custom toolchain and a cache, which were not included in your issue report. Please provide those details so I can investigate further.

Ultimately, this decision rests with @rizsotto, as he is the maintainer of Bear. However, the current configuration has been highly beneficial to us, our CI system, and likely any other developer who has recently modified the C++ codebase. Before the commit we are now proposing to revert, any changes made under Bear/source required reconfiguring the project for Make/Ninja to recognize them 😰.

@DarthGandalf
Copy link
Author

I noticed that you're using a custom toolchain and a cache

How did you notice that? Because I don't use a custom toolchain nor a cache :)

Here's my /etc/portage/make.conf
# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.

COMMON_FLAGS="-O2 -pipe -march=znver2 -ggdb3 -frecord-gcc-switches"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
LDFLAGS="${LDFLAGS} -Wl,--defsym=__gentoo_check_ldflags__=0"

RUSTFLAGS="${RUSTFLAGS} -C target-cpu=znver2"

# Without these 2, -frecord-gcc-switches doesn't trigger the QA warning
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"

# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
#CHOST="x86_64-pc-linux-gnu"
# These are the USE flags that were used in addition to what is provided by the
# profile used for building.
USE="ffmpeg gstreamer theora zsh-completion css jabber matroska speex v4l libv4l2 idn -akonadi multilib vaapi vdpau threads icu heif x265"
# some packages have it in USE instead of where they probably should be...
USE="${USE} 3dnow avx mmxext ssse3"
USE="${USE} -systemd"
# kde is so slow with them
USE="${USE} -nepomuk -semantic-desktop"
USE="${USE} vulkan wayland"
USE="${USE} verify-sig"
USE="${USE} gtk-doc"
USE="${USE} collada"
USE="${USE} dist-kernel"

MAKEOPTS="-j20 -l20"

GENTOO_MIRRORS="http://www.mirrorservice.org/sites/distfiles.gentoo.org/ http://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/"

LINGUAS="ru en"
L10N="ru en en-US"

FEATURES="parallel-fetch parallel-install splitdebug network-sandbox ipc-sandbox sign qa-unresolved-soname-deps fakeroot binpkg-request-signature getbinpkg"

SIGNED_OFF_BY="Alexey Sokolov <[email protected]>"
PORTAGE_GPG_KEY="D5823CACB477191CAC0075555AE420CC0209989E"

EMERGE_DEFAULT_OPTS="--ask-enter-invalid --verbose --ask --binpkg-respect-use=y --jobs=25 --load-average=30"
# should match /etc/portage/patches
EMERGE_DEFAULT_OPTS="${EMERGE_DEFAULT_OPTS} --usepkg-exclude 'dev-vcs/git gui-libs/gtk media-sound/whipper net-im/discord net-im/signal-desktop-bin sys-kernel/gentoo-kernel x11-misc/shutter virtual/*'"
PORTAGE_NICENESS="10"

PORTDIR_OVERLAY="/usr/local/portage ${PORTDIR_OVERLAY}"
GCPAN_OVERLAY="/usr/local/portage"

PORTAGE_TMPDIR="/mnt/portagetmp"

VIDEO_CARDS="vesa amdgpu radeonsi"
ABI_X86="64 32"
QEMU_USER_TARGETS="arm aarch64"

UNINSTALL_IGNORE="$UNINSTALL_IGNORE /usr/src"

RUST_BACKTRACE="full"
and emerge --info
Portage 3.0.67 (python 3.13.2-final-0, default/linux/amd64/23.0/split-usr/desktop/plasma, gcc-14, glibc-2.40-r8, 6.12.16-gentoo x86_64)
=================================================================
System uname: Linux-6.12.16-gentoo-x86_64-AMD_Ryzen_9_3900X_12-Core_Processor-with-glibc2.40
KiB Mem:    65797524 total,   4262636 free
KiB Swap:   40256996 total,  22774456 free
Timestamp of repository gentoo-zh: Fri, 21 Mar 2025 14:05:17 +0000
Head commit of repository gentoo-zh: f6ebe1f4121c9b791219a059e14372b5c6f5a7fa

Timestamp of repository guru: Thu, 20 Mar 2025 11:33:31 +0000
Head commit of repository guru: bba937232305c649e1daef0bd83d17259d6ce297

Timestamp of repository mv: Thu, 20 Mar 2025 21:03:17 +0000
Head commit of repository mv: dfd2772861a73d9985b802dc21ac2aa611076cd5

Timestamp of repository qt: Fri, 21 Mar 2025 21:20:12 +0000
Head commit of repository qt: 3bb4fb3d817cd9c505a8143e59b9cdd9eb9052ab

Timestamp of repository rion: Fri, 07 Mar 2025 01:34:07 +0000
Head commit of repository rion: 3590f8aa2c775ab2b3f3173a655b427b62136e56

Timestamp of repository steam-overlay: Wed, 19 Mar 2025 21:04:10 +0000
Head commit of repository steam-overlay: 6af4091bc37aa83b5e551f5ec4f8c9df01f1192f

Timestamp of repository sunset-repo: Fri, 07 Mar 2025 01:34:23 +0000
Head commit of repository sunset-repo: 1c453f21e4619ec518416f82ed527d373bff6970

Timestamp of repository gentoo: Fri, 21 Mar 2025 00:45:00 +0000
sh bash 5.2_p37
ld GNU ld (Gentoo 2.44 p1) 2.44.0
distcc 3.4 x86_64-pc-linux-gnu [disabled]
app-misc/pax-utils:        1.3.8::gentoo
app-shells/bash:           5.2_p37::gentoo
dev-build/autoconf:        2.13-r8::gentoo, 2.72-r1::gentoo
dev-build/automake:        1.16.5-r2::gentoo, 1.17-r1::gentoo
dev-build/cmake:           3.31.5::gentoo
dev-build/libtool:         2.5.4::gentoo
dev-build/make:            4.4.1-r100::gentoo
dev-build/meson:           1.7.0::gentoo
dev-java/java-config:      2.3.4::gentoo
dev-lang/perl:             5.40.0-r1::gentoo
dev-lang/python:           3.11.11_p1::gentoo, 3.12.9::gentoo, 3.13.2::gentoo
dev-lang/rust-bin:         1.83.0-r2::gentoo, 1.84.1-r2::gentoo
llvm-core/clang:           19.1.7::gentoo
llvm-core/lld:             19.1.7::gentoo
llvm-core/llvm:            19.1.7::gentoo
sys-apps/baselayout:       2.17::gentoo
sys-apps/openrc:           0.56::gentoo
sys-apps/sandbox:          2.39::gentoo
sys-devel/binutils:        2.44::gentoo
sys-devel/binutils-config: 5.5.2::gentoo
sys-devel/gcc:             14.2.1_p20241221::gentoo
sys-devel/gcc-config:      2.12.1::gentoo
sys-kernel/linux-headers:  6.12::gentoo (virtual/os-headers)
sys-libs/glibc:            2.40-r8::gentoo
Repositories:

gentoo-zh
    location: /var/db/repos/gentoo-zh
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo-zh.git
    masters: gentoo
    volatile: False

guru
    location: /var/db/repos/guru
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/guru.git
    masters: gentoo
    volatile: False

mv
    location: /var/db/repos/mv
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/mv.git
    masters: gentoo
    volatile: False

qt
    location: /var/db/repos/qt
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/qt.git
    masters: gentoo
    volatile: False

rion
    location: /var/db/repos/rion
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/rion.git
    masters: gentoo
    volatile: False

steam-overlay
    location: /var/db/repos/steam-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/steam-overlay.git
    masters: gentoo
    volatile: False

sunset-repo
    location: /var/db/repos/sunset-repo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/sunset-repo.git
    masters: gentoo
    volatile: False

crossdev
    location: /usr/local/portage-crossdev
    masters: gentoo
    priority: 10
    volatile: True

gentoo
    location: /var/db/repos/gentoo
    sync-type: webrsync
    sync-uri: rsync://rsync.nl.gentoo.org/gentoo-portage
    priority: 100
    volatile: False
    sync-webrsync-verify-signature: yes

darthgandalf-overlay
    location: /usr/local/portage-public
    masters: gentoo
    priority: 200
    volatile: True

my_local_overlay
    location: /usr/local/portage
    masters: gentoo
    priority: 200
    volatile: True

Binary Repositories:

binhost
    priority: 1
    sync-uri: https://distfiles.gentoo.org/releases/amd64/binpackages/23.0/x86-64-v3

Installed sets: @optfeatures
ABI="amd64"
ABI_X86="64 32"
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
ACCEPT_PROPERTIES="*"
ACCEPT_RESTRICT="*"
ADA_TARGET="gcc_14"
AMDGPU_TARGETS="gfx1031"
ANT_HOME="/usr/share/ant"
APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias"
ARCH="amd64"
AUTOCLEAN="no"
BINPKG_COMPRESS="bzip2"
BINPKG_FORMAT="xpak"
BINPKG_GPG_SIGNING_BASE_COMMAND="/usr/bin/flock /run/lock/portage-binpkg-gpg.lock /usr/bin/gpg --sign --armor [PORTAGE_CONFIG]"
BINPKG_GPG_SIGNING_DIGEST="SHA512"
BINPKG_GPG_VERIFY_BASE_COMMAND="/usr/bin/gpg --verify --batch --no-tty --no-auto-check-trustdb --status-fd 2 [PORTAGE_CONFIG] [SIGNATURE]"
BINPKG_GPG_VERIFY_GPG_HOME="/etc/portage/gnupg"
BOOTSTRAP_USE="unicode pkg-config split-usr xml python_targets_python3_12 python_single_target_python3_12 multilib zstd cet"
BROOT=""
CALLIGRA_FEATURES="karbon sheets words"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=znver2 -ggdb3 -frecord-gcc-switches"
CFLAGS_amd64="-m64"
CFLAGS_x32="-mx32"
CFLAGS_x86="-m32 -mfpmath=sse"
CHOST="x86_64-pc-linux-gnu"
CHOST_amd64="x86_64-pc-linux-gnu"
CHOST_x32="x86_64-pc-linux-gnux32"
CHOST_x86="i686-pc-linux-gnu"
CLEAN_DELAY="5"
COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog"
COLLISION_IGNORE="/boot/dtbs/* /lib/modules/*"
COLORTERM="truecolor"
COMMON_FLAGS="-O2 -pipe -march=znver2 -ggdb3 -frecord-gcc-switches"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CPU_FLAGS_X86="mmx mmxext sse sse2 aes avx avx2 f16c fma3 pclmul popcnt rdrand sha sse3 sse4_1 sse4_2 sse4a ssse3"
CXXFLAGS="-O2 -pipe -march=znver2 -ggdb3 -frecord-gcc-switches"
DBUS_SESSION_BUS_ADDRESS="unix:path=/tmp/dbus-wq6FJH22Hf,guid=11d65051350fa42d4b43f1ef67d498d5"
DCC_EMAILLOG_WHOM_TO_BLAME=""
DEFAULT_ABI="amd64"
DESKTOP_SESSION="plasmax11"
DISPLAY=":0"
DISTCC_ENABLE_DISCREPANCY_EMAIL=""
DISTCC_FALLBACK="1"
DISTCC_SAVE_TEMPS="0"
DISTCC_SSH=""
DISTCC_TCP_CORK=""
DISTCC_VERBOSE="0"
DISTDIR="/var/cache/distfiles"
EDITOR="/usr/bin/vi"
ELIBC="glibc"
EMERGE_DEFAULT_OPTS="--ask-enter-invalid --verbose --ask --binpkg-respect-use=y --jobs=25 --load-average=30 --usepkg-exclude 'dev-vcs/git gui-libs/gtk media-sound/whipper net-im/discord net-im/signal-desktop-bin sys-kernel/gentoo-kernel x11-misc/shutter virtual/*'"
EMERGE_WARNING_DELAY="10"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
EPREFIX=""
EROOT="/"
ESYSROOT="/"
ETCKEEPER_CONF_DIR="/etc/etckeeper"
FCFLAGS="-O2 -pipe -march=znver2 -ggdb3 -frecord-gcc-switches"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-request-signature buildpkg-live config-protect-if-modified distlocks ebuild-locks fakeroot fixlafiles getbinpkg ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sign splitdebug strict strict-keepdir unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync warn-on-large-env xattr"
FETCHCOMMAND="wget -t 3 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}""
FETCHCOMMAND_RSYNC="rsync -LtvP "${URI}" "${DISTDIR}/${FILE}""
FETCHCOMMAND_SFTP="bash -c "x=\${2#sftp://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port= ; eval \"declare -a ssh_opts=(\${3})\" ; exec sftp \${port:+-P \${port}} \"\${ssh_opts[@]}\" \"\${host}:/\${x#*/}\" \"\$1\"" sftp "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}""
FETCHCOMMAND_SSH="bash -c "x=\${2#ssh://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port= ; exec rsync --rsh=\"ssh \${port:+-p\${port}} \${3}\" -avP \"\${host}:/\${x#*/}\" \"\$1\"" rsync "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}""
FFLAGS="-O2 -pipe -march=znver2 -ggdb3 -frecord-gcc-switches"
GCC_SPECS=""
GCPAN_OVERLAY="/usr/local/portage"
GENTOO_MIRRORS="http://www.mirrorservice.org/sites/distfiles.gentoo.org/ http://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/"
GPG_TTY="/dev/pts/24"
GPG_VERIFY_GROUP_DROP="nogroup"
GPG_VERIFY_USER_DROP="nobody"
GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox"
GREP_COLOR="37;45"
GREP_COLORS="mt=37;45"
GRUB_PLATFORMS=""
GSETTINGS_BACKEND="dconf"
GTK2_RC_FILES="/etc/gtk-2.0/gtkrc:/home/somebody/.gtkrc-2.0:/home/somebody/.config/gtkrc-2.0"
GTK_IM_MODULE="fcitx"
GTK_MODULES="appmenu-gtk-module"
GTK_RC_FILES="/etc/gtk/gtkrc:/home/somebody/.gtkrc:/home/somebody/.config/gtkrc"
GUILE_SINGLE_TARGET="3-0"
GUILE_TARGETS="3-0"
HOME="/home/somebody"
ICEAUTHORITY="/run/user/1000/iceauth_GqMHFq"
INCUS_EDK2_PATH="/usr/share/edk2-ovmf"
INFOPATH="/usr/share/gcc-data/x86_64-pc-linux-gnu/14/info:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.44/info:/usr/share/autoconf-2.72/info:/usr/share/autoconf-2.13/info:/usr/share/automake-1.17/info:/usr/share/automake-1.16.5/info:/usr/share/info"
INPUT_DEVICES="libinput"
IUSE_IMPLICIT="abi_x86_64 prefix prefix-guest prefix-stack"
JAVAC="/etc/java-config-2/current-system-vm/bin/javac"
JAVA_HOME="/etc/java-config-2/current-system-vm"
JDK_HOME="/etc/java-config-2/current-system-vm"
KDE_APPLICATIONS_AS_SCOPE="1"
KDE_FULL_SESSION="true"
KDE_SESSION_UID="1000"
KDE_SESSION_VERSION="6"
KERNEL="linux"
L10N="ru en en-US"
LADSPA_PATH="/usr/lib64/ladspa"
LANG="ru_RU.utf8"
LANGUAGE=""
LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text"
LC_MESSAGES="C"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,--defsym=__gentoo_check_ldflags__=0"
LDFLAGS_amd64="-m elf_x86_64"
LDFLAGS_x32="-m elf32_x86_64"
LDFLAGS_x86="-m elf_i386"
LESS="-R -M --shift 5"
LESSOPEN="|lesspipe %s"
LESS_TERMCAP_mb="�[01;31m"
LESS_TERMCAP_md="�[01;31m"
LESS_TERMCAP_me="�[0m"
LESS_TERMCAP_se="�[0m"
LESS_TERMCAP_so="�[00;47;30m"
LESS_TERMCAP_ue="�[0m"
LESS_TERMCAP_us="�[01;32m"
LEX="flex"
LIBDIR_amd64="lib64"
LIBDIR_x32="libx32"
LIBDIR_x86="lib"
LINGUAS="ru en"
LLVM_TARGETS="WebAssembly"
LOGNAME="somebody"
LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.7z=01;31:*.ace=01;31:*.alz=01;31:*.apk=01;31:*.arc=01;31:*.arj=01;31:*.bz=01;31:*.bz2=01;31:*.cab=01;31:*.cpio=01;31:*.crate=01;31:*.deb=01;31:*.drpm=01;31:*.dwm=01;31:*.dz=01;31:*.ear=01;31:*.egg=01;31:*.esd=01;31:*.gz=01;31:*.jar=01;31:*.lha=01;31:*.lrz=01;31:*.lz=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.lzo=01;31:*.pyz=01;31:*.rar=01;31:*.rpm=01;31:*.rz=01;31:*.sar=01;31:*.swm=01;31:*.t7z=01;31:*.tar=01;31:*.taz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tgz=01;31:*.tlz=01;31:*.txz=01;31:*.tz=01;31:*.tzo=01;31:*.tzst=01;31:*.udeb=01;31:*.war=01;31:*.whl=01;31:*.wim=01;31:*.xz=01;31:*.z=01;31:*.zip=01;31:*.zoo=01;31:*.zst=01;31:*.avif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.cfg=00;32:*.conf=00;32:*.diff=00;32:*.doc=00;32:*.ini=00;32:*.log=00;32:*.patch=00;32:*.pdf=00;32:*.ps=00;32:*.tex=00;32:*.txt=00;32:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:*~=00;90:*#=00;90:*.bak=00;90:*.crdownload=00;90:*.dpkg-dist=00;90:*.dpkg-new=00;90:*.dpkg-old=00;90:*.dpkg-tmp=00;90:*.old=00;90:*.orig=00;90:*.part=00;90:*.rej=00;90:*.rpmnew=00;90:*.rpmorig=00;90:*.rpmsave=00;90:*.swp=00;90:*.tmp=00;90:*.ucf-dist=00;90:*.ucf-new=00;90:*.ucf-old=00;90:"
LUA_SINGLE_TARGET="lua5-1"
LUA_TARGETS="lua5-1"
MAIL="/var/mail/somebody"
MAKEOPTS="-j20 -l20"
MANPAGER="manpager"
MANPATH="/etc/java-config-2/current-system-vm/man:/usr/share/gcc-data/x86_64-pc-linux-gnu/14/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.44/man:/etc/java-config-2/current-system-vm/man/:/usr/local/share/man:/usr/share/man:/usr/lib/rust/man-bin-1.83.0:/usr/lib/rust/man-bin-1.84.1:/usr/lib/llvm/19/share/man:/etc/eselect/wine/share/man"
MOTD_SHOWN="pam"
MULTILIB_ABIS="amd64 x86"
MULTILIB_STRICT_DENY="64-bit.*shared object"
MULTILIB_STRICT_DIRS="/lib32 /lib /usr/lib32 /usr/lib /usr/kde/*/lib32 /usr/kde/*/lib /usr/qt/*/lib32 /usr/qt/*/lib /usr/X11R6/lib32 /usr/X11R6/lib"
MULTILIB_STRICT_EXEMPT="(perl5|gcc|binutils|eclipse-3|debug|portage|udev|systemd|clang|python-exec|llvm)"
OFFICE_IMPLEMENTATION="libreoffice"
OLDPWD="/home/somebody"
OPENCL_PROFILE="ocl-icd"
OPENGL_PROFILE="xorg-x11"
PAGER="/usr/bin/less"
PAM_KWALLET5_LOGIN="/run/user/1000/kwallet5.socket"
PATH="/home/somebody/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/19/bin:/usr/lib/llvm/18/bin:/etc/eselect/wine/bin:/home/somebody/.krew/bin:/home/somebody/.raku/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/19/bin"
PHP_TARGETS="php8-2"
PKGDIR="/var/cache/binpkgs"
PORTAGE_ARCHLIST="alpha amd64 amd64-linux arm arm-linux arm64 arm64-linux arm64-macos hppa loong m68k mips ppc ppc-macos ppc64 ppc64-linux riscv riscv-linux s390 sparc x64-macos x64-solaris x86 x86-linux x86-macos"
PORTAGE_BIN_PATH="/usr/lib/portage/python3.13"
PORTAGE_COMPRESS_EXCLUDE_SUFFIXES="css gif htm[l]? jp[e]?g js pdf png"
PORTAGE_CONFIGROOT="/"
PORTAGE_DEBUG="0"
PORTAGE_DEPCACHEDIR="/var/cache/edb/dep"
PORTAGE_ELOG_CLASSES="log warn error"
PORTAGE_ELOG_MAILFROM="portage@localhost"
PORTAGE_ELOG_MAILSUBJECT="[portage] ebuild log for ${PACKAGE} on ${HOST}"
PORTAGE_ELOG_MAILURI="root"
PORTAGE_ELOG_SYSTEM="save_summary:log,warn,error,qa echo"
PORTAGE_FETCH_CHECKSUM_TRY_MIRRORS="5"
PORTAGE_FETCH_RESUME_MIN_SIZE="350K"
PORTAGE_GID="250"
PORTAGE_GPG_KEY="D5823CACB477191CAC0075555AE420CC0209989E"
PORTAGE_GPG_SIGNING_COMMAND="gpg --sign --digest-algo SHA256 --clearsign --yes --default-key "${PORTAGE_GPG_KEY}" --homedir "${PORTAGE_GPG_DIR}" "${FILE}""
PORTAGE_GRPNAME="portage"
PORTAGE_INST_GID="0"
PORTAGE_INST_UID="0"
PORTAGE_INTERNAL_CALLER="1"
PORTAGE_LOGDIR_CLEAN="find "${PORTAGE_LOGDIR}" -type f ! -name "summary.log*" -mtime +7 -delete"
PORTAGE_NICENESS="10"
PORTAGE_OVERRIDE_EPREFIX=""
PORTAGE_PYM_PATH="/usr/lib/python3.13/site-packages"
PORTAGE_PYTHONPATH="/usr/lib/python3.13/site-packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_RSYNC_RETRIES="-1"
PORTAGE_SYNC_STALE="30"
PORTAGE_TMPDIR="/mnt/portagetmp"
PORTAGE_TRUST_HELPER="/usr/bin/getuto"
PORTAGE_USERNAME="portage"
PORTAGE_VERBOSE="1"
PORTAGE_WORKDIR_MODE="0700"
PORTAGE_XATTR_EXCLUDE="bcachefs.* bcachefs_effective.* 	btrfs.* security.evm security.ima 	security.selinux system.nfs4_acl user.apache_handler 	user.Beagle.* user.dublincore.* user.mime_encoding user.xdg.*"
POSTGRES_TARGETS="postgres16"
PROFILE_23_USRTYPE="split-usr"
PROFILE_ONLY_VARIABLES="ARCH ELIBC IUSE_IMPLICIT KERNEL USE_EXPAND_IMPLICIT USE_EXPAND_UNPREFIXED USE_EXPAND_VALUES_ARCH USE_EXPAND_VALUES_ELIBC USE_EXPAND_VALUES_KERNEL"
PWD="/"
PYTHONDONTWRITEBYTECODE="1"
PYTHON_SINGLE_TARGET="python3_12"
PYTHON_TARGETS="python3_12 python3_13"
QEMU_USER_TARGETS="arm aarch64"
QT_AUTO_SCREEN_SCALE_FACTOR="0"
QT_GRAPHICSSYSTEM="raster"
QT_IM_MODULE="fcitx"
QT_WAYLAND_RECONNECT="1"
RESUMECOMMAND="wget -c -t 3 -T 60 --passive-ftp -O "${DISTDIR}/${FILE}" "${URI}""
RESUMECOMMAND_RSYNC="rsync -LtvP "${URI}" "${DISTDIR}/${FILE}""
RESUMECOMMAND_SSH="bash -c "x=\${2#ssh://} ; host=\${x%%/*} ; port=\${host##*:} ; host=\${host%:*} ; [[ \${host} = \${port} ]] && port= ; exec rsync --rsh=\"ssh \${port:+-p\${port}} \${3}\" -avP \"\${host}:/\${x#*/}\" \"\$1\"" rsync "${DISTDIR}/${FILE}" "${URI}" "${PORTAGE_SSH_OPTS}""
ROOT="/"
ROOTPATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/lib/llvm/19/bin"
RPMDIR="/var/cache/rpm"
RUBY_TARGETS="ruby32"
RUSTFLAGS=" -C target-cpu=znver2"
RUST_BACKTRACE="full"
SESSION_MANAGER="local/komputer:@/tmp/.ICE-unix/6125,unix/komputer:/tmp/.ICE-unix/6125"
SHELL="/bin/zsh"
SHLVL="2"
SIGNED_OFF_BY="Alexey Sokolov <[email protected]>"
SSH_ASKPASS="/usr/bin/ksshaskpass"
SYMLINK_LIB="no"
SYSROOT="/"
TERM="tmux-256color"
TERMINATOR_DBUS_NAME="net.tenshu.Terminator21a9d5db22c73a993ff0b42f64b396873"
TERMINATOR_DBUS_PATH="/net/tenshu/Terminator2"
TERMINATOR_UUID="urn:uuid:893aed77-c45c-478c-86f8-5d97515641a7"
TERM_PROGRAM="tmux"
TERM_PROGRAM_VERSION="3.5a"
TMPDIR="/tmp/somebody"
TMUX="/var/tmp/tmux-1000/default,14866,0"
TMUX_PANE="%24"
TMUX_PLUGIN_MANAGER_PATH="/home/somebody/.tmux/plugins/"
TWISTED_DISABLE_WRITING_OF_PLUGIN_CACHE="1"
UBUNTU_MENUPROXY="1"
UNCACHED_ERR_FD=""
UNINSTALL_IGNORE="/boot/dtbs/* /lib/modules/* /var/run /var/lock /bin /lib /lib32 /lib64 /libx32 /sbin /usr/sbin /usr/lib/modules/* /lib/systemd /lib/udev /usr/src"
USE="3dnow X a52 aac acl acpi activities alsa amd64 avx bluetooth branding bzip2 cairo cdda cdr cet collada crypt css cups dbus declarative dist-kernel dri dts dvd dvdr elogind encode exif ffmpeg flac gdbm gif gpm gstreamer gtk gtk-doc gui heif iconv icu idn ipv6 jabber jpeg kde kf6compat kwallet lcms libnotify libtirpc libv4l2 mad matroska mmxext mng mp3 mp4 mpeg multilib ncurses networkmanager nls ogg opengl openmp pam pango pcre pdf pipewire plasma png policykit ppds qml qt5 qt6 readline screencast sdl seccomp sound speex spell split-usr ssl ssse3 startup-notification svg test-rust theora threads tiff truetype udev udisks unicode upower usb v4l vaapi vdpau verify-sig vorbis vulkan wayland widgets wxwidgets x264 x265 xattr xcb xft xml xv xvid zlib zsh-completion" ABI_X86="64 32" ADA_TARGET="gcc_14" AMDGPU_TARGETS="gfx1031" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 aes avx avx2 f16c fma3 pclmul popcnt rdrand sha sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="libinput" KERNEL="linux" L10N="ru en en-US" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LLVM_TARGETS="WebAssembly" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres16" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12 python3_13" QEMU_USER_TARGETS="arm aarch64" RUBY_TARGETS="ruby32" VIDEO_CARDS="vesa amdgpu radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
USER="somebody"
USERLAND="GNU"
USE_EXPAND="ABI_MIPS ABI_S390 ABI_X86 ADA_TARGET ALSA_CARDS AMDGPU_TARGETS APACHE2_MODULES APACHE2_MPMS CALLIGRA_FEATURES CAMERAS COLLECTD_PLUGINS CPU_FLAGS_ARM CPU_FLAGS_PPC CPU_FLAGS_X86 CURL_QUIC CURL_SSL ELIBC FFTOOLS GPSD_PROTOCOLS GRUB_PLATFORMS GUILE_SINGLE_TARGET GUILE_TARGETS INPUT_DEVICES KERNEL L10N LCD_DEVICES LIBREOFFICE_EXTENSIONS LLVM_SLOT LLVM_TARGETS LUA_SINGLE_TARGET LUA_TARGETS NGINX_MODULES_HTTP NGINX_MODULES_MAIL NGINX_MODULES_STREAM OFFICE_IMPLEMENTATION OPENMPI_FABRICS OPENMPI_OFED_FEATURES OPENMPI_RM PERL_FEATURES PHP_TARGETS POSTGRES_TARGETS PYTHON_SINGLE_TARGET PYTHON_TARGETS QEMU_SOFTMMU_TARGETS QEMU_USER_TARGETS RUBY_TARGETS SANE_BACKENDS UWSGI_PLUGINS VIDEO_CARDS VOICEMAIL_STORAGE XTABLES_ADDONS"
USE_EXPAND_HIDDEN="ABI_MIPS ABI_S390 CPU_FLAGS_ARM CPU_FLAGS_PPC ELIBC KERNEL"
USE_EXPAND_IMPLICIT="ARCH ELIBC KERNEL"
USE_EXPAND_UNPREFIXED="ARCH"
USE_EXPAND_VALUES_ARCH="alpha amd64 amd64-linux arm arm64 arm64-macos hppa loong m68k mips ppc ppc64 ppc64-linux ppc-macos riscv s390 sparc x64-macos x64-solaris x86 x86-linux"
USE_EXPAND_VALUES_ELIBC="bionic Darwin glibc mingw musl SunOS"
USE_EXPAND_VALUES_KERNEL="Darwin linux SunOS"
USE_ORDER="env:pkg:conf:defaults:pkginternal:features:repo:env.d"
VIDEO_CARDS="vesa amdgpu radeonsi"
VISUAL="/usr/bin/vi"
VTE_VERSION="7603"
XAUTHORITY="/tmp/xauth_OkYzHw"
XDG_CONFIG_DIRS="/etc/xdg"
XDG_CURRENT_DESKTOP="KDE"
XDG_DATA_DIRS="/home/somebody/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/etc/eselect/wine/share"
XDG_MENU_PREFIX="plasma-"
XDG_RUNTIME_DIR="/run/user/1000"
XDG_SEAT="seat0"
XDG_SEAT_PATH="/org/freedesktop/DisplayManager/Seat0"
XDG_SESSION_CLASS="user"
XDG_SESSION_ID="1"
XDG_SESSION_PATH="/org/freedesktop/DisplayManager/Session1"
XDG_SESSION_TYPE="x11"
XDG_VTNR="2"
XMODIFIERS="@im=fcitx"
XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
ac_cv_c_undeclared_builtin_options="none needed"
enable_year2038="no"
gl_cv_compiler_check_decl_option="-Werror=implicit-function-declaration"
gl_cv_func_getcwd_path_max="yes"

@inaki-amatria
Copy link
Contributor

I noticed that you're using a custom toolchain and a cache

How did you notice that? Because I don't use a custom toolchain nor a cache :)
Here's my /etc/portage/make.conf

and emerge --info

From 3.1.6-build.log:

. . .
cmake -C /mnt/portagetmp/portage/dev-util/bear-3.1.6/work/Bear-3.1.6_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_UNIT_TESTS=no -DENABLE_FUNC_TESTS=no -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/mnt/portagetmp/portage/dev-util/bear-3.1.6/work/Bear-3.1.6_build/gentoo_toolchain.cmake /mnt/portagetmp/portage/dev-util/bear-3.1.6/work/Bear-3.1.6
. . .

@DarthGandalf
Copy link
Author

That's not a cache.

The gentoo_toolchain.cmake is just how Portage handles cmake projects, to use the correct compiler.

$ cat /mnt/portagetmp/portage/dev-util/bear-3.1.6/work/Bear-3.1.6_build/gentoo_toolchain.cmake
set(CMAKE_ASM_COMPILER "x86_64-pc-linux-gnu-gcc")
set(CMAKE_ASM-ATT_COMPILER "x86_64-pc-linux-gnu-gcc")
set(CMAKE_C_COMPILER "x86_64-pc-linux-gnu-gcc")
set(CMAKE_CXX_COMPILER "x86_64-pc-linux-gnu-g++")
set(CMAKE_Fortran_COMPILER "x86_64-pc-linux-gnu-gfortran")
set(CMAKE_AR /usr/bin/x86_64-pc-linux-gnu-ar CACHE FILEPATH "Archive manager" FORCE)
set(CMAKE_RANLIB /usr/bin/x86_64-pc-linux-gnu-ranlib CACHE FILEPATH "Archive index generator" FORCE)
set(CMAKE_SYSTEM_PROCESSOR "x86_64")

@DarthGandalf
Copy link
Author

$ cat /mnt/portagetmp/portage/dev-util/bear-3.1.6/work/Bear-3.1.6_build/gentoo_common_config.cmake
set(CMAKE_GENTOO_BUILD ON CACHE BOOL "Indicate Gentoo package build")
set(LIB_SUFFIX 64 CACHE STRING "library path suffix" FORCE)
set(CMAKE_INSTALL_LIBDIR lib64 CACHE PATH "Output directory for libraries")
set(CMAKE_INSTALL_INFODIR "/usr/share/info" CACHE PATH "")
set(CMAKE_INSTALL_MANDIR "/usr/share/man" CACHE PATH "")
set(CMAKE_USER_MAKE_RULES_OVERRIDE "/mnt/portagetmp/portage/dev-util/bear-3.1.6/work/Bear-3.1.6_build/gentoo_rules.cmake" CACHE FILEPATH "Gentoo override rules")
set(CMAKE_INSTALL_DOCDIR "/usr/share/doc/bear-3.1.6" CACHE PATH "")
set(BUILD_SHARED_LIBS ON CACHE BOOL "")
set(Python3_FIND_UNVERSIONED_NAMES FIRST CACHE STRING "")
set(CMAKE_DISABLE_PRECOMPILE_HEADERS ON CACHE BOOL "")
set(CMAKE_TLS_VERIFY ON CACHE BOOL "")
set(CMAKE_COMPILE_WARNING_AS_ERROR OFF CACHE BOOL "")
set(CMAKE_INSTALL_ALWAYS 1)
set(CMAKE_ASM_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_ASM-ATT_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "" CACHE STRING "")
set(CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO "" CACHE STRING "")

@inaki-amatria
Copy link
Contributor

Please, post /mnt/portagetmp/portage/dev-util/bear-3.1.6/work/Bear-3.1.6_build/gentoo_rules.cmake too

@DarthGandalf
Copy link
Author

$ cat /mnt/portagetmp/portage/dev-util/bear-3.1.6/work/Bear-3.1.6_build/gentoo_rules.cmake
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> <INCLUDES>  <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM compile command" FORCE)
set(CMAKE_ASM-ATT_COMPILE_OBJECT "<CMAKE_ASM-ATT_COMPILER> <DEFINES> <INCLUDES>  <FLAGS> -o <OBJECT> -c -x assembler <SOURCE>" CACHE STRING "ASM-ATT compile command" FORCE)
set(CMAKE_ASM-ATT_LINK_FLAGS "-nostdlib" CACHE STRING "ASM-ATT link flags" FORCE)
set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> <INCLUDES>  <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE)
set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> <INCLUDES>  <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE)
set(CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> <DEFINES> <INCLUDES> -O2 -pipe -march=znver2 -ggdb3 -frecord-gcc-switches <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "Fortran compile command" FORCE)

@inaki-amatria
Copy link
Contributor

I still can't reproduce the issue. What is the value of CMAKE_INSTALL_MODE when running Portage? https://cmake.org/cmake/help/latest/module/ExternalProject.html#install-step-options

I ask you to please run Portage with BUILD_ALWAYS enabled and with BUILD_ALWAYS disabled and run find /mnt/portagetmp/portage/dev-util/bear-3.1.6 -type f -exec sha256sum {} \; to see which files generated by CMake change when running with the option enabled or disabled... It looks like there may be some option that is set by Portage that interferes with the install step... I don't think the underlying issue is Bear setting BUILD_ALWAYS.

I see no changes in the generated files when trying to reproduce the issue. Thus, I believe the issue is with Portage and not with Bear enabling or disabling BUILD_ALWAYS...

build.txt
build-always.txt

@DarthGandalf
Copy link
Author

@DarthGandalf
Copy link
Author

The cmake eclass doesn't set CMAKE_INSTALL_MODE to anything

@rizsotto
Copy link
Owner

@DarthGandalf @inaki-amatria thanks to look into this! I do appreciate that you spend time to find a solution for this.

I am not really an expert on CMake... I still try to put my head around why would the BUILD_ALWAYS could cause the install target to act differently.

  • fedora build logs seems does not have this issue.
  • homebrew build file does not contain patch to disable BUILD_ALWAYS, presume they also does not have this issue.

@DarthGandalf
Copy link
Author

Would you be ok with replacing ExternalProject with add_subdirectory?

@inaki-amatria
Copy link
Contributor

Thank you for your time and effort in investigating this, Alexey and László.

Based on the available evidence, this issue seems specific to Portage or the build recipe for Bear under Portage. As it has been pointed out, we cannot reproduce the issue elsewhere, and BUILD_ALWAYS should not lead to unexpected installation of targets.

Alexey, I understand that this behavior is undesired, but rather than modifying Bear to accommodate Portage, it might be more effective to investigate why Portage is causing repeated installation of targets. This may not be an isolated issue, as other projects under Portage could be affected in similar ways. By pinpointing the root cause, you could help remove unnecessary patches across multiple projects, saving Portage maintainers significant effort in the long run.

I would recommend trying to create a minimal reproducer with CMake and Portage to isolate the issue. Let us know if we can assist in that process.

@gruenich
Copy link

what was the reason to use ExternalProject instead of add_subdirectory?

To me this is the right approach. The usage of ExternalProject is highly unusual.

@rizsotto
Copy link
Owner

I've made the decision to use ExternalProject instead of add_subdirectory in 2020. Don't remember the exact reason why. 😄 Changing from one to another is not a trivial task.

Long term, I am planning to replace the C++/CMake with rust/cargo. (ETA for that is in May this year.)

I would like to have no trouble to package the existing version. If that means I have to revert the BUILD_ALWAYS change, I would do that. If someone volunteer to make a PR to do the add_subdirectory change, I am happy to review and merge that too.

@DarthGandalf
Copy link
Author

Changing from one to another is not a trivial task.

Well, it shouldn't be too hard. But if it's going to be replaced with rust in just 2 months, probably that doesn't worth the effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants