Skip to content
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

cannot build from git in portage/emerge #707

Closed
ZeroChaos- opened this issue Jul 1, 2022 · 14 comments
Closed

cannot build from git in portage/emerge #707

ZeroChaos- opened this issue Jul 1, 2022 · 14 comments

Comments

@ZeroChaos-
Copy link

I've had a "live ebuild" for TR for a while now, basically it automatically pulls from git within gentoo's package manager, and builds/installs the latest rev. It's super helpful for testing, as it runs everything through all the qa scripts, etc. Unfortunately, when version information was added to the build system, it breaks the way gentoo builds.

[147/159] : && /usr/bin/x86_64-pc-linux-gnu-g++ -Os -march=native -mtune=native -pipe -frecord-gcc-switches -pthread -Wno-narrowing -fvisibility=hidden -fPIC -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0    -rdynamic CMakeFiles/trunk-recorder.dir/trunk-recorder/main.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/recorder.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/call_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/formatter.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/source.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/call_conventional.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/systems/smartnet_trunking.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/systems/p25_trunking.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/systems/smartnet_parser.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/systems/p25_parser.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/systems/smartnet_decode.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/systems/system_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/debug_recorder_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/sigmf_recorder_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/analog_recorder.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/dmr_recorder_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/p25_recorder_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/p25_recorder_fsk4_demod.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/p25_recorder_qpsk_demod.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/p25_recorder_decode.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/csv_helper.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/talkgroup.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/talkgroups.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/unit_tag.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/unit_tags.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/plugin_manager/plugin_manager.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/call_concluder/call_concluder.cc.o CMakeFiles/trunk-recorder.dir/lib/lfsr/lfsr.cxx.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/freq_xlating_fft_filter.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/transmission_sink.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/decoders/fsync_decode.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/decoders/mdc_decode.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/decoders/star_decode.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/decoders/signal_decoder_sink_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/decoders/tps_decoder_sink_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/decoder_wrapper_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/plugin_wrapper_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/selector_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/wavfile_gr3.8.cc.o -o trunk-recorder  -Wl,-rpath,/var/tmp/portage/net-wireless/trunk-recorder-9999/work/trunk-recorder-9999_build:  libgit.so  libtrunk-recorder.a  libgnuradio-op25_repeater.so  -ldl  -lssl  -lcrypto  -lcurl  /usr/lib64/libboost_log_setup.so.1.79.0  /usr/lib64/libboost_log.so.1.79.0  /usr/lib64/libboost_random.so.1.79.0  -lgnuradio-uhd  -luhd  -lgnuradio-osmosdr  /usr/lib64/libgnuradio-digital.so.3.8.5.0  /usr/lib64/libboost_chrono.so.1.79.0  -lgnuradio-filter  /usr/lib64/libgnuradio-analog.so.3.8.5.0  /usr/lib64/libgnuradio-filter.so.3.8.5.0  /usr/lib64/libgnuradio-blocks.so.3.8.5.0  /usr/lib64/libgnuradio-fft.so.3.8.5.0  -lfftw3f  -lfftw3f_threads  /usr/lib64/libgnuradio-runtime.so.3.8.5.0  /usr/lib64/libboost_system.so.1.79.0  /usr/lib64/libboost_program_options.so.1.79.0  /usr/lib64/libboost_filesystem.so.1.79.0  /usr/lib64/libboost_atomic.so.1.79.0  /usr/lib64/libboost_regex.so.1.79.0  /usr/lib64/libgnuradio-pmt.so.3.8.5.0  /usr/lib64/libboost_thread.so.1.79.0  -llog4cpp  -lgmpxx  -lgmp  -lrt  /usr/lib64/libvolk.so.2.5.0  -ldl  -lm && :
FAILED: trunk-recorder 
: && /usr/bin/x86_64-pc-linux-gnu-g++ -Os -march=native -mtune=native -pipe -frecord-gcc-switches -pthread -Wno-narrowing -fvisibility=hidden -fPIC -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0    -rdynamic CMakeFiles/trunk-recorder.dir/trunk-recorder/main.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/recorder.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/call_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/formatter.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/source.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/call_conventional.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/systems/smartnet_trunking.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/systems/p25_trunking.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/systems/smartnet_parser.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/systems/p25_parser.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/systems/smartnet_decode.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/systems/system_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/debug_recorder_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/sigmf_recorder_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/analog_recorder.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/dmr_recorder_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/p25_recorder_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/p25_recorder_fsk4_demod.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/p25_recorder_qpsk_demod.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/recorders/p25_recorder_decode.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/csv_helper.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/talkgroup.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/talkgroups.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/unit_tag.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/unit_tags.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/plugin_manager/plugin_manager.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/call_concluder/call_concluder.cc.o CMakeFiles/trunk-recorder.dir/lib/lfsr/lfsr.cxx.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/freq_xlating_fft_filter.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/transmission_sink.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/decoders/fsync_decode.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/decoders/mdc_decode.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/decoders/star_decode.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/decoders/signal_decoder_sink_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/decoders/tps_decoder_sink_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/decoder_wrapper_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/plugin_wrapper_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/selector_impl.cc.o CMakeFiles/trunk-recorder.dir/trunk-recorder/gr_blocks/wavfile_gr3.8.cc.o -o trunk-recorder  -Wl,-rpath,/var/tmp/portage/net-wireless/trunk-recorder-9999/work/trunk-recorder-9999_build:  libgit.so  libtrunk-recorder.a  libgnuradio-op25_repeater.so  -ldl  -lssl  -lcrypto  -lcurl  /usr/lib64/libboost_log_setup.so.1.79.0  /usr/lib64/libboost_log.so.1.79.0  /usr/lib64/libboost_random.so.1.79.0  -lgnuradio-uhd  -luhd  -lgnuradio-osmosdr  /usr/lib64/libgnuradio-digital.so.3.8.5.0  /usr/lib64/libboost_chrono.so.1.79.0  -lgnuradio-filter  /usr/lib64/libgnuradio-analog.so.3.8.5.0  /usr/lib64/libgnuradio-filter.so.3.8.5.0  /usr/lib64/libgnuradio-blocks.so.3.8.5.0  /usr/lib64/libgnuradio-fft.so.3.8.5.0  -lfftw3f  -lfftw3f_threads  /usr/lib64/libgnuradio-runtime.so.3.8.5.0  /usr/lib64/libboost_system.so.1.79.0  /usr/lib64/libboost_program_options.so.1.79.0  /usr/lib64/libboost_filesystem.so.1.79.0  /usr/lib64/libboost_atomic.so.1.79.0  /usr/lib64/libboost_regex.so.1.79.0  /usr/lib64/libgnuradio-pmt.so.3.8.5.0  /usr/lib64/libboost_thread.so.1.79.0  -llog4cpp  -lgmpxx  -lgmp  -lrt  /usr/lib64/libvolk.so.2.5.0  -ldl  -lm && :
/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: CMakeFiles/trunk-recorder.dir/trunk-recorder/main.cc.o: in function `main':
main.cc:(.text.startup+0x749): undefined reference to `GitMetadata::VersionInfo()'
collect2: error: ld returned 1 exit status

