Skip to content

[openfst] Add new port#27542

Closed
day253 wants to merge 11 commits intomicrosoft:masterfrom
day253:openfst
Closed

[openfst] Add new port#27542
day253 wants to merge 11 commits intomicrosoft:masterfrom
day253:openfst

Conversation

@day253
Copy link
Contributor

@day253 day253 commented Oct 29, 2022

Describe the pull request

  • What does your PR fix?

    Fixes [New Port Request] openfst #27541

  • Which triplets are supported/not supported? Have you updated the CI baseline?

    !windows, Yes

  • Does your PR follow the maintainer guide?

    Yes

  • If you have added/updated a port: Have you run ./vcpkg x-add-version --all and committed the result?

    Yes

If you are still working on the PR, open it as a Draft: https://github.blog/2019-02-14-introducing-draft-pull-requests/

github-actions[bot]
github-actions bot previously approved these changes Oct 29, 2022
github-actions[bot]
github-actions bot previously approved these changes Oct 29, 2022
github-actions[bot]
github-actions bot previously approved these changes Oct 29, 2022
github-actions[bot]
github-actions bot previously approved these changes Oct 29, 2022
Copy link
Contributor

@dg0yt dg0yt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a quick review.

If the CMake config isn't from upstream, then

  • the config shall be named (and installed as) unofficial-openfst
  • the targets shall be exported to namespace unofficial::openfst::

If there are no dependencies (which use targets), you don't need to include CMakeFindDependencyMacro, and you could directly export to unofficial-openfst-config.cmake.

(If you submitted the config change upstream, and it was accepted, then the unofficial prefix may be obsolete.)

github-actions[bot]
github-actions bot previously approved these changes Oct 29, 2022
github-actions[bot]
github-actions bot previously approved these changes Oct 29, 2022
github-actions[bot]
github-actions bot previously approved these changes Oct 29, 2022
github-actions[bot]
github-actions bot previously approved these changes Oct 29, 2022
github-actions[bot]
github-actions bot previously approved these changes Oct 29, 2022
github-actions[bot]
github-actions bot previously approved these changes Oct 29, 2022
@day253 day253 marked this pull request as ready for review October 29, 2022 13:34
@day253 day253 requested a review from dg0yt October 29, 2022 13:35
github-actions[bot]
github-actions bot previously approved these changes Oct 29, 2022
@day253 day253 mentioned this pull request Oct 29, 2022
@MonicaLiu0311 MonicaLiu0311 added the category:new-port The issue is requesting a new library to be added; consider making a PR! label Oct 31, 2022
@MonicaLiu0311
Copy link
Contributor

@day253
The port name is repeated with others, see: repology.org, we recommend adding the repository name in front. For example: kkm000-openfst. After modification, you can go here to check whether there are duplicates.

@day253
Copy link
Contributor Author

day253 commented Nov 2, 2022

@day253

The port name is repeated with others, see: repology.org, we recommend adding the repository name in front. For example: kkm000-openfst. After modification, you can go here to check whether there are duplicates.

This port is an unofficial mirror of openfst. And it's the most popular one. Can we use the official openfst name.

@MonicaLiu0311
Copy link
Contributor

This port is an unofficial mirror of openfst. And it's the most popular one. Can we use the official openfst name.

Thank you very much for your contribution, but our review standard stipulates that duplicates must be checked. You can use other names, such as unofficial-openfst or mirror-openfst, and then add a description to the description in vcpkg.json.

github-actions[bot]
github-actions bot previously approved these changes Dec 14, 2022
github-actions[bot]
github-actions bot previously approved these changes Dec 14, 2022
@day253 day253 requested review from FrankXie05 and removed request for dg0yt December 14, 2022 07:39
Comment on lines 3 to 4
find_library(FST_LIBRARY NAMES fst fstscript)
target_link_libraries(main PRIVATE ${FST_LIBRARY})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why the reviewers asked to remove the include dir stuff. It is necessary to find the headers.

OTOH I would suggest to ensure that pkg-config info is valid on windows and on-windows, and describe cmake usage with pkg-config. Cf. port poppler for an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will follow the comments.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FrankXie05 Can you explain why you asked for the usage to be changed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BillyONeal I think as header only, it is more intuitive.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it isn't header only if the user needs to add libraries to their link line?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt that this has been correctly verified. I'm irritated that this must be discussed at all. Basically you always have to deal with include directories. Only in the case of linking to CMake targets, this is handled implicitly via target properties. But here, we don't have targets, only find_library.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt that this has been correctly verified. I'm irritated that this must be discussed at all.

Re-test the two usages, and both failed:

