Skip to content

Corrections for operating systems with case-sensitive filesystems.#264

Merged
jhs507 merged 5 commits intomasterfrom
linux_build_cleanup
Mar 24, 2022
Merged

Corrections for operating systems with case-sensitive filesystems.#264
jhs507 merged 5 commits intomasterfrom
linux_build_cleanup

Conversation

@lawfordp2017
Copy link
Collaborator

@lawfordp2017 lawfordp2017 commented Mar 23, 2022

Also added libfmt library requirement.

These changes are because I had some issues with building using cmake under linux. I'm not familiar with cmake so these changes may not be the correct strategy, particularly when adding the libfmt library. Also, please note that I made a change to the wiki to suggest building on Linux without requiring superuser, which is important for ComputeCanada clusters. Installing the spdlog library system-wide is probably not necessary in any case, if you're just static linking.

@jhs507
Copy link
Collaborator

jhs507 commented Mar 23, 2022

Thanks for this Peter,

Your change to the wiki is actually just a better way to run the build so I will update it so that your version is the standard. I didn't like having to use super user permissions for the build step just hadn't had time to find a workaround.

I am surprised that the case sensitivity wasn't already causing problems on my Ubuntu build. Thanks for catching that.

As far as adding the libfmt library, what version of Linux are you using that requires it?

@jhs507 jhs507 self-assigned this Mar 23, 2022
@jhs507 jhs507 self-requested a review March 23, 2022 18:00
@lawfordp2017
Copy link
Collaborator Author

lawfordp2017 commented Mar 23, 2022

I'm on Ubuntu jammy (22.04) but I've had to add libfmt for every version even when I was on (21.10) and (21.04), usually as a -lfmt flag in makefile.

@jhs507
Copy link
Collaborator

jhs507 commented Mar 23, 2022

Could you post the error you get when trying to compile without adding it?

@lawfordp2017
Copy link
Collaborator Author

It seems that my suggestion of changing STAGING_AREA is insufficient. I have libspdlog-dev package and libfmt-dev package installed, but the libspdlog-dev package requires libfmt statically linked rather than using templates. I suppose that if spdlog is downloaded and recompiled it will use templates, but when I change STAGING_AREA it seems to override the local spdlog and use the system-wide spdlog instead.

If I remove spdlog-dev and include STAGING_AREA=. I get this error:

[ 42%] Building CXX object core/CMakeFiles/core.dir/Administer.cpp.o
[ 42%] Building CXX object core/CMakeFiles/core.dir/ClassClark.cpp.o
[ 43%] Building CXX object core/CMakeFiles/core.dir/ClassCRHM.cpp.o
In file included from /home/user/crhm_cleanup/crhmcode/crhmcode/src/core/ClassCRHM.cpp:16:
/home/user/crhm_cleanup/crhmcode/crhmcode/src/core/CRHMLogger.h:5:10: fatal error: spdlog/spdlog.h: No such file or directory
    5 | #include "spdlog/spdlog.h"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [core/CMakeFiles/core.dir/build.make:104: core/CMakeFiles/core.dir/ClassCRHM.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:269: core/CMakeFiles/core.dir/all] Error 2
make: *** [Makefile:156: all] Error 2

If I have the libspdlog-dev and libfmt-dev packages installed I but remove the target_link_library get this error:

[ 99%] Building CXX object modules/CMakeFiles/modules.dir/ClassXG.cpp.o
[ 99%] Building CXX object modules/CMakeFiles/modules.dir/ClassXGAyers.cpp.o
[ 99%] Built target modules
[100%] Building CXX object CMakeFiles/crhm.dir/main.cpp.o
[100%] Linking CXX executable crhm
/usr/bin/ld: CMakeFiles/crhm.dir/main.cpp.o: in function `void fmt::v8::detail::buffer<char>::append<char>(char const*, char const*) [clone .constprop.0]':
main.cpp:(.text+0x23e): undefined reference to `fmt::v8::detail::assert_fail(char const*, int, char const*)'
/usr/bin/ld: CMakeFiles/crhm.dir/main.cpp.o: in function `spdlog::pattern_formatter::format(spdlog::details::log_msg const&, fmt::v8::basic_memory_buffer<char, 250ul, std::allocator<char> >&)':
main.cpp:(.text._ZN6spdlog17pattern_formatter6formatERKNS_7details7log_msgERN3fmt2v819basic_memory_bufferIcLm250ESaIcEEE[_ZN6spdlog17pattern_formatter6formatERKNS_7details7log_msgERN3fmt2v819basic_memory_bufferIcLm250ESaIcEEE]+0x1cb): undefined reference to `fmt::v8::detail::assert_fail(char const*, int, char const*)'
/usr/bin/ld: CMakeFiles/crhm.dir/main.cpp.o: in function `spdlog::sinks::ansicolor_sink<spdlog::details::console_mutex>::log(spdlog::details::log_msg const&)':
main.cpp:(.text._ZN6spdlog5sinks14ansicolor_sinkINS_7details13console_mutexEE3logERKNS2_7log_msgE[_ZN6spdlog5sinks14ansicolor_sinkINS_7details13console_mutexEE3logERKNS2_7log_msgE]+0x467): undefined reference to `fmt::v8::detail::assert_fail(char const*, int, char const*)'
/usr/bin/ld: CMakeFiles/crhm.dir/main.cpp.o: in function `spdlog::logger::sink_it_(spdlog::details::log_msg const&)':
main.cpp:(.text._ZN6spdlog6logger8sink_it_ERKNS_7details7log_msgE[_ZN6spdlog6logger8sink_it_ERKNS_7details7log_msgE]+0x57c): undefined reference to `fmt::v8::detail::assert_fail(char const*, int, char const*)'
/usr/bin/ld: CMakeFiles/crhm.dir/main.cpp.o: in function `fmt::v8::detail::for_each_codepoint<fmt::v8::detail::compute_width(fmt::v8::basic_string_view<char>)::count_code_points>(fmt::v8::basic_string_view<char>, fmt::v8::detail::compute_width(fmt::v8::basic_string_view<char>)::count_code_points)::{lambda(char const*, char const*)#1}::operator()(char const*, char const*) const':
main.cpp:(.text._ZZN3fmt2v86detail18for_each_codepointIZNS1_13compute_widthENS0_17basic_string_viewIcEEE17count_code_pointsEEvS4_T_ENKUlPKcS8_E_clES8_S8_[_ZZN3fmt2v86detail18for_each_codepointIZNS1_13compute_widthENS0_17basic_string_viewIcEEE17count_code_pointsEEvS4_T_ENKUlPKcS8_E_clES8_S8_]+0x266): undefined reference to `fmt::v8::detail::assert_fail(char const*, int, char const*)'
/usr/bin/ld: CMakeFiles/crhm.dir/main.cpp.o:main.cpp:(.text._ZN3fmt2v86detail6bufferIcE6appendIcEEvPKT_S7_[_ZN3fmt2v86detail6bufferIcE6appendIcEEvPKT_S7_]+0xbc): more undefined references to `fmt::v8::detail::assert_fail(char const*, int, char const*)' follow
/usr/bin/ld: CMakeFiles/crhm.dir/main.cpp.o: in function `int fmt::v8::detail::get_dynamic_spec<fmt::v8::detail::width_checker, fmt::v8::basic_format_arg<fmt::v8::basic_format_context<fmt::v8::appender, char> >, fmt::v8::detail::error_handler>(fmt::v8::basic_format_arg<fmt::v8::basic_format_context<fmt::v8::appender, char> >, fmt::v8::detail::error_handler)':
main.cpp:(.text._ZN3fmt2v86detail16get_dynamic_specINS1_13width_checkerENS0_16basic_format_argINS0_20basic_format_contextINS0_8appenderEcEEEENS1_13error_handlerEEEiT0_T1_[_ZN3fmt2v86detail16get_dynamic_specINS1_13width_checkerENS0_16basic_format_argINS0_20basic_format_contextINS0_8appenderEcEEEENS1_13error_handlerEEEiT0_T1_]+0x57): undefined reference to `fmt::v8::detail::error_handler::on_error(char const*)'
/usr/bin/ld: main.cpp:(.text._ZN3fmt2v86detail16get_dynamic_specINS1_13width_checkerENS0_16basic_format_argINS0_20basic_format_contextINS0_8appenderEcEEEENS1_13error_handlerEEEiT0_T1_[_ZN3fmt2v86detail16get_dynamic_specINS1_13width_checkerENS0_16basic_format_argINS0_20basic_format_contextINS0_8appenderEcEEEENS1_13error_handlerEEEiT0_T1_]+0x93): undefined reference to `fmt::v8::detail::error_handler::on_error(char const*)'
/usr/bin/ld: main.cpp:(.text._ZN3fmt2v86detail16get_dynamic_specINS1_13width_checkerENS0_16basic_format_argINS0_20basic_format_contextINS0_8appenderEcEEEENS1_13error_handlerEEEiT0_T1_[_ZN3fmt2v86detail16get_dynamic_specINS1_13width_checkerENS0_16basic_format_argINS0_20basic_format_contextINS0_8appenderEcEEEENS1_13error_handlerEEEiT0_T1_]+0xa4): undefined reference to `fmt::v8::detail::error_handler::on_error(char const*)'
/usr/bin/ld: CMakeFiles/crhm.dir/main.cpp.o: in function `int fmt::v8::detail::get_dynamic_spec<fmt::v8::detail::precision_checker, fmt::v8::basic_format_arg<fmt::v8::basic_format_context<fmt::v8::appender, char> >, fmt::v8::detail::error_handler>(fmt::v8::basic_format_arg<fmt::v8::basic_format_context<fmt::v8::appender, char> >, fmt::v8::detail::error_handler)':

