Comments (39)
vcpkg updates are live now for version 0.21.0.
from mailio.
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})
from mailio.
An update in this issue. I have a PR open (microsoft/vcpkg#23799) that solves the problem. Should be merge any day now.
from mailio.
@karastojko Better in the vcpkg repo. Having the port in the project is OK but misses the point :)
from mailio.
Ah, and this change too. Required when doing s shared lib build:
- struct content_type_t
+ struct MAILIO_EXPORT content_type_t
from mailio.
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)
from mailio.
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
from mailio.
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.
from mailio.
No, my bad (and my lack of memory). Sorry. I will open a PR in vcpkg with the latest changes
from mailio.
Done. vcpkg updated.
from mailio.
Finally, I've found the correct sequence of -libs for my project:
g++ ./main.o -o ./a.out -pthread -lboost_system -lboost_date_time -lmailio -lrt -lcrypto -lssl -lboost_regex
Thanks for hint!
from mailio.
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.
from mailio.
Hi @karastojko, have you had any time to consider this further?
from mailio.
Hi, I have started to read the documentation, so hopefully would have something to come with.
from mailio.
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.
from mailio.
@david-antiteum
Thanks for the vcpkg, I will include it into the project.
from mailio.
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.
from mailio.
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?
from mailio.
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.
from mailio.
@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
from mailio.
@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.
from mailio.
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?
from mailio.
@ga2k
I have created port PR, so perhaps to try these files, they work for me.
from mailio.
from mailio.
@ga2k
I have created port PR, so perhaps to try these files, they work for me.
This works. Thanks a lot.
from mailio.
from mailio.
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.
from mailio.
Still can't use by find_package() with vcpkg. Showing:
Same here.
from mailio.
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.
from mailio.
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
from mailio.
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.
from mailio.
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.
from mailio.
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.
from mailio.
@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}
from mailio.
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
}
]
}
from mailio.
@david-antiteum
The option is removed with this commit from you. Do you need it back for the Vcpkg?
from mailio.
Now find_package()
can execute correctly. However the hint message after installing from vcpkg has a small issue:
...
The package mailio provides CMake targets:
find_package(cmake CONFIG REQUIRED)
target_link_libraries(main PRIVATE mailio)
...
The package name somehow appears to be cmake
instead of mailio
.
from mailio.
Hi! Why I may have problem when linking on my Raspbian Bullseye:
g++ main.o -pthread -lrt -L /usr/local/lib -lmailio -lboost_system -lssl -lcrypto
Output:
/usr/bin/ld: main.o: in function boost::system::error_category::std_category::equivalent(int, std::error_condition const&) const': main.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition[_ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition]+0xcc): undefined reference to
boost::system::generic_category()'
/usr/bin/ld: main.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition[_ZNK5boost6system14error_category12std_category10equivalentEiRKSt15error_condition]+0x10c): undefined reference to boost::system::generic_category()' /usr/bin/ld: main.o: in function
boost::system::error_category::std_category::equivalent(std::error_code const&, int) const':
main.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0xc8): undefined reference to boost::system::generic_category()' /usr/bin/ld: main.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0x108): undefined reference to
boost::system::generic_category()'
/usr/bin/ld: main.cpp:(.text._ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei[_ZNK5boost6system14error_category12std_category10equivalentERKSt10error_codei]+0x1ec): undefined reference to `boost::system::generic_category()'
from mailio.
@Alx-prog
Here is the command I am using to compile an example on Linux:
g++ -std=c++17 -I ./include/ -I /opt/boost-1.75.0/include/ -L ./build/ -L /opt/boost-1.75.0/lib/ -L /usr/lib/x86_64-linux-gnu/ ./test/message.cpp -o ./test/message -lboost_system -lboost_regex -lboost_date_time -lboost_unit_test_framework -lpthread -lcrypto -lssl -lmailio
Maybe linking of boost_regex and boost_date_time helps.
from mailio.
Related Issues (20)
- Missing version.hpp during installation HOT 7
- Add vcpkg manifest support HOT 3
- Problems compiling the example code with CMake HOT 1
- IMAP(Switching to SSL failed.) HOT 2
- IMAP list folder, encoding error ? HOT 12
- Switching to SSL failed HOT 8
- send imap quoted string HOT 9
- imap fetch command response parsing HOT 2
- parsing imap quoted string HOT 2
- segmentation fault in imap fetch function
- parsing imap resp-text
- [Question] Image in the body of the message HOT 10
- Please, could anyone provide me an example of how to get the mail content as a unencoded string? HOT 2
- Linking errors HOT 11
- Is it ok to use `-std=c++17` instead of `-std=gnu++1z` HOT 1
- smtps::connection::submit response HOT 2
- add_bcc_recipient HOT 8
- Switching to SSL failed HOT 6
- Parsing failure. HOT 8
- Allow formatting of BCC addresses HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mailio.