usage 1:

    find_path(FST_INCLUDE_DIRS "fst/fst.h")
    find_library(FST_LIBRARY NAMES fst fstscript)

    target_include_directories(main PRIVATE ${FST_INCLUDE_DIRS})
    target_include_directories(main PRIVATE ${FST_INCLUDE_DIRS})

usage 2:

    find_library(FST_LIBRARY NAMES fst fstscript)
    target_include_directories(main PRIVATE ${FST_INCLUDE_DIRS})

Test Results:

~/CMakeFindUsage/build$ cmake --build .
[ 50%] Building CXX object CMakeFiles/CMakeFindUsage.dir/CMakeFindUsage.cpp.o
/home/vliumonica/CMakeFindUsage/CMakeFindUsage.cpp:3:10: fatal error: fst/fst.h: No such file or directory
    3 | #include "fst/fst.h"
      |          ^~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/CMakeFindUsage.dir/build.make:76: CMakeFiles/CMakeFindUsage.dir/CMakeFindUsage.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/CMakeFindUsage.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2

Directory structure:

CMakeFindUsage/
     CMakeFindUsage.cpp
     CMakeLists.txt
     build/
CMakeFindUsage.cpp
#include <iostream>
#include "fst/fst.h"

using namespace std;

int main()
{
cout << "Hello CMake." << endl;
return 0;
}

CMakeLists.txt
cmake_minimum_required (VERSION 3.8)

set(CMAKE_TOOLCHAIN_FILE "/home/monica/openfst/scripts/buildsystems/vcpkg.cmake")

project ("CMakeFindUsage")

find_path(FST_INCLUDE_DIRS "fst/fst.h")
find_library(FST_LIBRARY NAMES fst fstscript)

add_executable (CMakeFindUsage "CMakeFindUsage.cpp")

target_link_libraries(CMakeFindUsage PRIVATE ${FST_INCLUDE_DIRS})
target_link_libraries(CMakeFindUsage PRIVATE ${FST_LIBRARY})

I'm very sorry, the previous usage test may have passed because I didn't find the header file. This is my mistake, sorry again😶...In short, thanks very much for the contribution of @day253 and the review of @dg0yt 🌻

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to see the compile command line. Did you always start with a clean CMake cache (e.g. empty build dir)?

find_library(FST_LIBRARY NAMES fst fstscript)

This also looks questionable. By the names I would assume these are two independent libraries. But find_library will only return one of them. And we won't notice some linking errors unless we actually use symbols from those libs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to see the compile command line. Did you always start with a clean CMake cache (e.g. empty build dir)?

Yes, I empty build/ before every build.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MonicaLiu0311

Re-test the two usages, and both failed:

usage 1:

    find_path(FST_INCLUDE_DIRS "fst/fst.h")
    find_library(FST_LIBRARY NAMES fst fstscript)

This will find only one of those libraries. Are they really equivalent? Or did you want to use both?

target_include_directories(main PRIVATE ${FST_INCLUDE_DIRS})
target_include_directories(main PRIVATE ${FST_INCLUDE_DIRS})

The last line should be target_link_libraries(FST_LIBRARY) or similar.

usage 2:

    find_library(FST_LIBRARY NAMES fst fstscript)
    target_include_directories(main PRIVATE ${FST_INCLUDE_DIRS})

Test Results:

~/CMakeFindUsage/build$ cmake --build .
[ 50%] Building CXX object CMakeFiles/CMakeFindUsage.dir/CMakeFindUsage.cpp.o
/home/vliumonica/CMakeFindUsage/CMakeFindUsage.cpp:3:10: fatal error: fst/fst.h: No such file or directory
    3 | #include "fst/fst.h"
      |          ^~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/CMakeFindUsage.dir/build.make:76: CMakeFiles/CMakeFindUsage.dir/CMakeFindUsage.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/CMakeFindUsage.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2

Complete divergence between set variable and read variable, so totally broken.

FrankXie05
FrankXie05 previously approved these changes Feb 1, 2023
@FrankXie05 FrankXie05 added info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this. and removed requires:all-feature-testing labels Feb 1, 2023
@BillyONeal BillyONeal added requires:author-response and removed info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this. labels Feb 1, 2023
@MonicaLiu0311
Copy link
Contributor

Directory structure:

CMakeFindUsage/
     CMakeFindUsage.cpp
     CMakeLists.txt
     build/

🔴usage 1: failed

find_library(FST_LIBRARY NAMES fst fstscript)
target_link_libraries(main PRIVATE ${FST_LIBRARY})
CMakeLists.txt
cmake_minimum_required(VERSION 3.8)

set(CMAKE_TOOLCHAIN_FILE "/home/monica/openfst/scripts/buildsystems/vcpkg.cmake")

project("CMakeFindUsage")

find_library(FST_LIBRARY NAMES fst fstscript)

add_executable(CMakeFindUsage "CMakeFindUsage.cpp")

