-
Notifications
You must be signed in to change notification settings - Fork 191
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
can't get boost asio working #356
Comments
I managed to get boost asio working in the end, I had to add this in my cmake:
|
I've made this to use standalone asio: asio.cmake set(ASIO_REPOSITORY
"https://github.com/chriskohlhoff/asio"
CACHE STRING "Repository of asio"
)
set(ASIO_TAG
"asio-1-18-2"
CACHE STRING "Git tag of asio"
)
set(ASIOCMAKE_REPOSITORY
"https://github.com/OlivierLDff/asio.cmake"
CACHE STRING "Repository of asio.cmake"
)
set(ASIOCMAKE_TAG
"v1.1.1"
CACHE STRING "Git tag of asio.cmake"
)
include(cmake/CPM.cmake)
CPMAddPackage(
NAME asiocmake
GIT_REPOSITORY ${ASIOCMAKE_REPOSITORY}
GIT_TAG ${ASIOCMAKE_TAG}
OPTIONS "ASIO_USE_CPM ON"
) |
The fasted way I know to build boost is to use # ---- Add dependencies via CPM ----
# see https://github.com/cpm-cmake/CPM.cmake for more info
include(cmake/CPM.cmake)
# PackageProject.cmake will be used to make our target installable
CPMAddPackage("gh:TheLartians/[email protected]")
if(EXISTS "$ENV{HOME}/.cache/CPM/boost_1_79_0")
set(FETCHCONTENT_SOURCE_DIR_BOOST "$ENV{HOME}/.cache/CPM/boost_1_79_0" CACHE PATH "Boost source DIR")
endif()
CPMAddPackage(
NAME boost-cmake GITHUB_REPOSITORY ClausKlein/boost-cmake
GIT_TAG b7c741f42b089117221622c72783d2cb821843dc # feature/upgrade-to-boost-v1.79-0
)
target_link_libraries(
tftpd PUBLIC Boost::filesystem Boost::boost
)
# ... Note:
bash-3.2$ make distclean
rm -rf ../.build-netkit-tftp-Debug .configure-Debug compile_commands.json *~ .*~ tags
find . -name '*~' -delete
bash-3.2$ time make
mkdir -p ../.build-netkit-tftp-Debug
cd ../.build-netkit-tftp-Debug && cmake -G Ninja -Wdeprecated -Wdev \
-DUSE_LCOV=OFF -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_PREFIX_PATH="/usr/local;/usr/local;/usr" \
-DCMAKE_STAGING_PREFIX=/usr/local \
-DCMAKE_MODULE_PATH=/Users/clausklein/Workspace/cmake \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=c++ /Users/clausklein/Workspace/cpp/netkit-tftp
-- use ccache
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/local/bin/git (found version "2.36.1")
-- CPM: adding package [email protected] (v1.9.0 at /Users/clausklein/.cache/CPM/packageproject.cmake/e3848b31ae54d78683c7e47eb420383f05024bdf)
-- The C compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Fetching Boost
-- Fetching Boost - done
-- Boost found: 1.79.0 /Users/clausklein/.cache/CPM/boost_1_79_0
-- Looking for __linux__
-- Looking for __linux__ - not found
-- Looking for _WIN32
-- Looking for _WIN32 - not found
-- Looking for __APPLE__
-- Looking for __APPLE__ - found
-- Looking for __ANDROID__
-- Looking for __ANDROID__ - not found
-- Looking for __FreeBSD__
-- Looking for __FreeBSD__ - not found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Found BZip2: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/lib/libbz2.tbd (found version "1.0.8")
-- Looking for BZ2_bzCompressInit
-- Looking for BZ2_bzCompressInit - found
-- Found ZLIB: /usr/local/lib/libz.dylib (found version "1.2.11.1")
-- Found the following ICU libraries:
-- uc (required)
-- dt (required)
-- i18n (required)
-- Failed to find all ICU components (missing: ICU_LIBRARY) (found version "70.1")
-- Found iconv library: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/lib/libiconv.tbd
-- CPM: adding package boost-cmake@0 (b7c741f42b089117221622c72783d2cb821843dc at /Users/clausklein/.cache/CPM/boost-cmake/7554d4bef168447f7af609d08f14400b5f978434)
-- CPM: adding package asio@0 (fea320c422a5de8d2c48cd02ae42e6251acf0030 at /Users/clausklein/.cache/CPM/asio/94e352fdf00c46cd2003e0c20605ad11b336d4ed)
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
USE_LCOV
-- Build files have been written to: /Users/clausklein/Workspace/cpp/.build-netkit-tftp-Debug
touch .configure-Debug
ln -sf /Users/clausklein/Workspace/cpp/netkit-tftp/../.build-netkit-tftp-Debug/compile_commands.json .
cmake --build ../.build-netkit-tftp-Debug
[17/20] Linking CXX static library lib/libboost_filesystem.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: lib/libboost_filesystem.a(windows_file_codecvt.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: lib/libboost_filesystem.a(windows_file_codecvt.o) has no symbols
[20/20] Linking CXX executable bin/tftpd_test
real 0m4.836s
user 0m2.103s
sys 0m1.825s
bash-3.2$ |
#501 here's working example with boost |
@cambp4 Is this still an issue? Do examples in the latest release correct the problem for you? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I'm trying to get boost asio working. I tried setting it up with the examples you gave. I tried with boost and with the asio standalone, none of which work.
It seems like cmake is downloading and putting things in my build folder, I can see folders related to boost or asio.
However when I compile a simple project that requires
I cannot compile it because it can't find boost asio.
this is my cmake
The text was updated successfully, but these errors were encountered: