• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

TFS 1.X+ TFS 1.4 (upgraded) Compilation link error CryptoPP

Itutorial

Legendary OT User
Joined
Dec 23, 2014
Messages
2,461
Solutions
68
Reaction score
1,123
I don't know how I run into these problems. I have been compiling my server for a long...long time. Today, I am randomly getting this error:

1767409312781.webp

I am using vcpkg and have not updated or changed it.
1767409351836.webp

I just can't make sense of it. I am compiling x64 release. I updated the CMakeLists.txt file but only after I started getting this error. Does anyone have any ideas on what I can do. The linker problem is for cryptopp.

Code:
cmake_minimum_required(VERSION 3.16)

# ------------------------------------------------------------------------------
# Project
# ------------------------------------------------------------------------------
project(tfs LANGUAGES CXX)

# ------------------------------------------------------------------------------
# Global settings
# ------------------------------------------------------------------------------
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

# ------------------------------------------------------------------------------
# vcpkg triplet handling (must be before project() in older setups, but OK here)
# ------------------------------------------------------------------------------
if (DEFINED ENV{VCPKG_DEFAULT_TRIPLET} AND NOT DEFINED VCPKG_TARGET_TRIPLET)
    set(VCPKG_TARGET_TRIPLET "$ENV{VCPKG_DEFAULT_TRIPLET}"
        CACHE STRING "The vcpkg triplet")
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

# ------------------------------------------------------------------------------
# Compiler warnings / flags
# ------------------------------------------------------------------------------
if (NOT WIN32)
    add_compile_options(
        -Wall
        -Wextra
        -Wnon-virtual-dtor
        -Wold-style-cast
        -pedantic
        -Werror
        -pipe
        -fvisibility=hidden
    )
endif()

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
    add_compile_options(-fno-strict-aliasing)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
    add_compile_options(-Wimplicit-fallthrough -Wmove)
endif()

# ------------------------------------------------------------------------------
# Dependencies (vcpkg-first, target-based)
# ------------------------------------------------------------------------------

# Crypto++ (vcpkg)
find_package(CryptoPP QUIET)
if (CryptoPP_FOUND)  # vcpkg-provided cmake package called CryptoPP
    set(Crypto++_LIBRARIES "cryptopp-static")
else()
    find_package(Crypto++ REQUIRED)
endif ()

# fmt
find_package(fmt CONFIG REQUIRED)

# MariaDB / MySQL
find_package(unofficial-libmariadb CONFIG QUIET)
if (unofficial-libmariadb_FOUND)
    set(MYSQL_CLIENT_TARGET unofficial::libmariadb)
else()
    find_package(MySQL REQUIRED)
    set(MYSQL_CLIENT_TARGET MySQL::MySQL)
endif()

# Threads
find_package(Threads REQUIRED)

# PugiXML
find_package(PugiXML CONFIG REQUIRED)

# Lua / LuaJIT
option(USE_LUAJIT "Use LuaJIT" ON)

if (USE_LUAJIT)
    find_package(LuaJIT REQUIRED)
    set(LUA_TARGET LuaJIT::LuaJIT)
else()
    find_package(Lua REQUIRED)
    set(LUA_TARGET Lua::Lua)
endif()

# Boost
find_package(Boost 1.85 REQUIRED
    COMPONENTS system iostreams locale date_time filesystem
)

# ------------------------------------------------------------------------------
# Subdirectories / targets
# ------------------------------------------------------------------------------
add_subdirectory(src)

add_executable(tfs ${tfs_MAIN})
target_link_libraries(tfs
    PRIVATE
        tfslib
        cryptopp::cryptopp
        fmt::fmt
        ${MYSQL_CLIENT_TARGET}
        Threads::Threads
        PugiXML::PugiXML
        ${LUA_TARGET}
        Boost::system
        Boost::iostreams
        Boost::locale
)

# ------------------------------------------------------------------------------
# IPO / LTO
# ------------------------------------------------------------------------------
cmake_policy(SET CMP0069 NEW)
include(CheckIPOSupported)

check_ipo_supported(RESULT ipo_supported OUTPUT ipo_error)
if (ipo_supported)
    message(STATUS "IPO / LTO enabled")
    set_target_properties(tfs PROPERTIES INTERPROCEDURAL_OPTIMIZATION ON)
else()
    message(STATUS "IPO / LTO not supported: ${ipo_error}")
endif()

# ------------------------------------------------------------------------------
# Precompiled headers
# ------------------------------------------------------------------------------
target_precompile_headers(tfs PRIVATE src/otpch.h)

1767413779004.webp
 
Last edited:
Generally, I don't use the 'vcpkg integrate install' command because many projects have different versions of libraries, which causes the compiler to automatically search for and install the libraries.

I use static libraries, download a separate version of vcpkg without using the integrate install command, then place two in vc1x/ "Directory.Build.props" and "Directory.Build.targets" files in the project pointing to which vcpkg i will use for a project.
ex:
XML:
<?xml version="1.0" encoding="utf-8"?>
<Project>
    <Import Project="H:\Projects\vcpkg-boost178\scripts\buildsystems\msbuild\vcpkg.props" />
</Project>
XML:
<?xml version="1.0" encoding="utf-8"?>
<Project>
    <Import Project="H:\Projects\vcpkg-boost178\scripts\buildsystems\msbuild\vcpkg.targets" />
</Project>


You don't need to use CMake.txt when using vcpkg, so try checking if vcpkg has cryptopp!
 
Generally, I don't use the 'vcpkg integrate install' command because many projects have different versions of libraries, which causes the compiler to automatically search for and install the libraries.

I use static libraries, download a separate version of vcpkg without using the integrate install command, then place two in vc1x/ "Directory.Build.props" and "Directory.Build.targets" files in the project pointing to which vcpkg i will use for a project.
ex:
XML:
<?xml version="1.0" encoding="utf-8"?>
<Project>
    <Import Project="H:\Projects\vcpkg-boost178\scripts\buildsystems\msbuild\vcpkg.props" />
</Project>
XML:
<?xml version="1.0" encoding="utf-8"?>
<Project>
    <Import Project="H:\Projects\vcpkg-boost178\scripts\buildsystems\msbuild\vcpkg.targets" />
</Project>


You don't need to use CMake.txt when using vcpkg, so try checking if vcpkg has cryptopp!
I am certain cryptopp is installed with vcpkg. It was working a couple days ago and I haven't removed, installed, or updated anything in vcpkg. I tried adding those files and it didn't change anything. I am lost. I updated my post above with an image showing that cryptopp.lib is included in the vcpkg libs. It's driving me crazy.
Post automatically merged:

Okay, I figured it out. For some reason visual studio was showing that vcpkg manifest install was false but the vcxproj file set it to true. After setting it to false everything linked correctly. Idk wtf caused this.

Code:
<PropertyGroup Label="Vcpkg">
    <VcpkgEnableManifest>false</VcpkgEnableManifest>
    <VcpkgEnabled>true</VcpkgEnabled>
    <VcpkgManifestInstall>false</VcpkgManifestInstall>
  </PropertyGroup>
 
Last edited:
Back
Top