target_link_libraries(CMakeFindUsage PRIVATE ${FST_INCLUDE_DIRS})

Configure
monica@monica003:~/CMakeFindUsage/build$ cmake ..
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- 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
-- 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
-- Configuring done
-- Generating done
-- Build files have been written to: /home/monica/CMakeFindUsage/build
build
monica@monica003:~/CMakeFindUsage/build$ cmake --build .
[ 50%] Building CXX object CMakeFiles/CMakeFindUsage.dir/CMakeFindUsage.cpp.o
/home/monica/CMakeFindUsage/CMakeFindUsage.cpp:3:10: fatal error: fst/fst.h: No such file or directory
    3 | #include 
      |          ^~~~~~~~~~~
compilation terminated.
gmake[2]: *** [CMakeFiles/CMakeFindUsage.dir/build.make:76: CMakeFiles/CMakeFindUsage.dir/CMakeFindUsage.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/CMakeFindUsage.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2

🟢usage 2: successful

find_path(FST_INCLUDE_DIRS "fst/fst.h")
find_library(FST_LIBRARY NAMES fst fstscript)
target_include_directories(main PRIVATE ${FST_INCLUDE_DIRS})
target_link_libraries(main PRIVATE ${FST_LIBRARY})
CMakeLists.txt
cmake_minimum_required(VERSION 3.8)

set(CMAKE_TOOLCHAIN_FILE "/home/monica/openfst/scripts/buildsystems/vcpkg.cmake")

project("CMakeFindUsage")

find_path(FST_INCLUDE_DIRS "fst/fst.h")
find_library(FST_LIBRARY NAMES fst fstscript)

add_executable(CMakeFindUsage "CMakeFindUsage.cpp")

target_include_directories(CMakeFindUsage PRIVATE ${FST_INCLUDE_DIRS})
target_link_libraries(CMakeFindUsage PRIVATE ${FST_INCLUDE_DIRS})

Configure
monica@monica003:~/CMakeFindUsage/build$ cmake ..
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- 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
-- 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
-- Configuring done
WARNING: Target "CMakeFindUsage" requests linking to directory "/home/monica/openfst/installed/x64-linux/include".  Targets may link only to libraries.  CMake is dropping the item.
-- Generating done
-- Build files have been written to: /home/monica/CMakeFindUsage/build
build
monica@monica003:~/CMakeFindUsage/build$ cmake --build .
[ 50%] Building CXX object CMakeFiles/CMakeFindUsage.dir/CMakeFindUsage.cpp.o
[100%] Linking CXX executable CMakeFindUsage
[100%] Built target CMakeFindUsage

@MonicaLiu0311
Copy link
Contributor

@dg0yt :
I don't know why the reviewers asked to remove the include dir stuff. It is necessary to find the headers.
OTOH I would suggest to ensure that pkg-config info is valid on windows and on-windows, and describe cmake usage with > pkg-config. Cf. port poppler for an example.

@day253 :
I will follow the comments.

@BillyONeal :
@FrankXie05 Can you explain why you asked for the usage to be changed?

From: #27542 (comment)

Do a unified reply:
After testing, it has been revised back to the original usage by the reviewer, thanks to everyone who participated in this PR: @day253 @BillyONeal @FrankXie05 @dg0yt 🌷

Please help with the final check, thanks again.

@dg0yt
Copy link
Contributor

dg0yt commented Feb 6, 2023

find_library(FST_LIBRARY NAMES fst fstscript)

I asked to reconsider this pattern, but it is presented again.
fst and fstscript are two different libraries. I didn't find clear documentation. But the build system says that the latter depends on the former. So what could be proposed single-config usage is:

find_path(FST_INCLUDE_DIRS "fst/fst.h")
find_library(FST_LIBRARY NAMES fst)
find_library(FSTSCRIPT_LIBRARY NAMES fstscript)
target_include_directories(main PRIVATE ${FST_INCLUDE_DIRS})
target_link_libraries(main PRIVATE ${FSTSCRIPT_LIBRARY} ${FST_LIBRARY})

@MonicaLiu0311
Copy link
Contributor

fst and fstscript are two different libraries. I didn't find clear documentation. But the build system says that the latter depends on the former.

@day253
Could you please explain this doubt?

@MonicaLiu0311
Copy link
Contributor

Convert this PR to draft since there is no progress. Please ping us if this PR is ready for review again.

@MonicaLiu0311 MonicaLiu0311 marked this pull request as draft February 22, 2023 06:49
@MonicaLiu0311
Copy link
Contributor

Closing this PR since it seems that no progress is being made. Please ping us to reopen if work is still being done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category:new-port The issue is requesting a new library to be added; consider making a PR!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[New Port Request] openfst

5 participants