I suspect that the easiest solution to this, would to simply add a flag which can be passed to cmake that sets the version info manually.

Unfortunately, I don't see anything useful in cmake right now, not even an error.

 * Checking out https://github.com/robotastic/trunk-recorder.git to /var/tmp/portage/net-wireless/trunk-recorder-9999/work/trunk-recorder-9999 ...
git checkout --quiet refs/git-r3/HEAD
GIT update -->
   repository:               https://github.com/robotastic/trunk-recorder.git
   at the commit:            fc16d6e85d5a0ea04f11da23bd0d7d07bea5ccd5
>>> Source unpacked in /var/tmp/portage/net-wireless/trunk-recorder-9999/work
>>> Preparing source in /var/tmp/portage/net-wireless/trunk-recorder-9999/work/trunk-recorder-9999 ...
 * Source directory (CMAKE_USE_DIR): "/var/tmp/portage/net-wireless/trunk-recorder-9999/work/trunk-recorder-9999"
 * Build directory  (BUILD_DIR):     "/var/tmp/portage/net-wireless/trunk-recorder-9999/work/trunk-recorder-9999_build"
 * Hardcoded definition(s) removed in CMakeLists.txt:
 *     set(CMAKE_BUILD_TYPE "Release")
 *  set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/net-wireless/trunk-recorder-9999/work/trunk-recorder-9999 ...
 * Source directory (CMAKE_USE_DIR): "/var/tmp/portage/net-wireless/trunk-recorder-9999/work/trunk-recorder-9999"
 * Build directory  (BUILD_DIR):     "/var/tmp/portage/net-wireless/trunk-recorder-9999/work/trunk-recorder-9999_build"