and a bunch more.

@jhs507
Copy link
Collaborator

jhs507 commented Mar 23, 2022

When I compile on Ubuntu (18.04) with the line you added to include fmt and using STAGING_DIR=. I get this error message. Looks like it causes it to look for fmt in the wrong place on my system.

/usr/bin/ld: cannot find -lfmt
collect2: error: ld returned 1 exit status
CMakeFiles/crhm.dir/build.make:482: recipe for target 'crhm' failed
make[2]: *** [crhm] Error 1
CMakeFiles/Makefile2:73: recipe for target 'CMakeFiles/crhm.dir/all' failed
make[1]: *** [CMakeFiles/crhm.dir/all] Error 2
Makefile:151: recipe for target 'all' failed
make: *** [all] Error 2

If I remove the line but use STAGING_DIR=. I am able to compile without super user permissions.

Did you use the git submodule for spdlog when building?

@lawfordp2017
Copy link
Collaborator Author

I had followed the step 5:
Initialize the spdlog submodule by running the commands git submodule init and git submodule update
but when I run cmake and then make it isn't putting the spdlog headers in ${STAGING_DIR}/include/, only in core/spdlog/src/spdlog-build/
I added different include paths which is working on my system.

@jhs507
Copy link
Collaborator

jhs507 commented Mar 24, 2022

The changes you have made work on my system too. I am good to merge this and revert the change to the wiki as the staging dir is hard coded in now.

@jhs507 jhs507 merged commit 19bfee9 into master Mar 24, 2022
jhs507 pushed a commit that referenced this pull request May 3, 2022
)

* Corrections for operating systems with case-sensitive filesystems.
Also added libfmt library requirement.

* Update to install script to use STAGING_DIR allowing for build without super user permission.

* Attempt to resolve missing include for spdlog on my system

* Hardcode staging_dir

* Fix commenting
@jhs507 jhs507 deleted the linux_build_cleanup branch May 26, 2022 16:38
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

Successfully merging this pull request may close these issues.

2 participants