Coder Social home page Coder Social logo

Comments (39)

david-antiteum avatar david-antiteum commented on May 13, 2024 3

vcpkg updates are live now for version 0.21.0.

from mailio.

david-antiteum avatar david-antiteum commented on May 13, 2024 2

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.

  1. 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)

  1. 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.

david-antiteum avatar david-antiteum commented on May 13, 2024 2

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.

david-antiteum avatar david-antiteum commented on May 13, 2024 1

@karastojko Better in the vcpkg repo. Having the port in the project is OK but misses the point :)

from mailio.

david-antiteum avatar david-antiteum commented on May 13, 2024 1

Ah, and this change too. Required when doing s shared lib build:

- struct content_type_t
+ struct MAILIO_EXPORT content_type_t

from mailio.

ParticleG avatar ParticleG commented on May 13, 2024 1

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.

  1. 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)

  1. 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.

prothegee avatar prothegee commented on May 13, 2024 1

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.

david-antiteum avatar david-antiteum commented on May 13, 2024 1

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.

david-antiteum avatar david-antiteum commented on May 13, 2024 1

No, my bad (and my lack of memory). Sorry. I will open a PR in vcpkg with the latest changes

from mailio.

david-antiteum avatar david-antiteum commented on May 13, 2024 1

Done. vcpkg updated.

from mailio.

Alx-prog avatar Alx-prog commented on May 13, 2024 1

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.

karastojko avatar karastojko commented on May 13, 2024

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.

ga2k avatar ga2k commented on May 13, 2024

Hi @karastojko, have you had any time to consider this further?

from mailio.

karastojko avatar karastojko commented on May 13, 2024

Hi, I have started to read the documentation, so hopefully would have something to come with.

from mailio.

david-antiteum avatar david-antiteum commented on May 13, 2024

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.

karastojko avatar karastojko commented on May 13, 2024

@david-antiteum
Thanks for the vcpkg, I will include it into the project.

from mailio.

karastojko avatar karastojko commented on May 13, 2024

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.

david-aimsun avatar david-aimsun commented on May 13, 2024

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.

ga2k avatar ga2k commented on May 13, 2024

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.

david-antiteum avatar david-antiteum commented on May 13, 2024

@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.

karastojko avatar karastojko commented on May 13, 2024

@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.

ga2k avatar ga2k commented on May 13, 2024

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.

karastojko avatar karastojko commented on May 13, 2024

@ga2k
I have created port PR, so perhaps to try these files, they work for me.

from mailio.

ga2k avatar ga2k commented on May 13, 2024

from mailio.

TaeZStkyoht avatar TaeZStkyoht commented on May 13, 2024

@ga2k
I have created port PR, so perhaps to try these files, they work for me.

This works. Thanks a lot.

from mailio.

ga2k avatar ga2k commented on May 13, 2024

from mailio.

karastojko avatar karastojko commented on May 13, 2024

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.

jameswdelancey avatar jameswdelancey commented on May 13, 2024

Still can't use by find_package() with vcpkg. Showing:

Same here.

from mailio.

david-antiteum avatar david-antiteum commented on May 13, 2024

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.

jameswdelancey avatar jameswdelancey commented on May 13, 2024

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.

david-antiteum avatar david-antiteum commented on May 13, 2024

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.

ParticleG avatar ParticleG commented on May 13, 2024

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.

xventura81 avatar xventura81 commented on May 13, 2024

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.

david-antiteum avatar david-antiteum commented on May 13, 2024

@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.

david-antiteum avatar david-antiteum commented on May 13, 2024

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.

karastojko avatar karastojko commented on May 13, 2024

@david-antiteum
The option is removed with this commit from you. Do you need it back for the Vcpkg?

from mailio.

ParticleG avatar ParticleG commented on May 13, 2024

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.

Alx-prog avatar Alx-prog commented on May 13, 2024

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.

karastojko avatar karastojko commented on May 13, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.