cmake -C /var/tmp/portage/net-wireless/trunk-recorder-9999/work/trunk-recorder-9999_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/net-wireless/trunk-recorder-9999/work/trunk-recorder-9999_build/gentoo_toolchain.cmake /var/tmp/portage/net-wireless/trunk-recorder-9999/work/trunk-recorder-9999
loading initial cache file /var/tmp/portage/net-wireless/trunk-recorder-9999/work/trunk-recorder-9999_build/gentoo_common_config.cmake
-- The CXX compiler identification is GNU 11.3.0
-- The C compiler identification is GNU 11.3.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/x86_64-pc-linux-gnu-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/x86_64-pc-linux-gnu-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/bin/x86_64-pc-linux-gnu-pkg-config (found version "1.8.0") 
-- Found LOG4CPP: /usr/lib64/liblog4cpp.so
-- Checking for module 'gmp'
--   Found gmp, version 6.2.1
-- Found GMP: /usr/lib64/libgmpxx.so  
-- Using GMP.
-- Found MPLIB: /usr/lib64/libgmpxx.so  
-- Found Boost: /usr/lib64/cmake/Boost-1.79.0/BoostConfig.cmake (found suitable version "1.79.0", minimum required is "1.79.0") found components: date_time program_options filesystem system regex thread 
-- Found Volk: Volk::volk  
-- User set python executable /usr/bin/python3.9
-- Found PythonInterp: /usr/bin/python3.9 (found version "3.9.13") 
-- Found PythonLibs: /usr/lib64/libpython3.9.so (found suitable exact version "3.9.13") 
-- Found Git: /usr/bin/git  
-- Extracting version information from git describe...
-- Using GMP.
-- Checking for module 'fftw3f >= 3.0'
--   Found fftw3f , version 3.3.10
-- Found FFTW3f: /usr/lib64/libfftw3f.so  
-- GnuRadio Version: 198661
-- Checking for module 'gnuradio-uhd'
--   Found gnuradio-uhd, version 3.8.5
-- Found gnuradio-uhd: /usr/include, /usr/lib64/libgnuradio-uhd.so
-- Found GnuradioUHD: /usr/lib64/libgnuradio-uhd.so  
-- Checking for module 'gnuradio-osmosdr'
--   Package 'gnuradio-osmosdr', required by 'virtual:world', not found
-- Found gnuradio-osmosdr: /usr/include, /usr/lib64/libgnuradio-osmosdr.so
-- Found GnuradioOsmosdr: /usr/lib64/libgnuradio-osmosdr.so  
-- Checking for module 'libhackrf'
--   Found libhackrf, version 0.6
-- Found LibHackRF: /usr/lib64/libhackrf.so  
-- Checking for module 'uhd'
--   Found uhd, version 4.2.0.0-0-unknown
-- Found LibUHD: /usr/lib64/libuhd.so  
-- Found OpenSSL: /usr/lib64/libcrypto.so (found version "1.1.1o")  
-- Found CURL: /usr/lib64/libcurl.so (found version "7.83.1")  
-- Configuring Boost C++ Libraries...
-- Found Boost: /usr/lib64/cmake/Boost-1.79.0/BoostConfig.cmake (found version "1.79.0") found components: thread system program_options filesystem log_setup log regex random 
-- AMBE Tone Synthesis Enabled
-- All libraries:
-- <<< Gentoo configuration >>>
Build type      RelWithDebInfo
Install path    /usr
Compiler flags:
C               -O3 -march=native -mtune=native -pipe -frecord-gcc-switches
C++             -Os -march=native -mtune=native -pipe -frecord-gcc-switches -pthread -Wno-narrowing -fvisibility=hidden -fPIC
Linker flags:
Executable      -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0
Module          -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0
Shared          -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0

-- Configuring done
-- Generating done
-- Build files have been written to: /var/tmp/portage/net-wireless/trunk-recorder-9999/work/trunk-recorder-9999_build
@ZeroChaos-
Copy link
Author

Incidently, this build error is not at all limited to gentoo, or even git builds. The problem is that git has been introduced as a requirement for all builds. This means it's no longer possible to make a release or build from a tag tarball.

