mailio
mailio copied to clipboard
Upload your library to vcpkg?
Hi, long time user Geoffrey here.
How much work would it be to upload your library to vcpkg? That package manager is great at reducing the complexity of deploying things like mailio
Keep up the good work. Geoff.
Hi Geoffrey, Thanks for the suggestion. I could take a look of vcpkg. I am planning to declare version 0.19 these days, so I could deal with the things like package managers. It is included on Arch Linux, so I guess it is feasible.
Hi @karastojko, have you had any time to consider this further?
Hi, I have started to read the documentation, so hopefully would have something to come with.
I have a private (not yet in vcpkg) port: https://github.com/david-antiteum/vcpkg-ports/tree/master/ports/mailio
You will need to change the REPO, REF and SHA512 as it points to my fork of mailio.
Ah! Is a fork because the open issue #28
If you need anything, just let me know.
@david-antiteum Thanks for the vcpkg, I will include it into the project.
@karastojko Better in the vcpkg repo. Having the port in the project is OK but misses the point :)
Hi @david-antiteum ,
Did you manage to setup mailio 64bit on Windows? The Linux 64bit and Windows 32bit versions are compiled and installed without problems. However, by using the --triplet x64-windows
flag I get the LNK2019 error with OpenSSL.
I have not tried 32bit version but it works for me in Windows, Linux (Ubuntu 18/20) and macOS for 64bit. But I´m using a stable version of vcpkg (2020.11-1). Which version are you using? master? Ah! ... static or dynamic build?
How do I use this vcpkg package? I only know how to "vcpkg install mailio"
and doing that says
Error: while loading mailio:
The port directory (D:\vcpkg\ports\mailio) does not exist
Error: failed to load port from D:\vcpkg\ports\mailio
Note: Updating vcpkg by rerunning bootstrap-vcpkg may resolve this failure.
@ga2k mailio is not yet on vcpkg. I will take care next week. Before I will need to fix a few things on this project CMake
@ga2k
Currently, you can make the directory vcpkg\ports\mailio
with the files and everything works fine (tested on Windows 32 and 64bit, as well on Linux). Just make sure that you do not have OpenSSL in the path, vcpkg itself should download it (I had linker errors because of that).
@david-antiteum
Did you have CMake issues with the vcpkg port?
@david-antiteum I have signed the Microsoft CLA, so I will create PR to vcpkg. Since I have started the project before the contract with my current employer, I have put myself as the sole owner (of course the contributors are and will be listed). However, I will check with my employer if there is something else to sign from the legal side, although I do not expect problems since it was part of the contract negotiation.
oops, I make the folder, created those two files, and get this
D:\vcpkg>vcpkg install mailio:x64-windows
Computing installation plan...
The following packages will be built and installed:
mailio[core]:x64-windows -> version_0-19-0#1
Detecting compiler hash for triplet x64-windows...
Could not locate cached archive: C:\Users\geoffrey\AppData\Local\vcpkg\archives\e2\e29d87507ab3f10bf08723de013d7685031b19ff.zip
Starting package 1/1: mailio:x64-windows
Building package mailio[core]:x64-windows...
-- Downloading https://github.com/david-antiteum/mailio/archive/version_0-19-0.tar.gz -> david-antiteum-mailio-version_0-19-0.tar.gz...
CMake Error at scripts/cmake/vcpkg_download_distfile.cmake:105 (message):
File does not have expected hash:
File path: [ D:/vcpkg/downloads/temp/david-antiteum-mailio-version_0-19-0.tar.gz ]
Expected hash: [ 9e488c5d8a08acd0efe1b1e2663d61e9cfb5fae53c12a0f961bc4a849c3ea2771536aed51975117b4d82d964c5ccb81659368ce07147cca3ec1d5a18e6c8a6b0 ]
Actual hash: [ 6589ab434421e08a556a94e24ceb978eb394affe6a79109196bcd38d2900a418a9f10a1af3203350eee85a0a17eee299f0977e4ee77f403ca5e25393e072acf6 ]
So... no success for me.
Should I just change the expected hash value in portfile.cmake?
@ga2k I have created port PR, so perhaps to try these files, they work for me.
Thanks heaps, I’ll give them a try.
From: karastojko @.> Sent: Sunday, 14 March 2021 11:56 PM To: karastojko/mailio @.> Cc: Geoffrey Hoffmann @.>; Mention @.> Subject: Re: [karastojko/mailio] Upload your library to vcpkg? (#39)
@ga2k https://github.com/ga2k I have created port PR https://github.com/microsoft/vcpkg/pull/16696/files , so perhaps to try these files, they work for me.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/karastojko/mailio/issues/39#issuecomment-798912176 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AGDW5FJTLCD74PLJ2AMNZUTTDS6AFANCNFSM4QCPXG6A . https://github.com/notifications/beacon/AGDW5FKNWOX44KVWKU2AAHLTDS6AFA5CNFSM4QCPXG6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOF6PG5MA.gif
Almost there :) You must integrate my changes in CMakeLists.txt or you cannot later found mailio when using: find_package( mailio CONFIG REQUIRED )
I did two changes.
- Export
install(TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}Config LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION ${BIN_INSTALL_DIR} )
+ export(TARGETS ${PROJECT_NAME} FILE ${PROJECT_NAME}Config.cmake)
+ install(EXPORT ${PROJECT_NAME}Config DESTINATION share/${PROJECT_NAME}/cmake)
- Use BUILD_SHARED_LIBS directly (the standard way) instead of MAILIO_BUILD_SHARED_LIBRARY (that vcpkg will not use)
- option(MAILIO_BUILD_SHARED_LIBRARY "Turn on to build mailio as a shared library." ON)
- set(BUILD_SHARED_LIBS ${MAILIO_BUILD_SHARED_LIBRARY})
Ah, and this change too. Required when doing s shared lib build:
- struct content_type_t + struct MAILIO_EXPORT content_type_t
@ga2k I have created port PR, so perhaps to try these files, they work for me.
This works. Thanks a lot.
Can confirm, works. Thank-you for this, much appreciated.
From: Oğuzhan Türk @.> Sent: Friday, 19 March 2021 6:11 PM To: karastojko/mailio @.> Cc: Geoffrey Hoffmann @.>; Mention @.> Subject: Re: [karastojko/mailio] Upload your library to vcpkg? (#39)
@ga2k https://github.com/ga2k I have created port PR https://github.com/microsoft/vcpkg/pull/16696/files , so perhaps to try these files, they work for me.
This works. Thanks a lot.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/karastojko/mailio/issues/39#issuecomment-802637760 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AGDW5FKY4MRMWDAXX3QFMQ3TEMBIXANCNFSM4QCPXG6A . https://github.com/notifications/beacon/AGDW5FOSGAHD434KC7O25BLTEMBIXA5CNFSM4QCPXG6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOF7LUPQA.gif
The port is now part of Vcpkg, no need to copy these scripts anymore.
@david-antiteum I have added you to the contributors, and will further integrate the proposed changes.
Almost there :) You must integrate my changes in CMakeLists.txt or you cannot later found mailio when using: find_package( mailio CONFIG REQUIRED )
I did two changes.
- Export
install(TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Config LIBRARY DESTINATION ${LIB_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION ${BIN_INSTALL_DIR} )
export(TARGETS ${PROJECT_NAME} FILE ${PROJECT_NAME}Config.cmake)
install(EXPORT ${PROJECT_NAME}Config DESTINATION share/${PROJECT_NAME}/cmake)
- Use BUILD_SHARED_LIBS directly (the standard way) instead of MAILIO_BUILD_SHARED_LIBRARY (that vcpkg will not use)
option(MAILIO_BUILD_SHARED_LIBRARY "Turn on to build mailio as a shared library." ON)
set(BUILD_SHARED_LIBS ${MAILIO_BUILD_SHARED_LIBRARY})
Still can't use by find_package() with vcpkg. Showing:
CMake Error at C:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake:861 (_find_package): Could not find a package configuration file provided by "mailio" with any of the following names:
mailioConfig.cmake
mailio-config.cmake
Add the installation prefix of "mailio" to CMAKE_PREFIX_PATH or set "mailio_DIR" to a directory containing one of the above files. If "mailio" provides a separate development package or SDK, be sure it has been installed. Call Stack (most recent call first): CMakeLists.txt:23 (find_package)
Still can't use by find_package() with vcpkg. Showing:
Same here.
What version of the port are you using? What is your triplet?
Works for me on Windows, Linux and macOS with version 0.20.0
and port version 1
. I'm using this lines:
find_package( mailio CONFIG REQUIRED )
target_link_libraries(main PRIVATE mailio)
vcpkg shows an incorrect name in the instructions after doing vcpkg install mailio
(cmake instead of mailio) but works using the correct name.
Hi David, ya I'm using 0.20.0 and port 1 with x64-windows.
I think this pastebin shows all of what I'm doing so hopefully the problem is easy to spot. I came to this library because of it's integration with vcpkg. https://pastebin.com/raw/smmH3XNa
Hi James,
I'm using Visual 2019 in Windows but the problem seems in CMake. Which version of CMake are you using? I'm using 3.21.3.
But ... looking at pastebin I can see:
-DCMAKE_TOOLCHAIN_FILE:STRING=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
and then:
CMake Error at C:/dev/scripts/buildsystems/vcpkg.cmake:788
Two vcpkg.cmake in different locations.... Maybe this is the error.
Hi David, Try this demo project It includes vcpkg as a submodule with an automatically package installing mechanic. Just try CMake it, and you will get the following not found message:
CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:793 (_find_package):
Could not find a package configuration file provided by "mailio" with any
of the following names:
mailioConfig.cmake
mailio-config.cmake
Add the installation prefix of "mailio" to CMAKE_PREFIX_PATH or set
"mailio_DIR" to a directory containing one of the above files. If "mailio"
provides a separate development package or SDK, be sure it has been
installed.
I've tryed other vcpkg packages and they works fine.
Hi David, Try this demo project It includes vcpkg as a submodule with an automatically package installing mechanic. Just try CMake it, and you will get the following not found message:
CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:793 (_find_package): Could not find a package configuration file provided by "mailio" with any of the following names: mailioConfig.cmake mailio-config.cmake Add the installation prefix of "mailio" to CMAKE_PREFIX_PATH or set "mailio_DIR" to a directory containing one of the above files. If "mailio" provides a separate development package or SDK, be sure it has been installed.
I've tryed other vcpkg packages and they works fine.
Also had same poblem like this.
Temporary fix is, do install with vcpkg install mailio
then clone this repo and build plus install to where your vcpkg
installed directory.
sudo cmake -G "Ninja" -DCMAKE_INSTALL_PREFIX=/home/<USERNAME>/vcpkg/installed/x64-linux -DCMAKE_PREFIX_PATH=/home/prg/vcpkg/installed/x64-linux -DCMAKE_BUILDTYPE=Release ..
&&
sudo cmake --build . && sudo cmake --install .
NOTE: don't forget to add
find_package(mailio CONFIG REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE mailio)
to your cmake project.
also check installed dependencies for mailio
Tested on Debian 11 WSL2
Having the same problems here. I guess the problem is that the current vcpkg port is linked to version 0.20.0 but version 0.21.0 is the one that generates the mailioConfig.cmake file during the installation.
Ah! I have found something. First I was unable to reproduce the issue because I was using a private port :) After deactivating my copy I was able to reproduce the original error. As the official vcpkg port uses version 0.20, I have tried to use version 0.21 but there is another error.
Summary:
- official vcpkg port fails with version 0.20 as reported here
- changing the port to use version 0.21 fails too because, in debug, it adds the wrong include folder
I will try to fix the port but seems that mail has a problem when generating the config files.
@karastojko The option MAILIO_BUILD_SHARED_LIBRARY is no longer available. This means that mailio is always build as a static library?
This option no longer has effect:
-DMAILIO_BUILD_SHARED_LIBRARY=${BUILD_SHARED}
While waiting for @karastojko and my question for MAILIO_BUILD_SHARED_LIBRARY. find attached my port modifications.
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO karastojko/mailio
REF cc887a7808d9c55e07c8a7503c7ae2e2d7485120 # version_0-21-0
SHA512 7125bfe4274e1e126e335b2e4b5743ef54d5dc0b6fd83f0c10e7578b57924d3e398af6b3865fdee3de587e2e2d7c33d95dbe017b1966649e68cf52f2dd268ee5
HEAD_REF master
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" BUILD_SHARED)
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DMAILIO_BUILD_SHARED_LIBRARY=${BUILD_SHARED}
-DMAILIO_BUILD_DOCUMENTATION=OFF
-DMAILIO_BUILD_EXAMPLES=OFF
)
vcpkg_cmake_install()
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
{
"name": "mailio",
"version": "0.21.0",
"port-version": 2,
"maintainers": "Tomislav Karastojković <[email protected]>",
"description": "mailio is a cross platform C++ library for MIME format and SMTP, POP3 and IMAP protocols. It is based on the standard C++ 17 and Boost library.",
"homepage": "https://github.com/karastojko/mailio",
"license": "BSD-2-Clause",
"supports": "!uwp",
"dependencies": [
"boost-asio",
"boost-date-time",
"boost-regex",
"boost-system",
"openssl",
{
"name": "vcpkg-cmake",
"host": true
}
]
}