Here is me trying to build from the master tarball (there hasn't been a tag since the change or I would show from a tag as well)

zero@theprophet build % make -j1
[  0%] Checking the git repository for changes...
CMake Error at /tmp/tr_testing/trunk-recorder-master/git_watcher.cmake:139 (message):
  fatal: not a git repository (or any of the parent directories): .git

   (/usr/bin/git status --porcelain -unormal)
Call Stack (most recent call first):
  /tmp/tr_testing/trunk-recorder-master/git_watcher.cmake:162 (RunGitCommand)
  /tmp/tr_testing/trunk-recorder-master/git_watcher.cmake:289 (GetGitState)
  /tmp/tr_testing/trunk-recorder-master/git_watcher.cmake:356 (CheckGit)
  /tmp/tr_testing/trunk-recorder-master/git_watcher.cmake:367 (Main)


make[2]: *** [CMakeFiles/check_git.dir/build.make:71: CMakeFiles/check_git] Error 1
make[1]: *** [CMakeFiles/Makefile2:247: CMakeFiles/check_git.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

@taclane
Copy link
Contributor

taclane commented Jul 18, 2022

Just tested this on both a fresh master.zip and a git pull; comment out the below lines in git_watcher.cmake:
https://github.com/robotastic/trunk-recorder/blob/a30ee308518d478c4fdcd39fab2314717898bd65/git_watcher.cmake#L137-L140
and it will build. T-R will fall back on the default version strings if queried from a snapshot build:

# ./trunk-recorder --version
Trunk-Recorder: 4.3.2
WARN: failed to get the current git state. Is this a git repo?

Or display git stats from a git build:

# ./trunk-recorder --version
Trunk-Recorder: 4.3.2
        WARN: there were uncommitted changes at build-time.
        commit a30ee308518d478c4fdcd39fab2314717898bd65 (master)
        describe 2.1.2-1460-ga30ee30
        Author: Luke Berndt <lukekb@gmail.com>
        Date: 2022-07-16 09:42:05 -0400

        updated costas_alpha to match OP25

@rabarar , since you helped get this going with #688, do you have any other suggestions?

@rabarar
Copy link
Contributor

rabarar commented Jul 18, 2022 via email

@ZeroChaos-
Copy link
Author

It fails because the .git directory is missing, I am very confident that is unrelated to the git software version.

@ZeroChaos-
Copy link
Author

That said, looks like today it is 2.35.1

@taclane
Copy link
Contributor

taclane commented Jul 18, 2022

What version of git are you using?

I tested the above with git version 2.37.1 on MacOS/homebrew. As noted previously, building from a source zip will fail because it lacks a live .git directory.

Per the comments just above the lines I quoted in git_watcher.cmake, commenting them out will allow the compile to continue with default values if the source is a tagged release or tarball, or anything other than a git pull.

        # Issue 26: git info not properly set
        #
        # Check if we should fail if any of the exit codes are non-zero.
        # Most methods have a fall-back default value that's used in case of non-zero
        # exit codes. If you're feeling risky, disable this safety check and use
        # those default values.

I haven't tested is what happens if you dont even have git installed at all. I don't know what would happen in that event.

@rabarar
Copy link
Contributor

rabarar commented Jul 18, 2022 via email

@ZeroChaos-
Copy link
Author

Being able to inject a version by passing it in directly via cmake would be nice as well.

@rabarar
Copy link
Contributor

rabarar commented Jul 19, 2022 via email

@ZeroChaos-
Copy link
Author

Despite it breaking my builds, I thought the idea was great. I really just want a way to pass in the information for when auto extraction fails. Also, it should fall back to the static version tag if the git extraction fails and nothing is passed in via cmake.

@rabarar
Copy link
Contributor

rabarar commented Jul 19, 2022 via email

@ZeroChaos-
Copy link
Author

It's the way the Gentoo package manager works. It is building a git version but it doesn't keep the .git directory while building. So I have the info, but no way to pass it in.

@ZeroChaos-
Copy link
Author

It is also a fatal error for building from a snapshot, or a tag, so if another release ever happens, a lot of people will be compiling without a .git directory.

@ZeroChaos-
Copy link
Author

The git related stuff of this was already fixed, I'm going to open a new bug to cover the other part of the issue which was confused in this issue originally.

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

3 participants