qingxiang-jia / full-cloud-pinyin

An attempt to use Google Input Tools as the backend for input methods on Linux
GNU General Public License v3.0
7 stars 0 forks source link

support for another languages? #12

Open monk-blade opened 9 months ago

qingxiang-jia commented 9 months ago

Sure. That's kind of the purpose of separating out fcitx-bridge. Which language(s) do you need?

monk-blade commented 8 months ago

Gujarati(gu) and Hindi(hi)

monk-blade commented 8 months ago

Some logic change required. I tried myself but failed as I'm new to rust. error : out of index.

URL : https://inputtools.google.com/request?text=aa&itc=zh-t-i0-pinyin&num=5&cp=0&cs=1&ie=utf-8&oe=utf-8&app=demopage Pinyin Output: ["SUCCESS",[["aa",["啊啊","AA","啊","阿","A"],[],{"annotation":["a a","a a","a","a","a"],"candidate_type":[0,0,0,0,0],"lc":["16 16","0 0","16","16","0"],"matched_length":[2,2,1,1,1]}]]]

URL : https://inputtools.google.com/request?text=aa&itc=gu-t-i0-und&num=5&cp=0&cs=1&ie=utf-8&oe=utf-8&app=demopage Gujarati Output: ["SUCCESS",[["aa",["આ","અઅ","આં","યા","આયા"],[],{"candidate_type":[0,0,0,0,0]}]]]

URL : https://inputtools.google.com/request?text=aa&itc=hi-t-i0-und&num=5&cp=0&cs=1&ie=utf-8&oe=utf-8&app=demopage Hindi Output: ["SUCCESS",[["aa",["आ","ा","आए","ाँ","ां"],[],{"candidate_type":[0,0,0,0,0]}]]]

monk-blade commented 8 months ago

when changing URL, output error

thread 'main' panicked at src/cloud_pinyin_client.rs:93:67:
index out of bounds: the len is 1 but the index is 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at src/user_dict.rs:82:14:
persist: Failed to open the file.: Os { code: 2, kind: NotFound, message: "No such file or directory" }
stack backtrace:
   0:     0xaaaaaef37e78 - std::backtrace_rs::backtrace::libunwind::trace::h02f9e4f4471336e3
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0xaaaaaef37e78 - std::backtrace_rs::backtrace::trace_unsynchronized::hbb08758edbde5130
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0xaaaaaef37e78 - std::sys_common::backtrace::_print_fmt::h5f86860630063d58
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:67:5
   3:     0xaaaaaef37e78 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h28b1846dca2a17cc
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:44:22
   4:     0xaaaaaef5beb4 - core::fmt::rt::Argument::fmt::h4597596d5e31f449
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/fmt/rt.rs:142:9
   5:     0xaaaaaef5beb4 - core::fmt::write::h76788fb7851cda1c
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/fmt/mod.rs:1120:17
   6:     0xaaaaaef3538c - std::io::Write::write_fmt::h8c2b0771a274739d
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/io/mod.rs:1762:15
   7:     0xaaaaaef37ca8 - std::sys_common::backtrace::_print::hbe1ff52860729255
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:47:5
   8:     0xaaaaaef37ca8 - std::sys_common::backtrace::print::h13ddc61648c1b5cf
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:34:9
   9:     0xaaaaaef392d8 - std::panicking::default_hook::{{closure}}::h3fb06cc4fa27f844
  10:     0xaaaaaef39004 - std::panicking::default_hook::h585763c48ee63ab9
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:292:9
  11:     0xaaaaaef39780 - std::panicking::rust_panic_with_hook::h25ba8e750f603eed
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:779:13
  12:     0xaaaaaef39638 - std::panicking::begin_panic_handler::{{closure}}::he88f9d300c5c2c0b
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:657:13
  13:     0xaaaaaef38320 - std::sys_common::backtrace::__rust_end_short_backtrace::h9c4571cb251fdb49
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:170:18
  14:     0xaaaaaef393c4 - rust_begin_unwind
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
  15:     0xaaaaae7340bc - core::panicking::panic_fmt::h83f4337bb6f332d3
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
  16:     0xaaaaae7344ec - core::result::unwrap_failed::ha48176a72edb5c54
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1653:5
  17:     0xaaaaae7470d4 - core::result::Result<T,E>::expect::he5c1b5386771b642
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/result.rs:1034:23
  18:     0xaaaaae73e5b0 - fcp::user_dict::UserDict::persist::h89b70fe78592c405
                               at /home/parallels/projects/full-cloud-pinyin/src/user_dict.rs:78:20
  19:     0xaaaaae73cc4c - <fcp::user_dict::UserDict as core::ops::drop::Drop>::drop::hd4570f6556e7b11d
                               at /home/parallels/projects/full-cloud-pinyin/src/user_dict.rs:20:9
  20:     0xaaaaae73a43c - core::ptr::drop_in_place<fcp::user_dict::UserDict>::hc046727c16fe54d3
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  21:     0xaaaaae73b114 - core::ptr::drop_in_place<core::cell::UnsafeCell<fcp::user_dict::UserDict>>::hb0e4b9e88bdc296d
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  22:     0xaaaaae73b154 - core::ptr::drop_in_place<std::sync::mutex::Mutex<fcp::user_dict::UserDict>>::haf2cc95af9179d92
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  23:     0xaaaaae73a6cc - core::ptr::drop_in_place<fcp::dispatcher::Dispatcher>::h59e12642f58cdcd6
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ptr/mod.rs:498:1
  24:     0xaaaaae766478 - fcp::main::{{closure}}::h9a9e2248d097ba2e
                               at /home/parallels/projects/full-cloud-pinyin/src/main.rs:49:1
  25:     0xaaaaae764434 - tokio::runtime::park::CachedParkThread::block_on::{{closure}}::h19d8cbf0b4afb821
                               at /home/parallels/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.0/src/runtime/park.rs:282:63
  26:     0xaaaaae763f14 - tokio::runtime::coop::with_budget::h76fd3134e3609943
                               at /home/parallels/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.0/src/runtime/coop.rs:107:5
  27:     0xaaaaae763f14 - tokio::runtime::coop::budget::h60ebd9030a6a1235
                               at /home/parallels/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.0/src/runtime/coop.rs:73:5
  28:     0xaaaaae763f14 - tokio::runtime::park::CachedParkThread::block_on::h058a89c11e2e7b4a
                               at /home/parallels/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.0/src/runtime/park.rs:282:31
  29:     0xaaaaae742dcc - tokio::runtime::context::blocking::BlockingRegionGuard::block_on::ha47eafd87edeb5de
                               at /home/parallels/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.0/src/runtime/context/blocking.rs:66:9
  30:     0xaaaaae7654b0 - tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}::h9c02afe3aeefd4b4
                               at /home/parallels/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.0/src/runtime/scheduler/multi_thread/mod.rs:87:13
  31:     0xaaaaae743b84 - tokio::runtime::context::runtime::enter_runtime::h0191301eb1005198
                               at /home/parallels/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.0/src/runtime/context/runtime.rs:65:16
  32:     0xaaaaae765468 - tokio::runtime::scheduler::multi_thread::MultiThread::block_on::h843cb09aa0ac3045
                               at /home/parallels/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.0/src/runtime/scheduler/multi_thread/mod.rs:86:9
  33:     0xaaaaae758fe0 - tokio::runtime::runtime::Runtime::block_on::hcebb4d094342074c
                               at /home/parallels/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.35.0/src/runtime/runtime.rs:350:45
  34:     0xaaaaae735afc - fcp::main::h0ac65b21cf7324a8
                               at /home/parallels/projects/full-cloud-pinyin/src/main.rs:35:5
  35:     0xaaaaae737e40 - core::ops::function::FnOnce::call_once::hca4d9df4c87a2152
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:250:5
  36:     0xaaaaae74d424 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1b36b9030cf7608c
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:154:18
  37:     0xaaaaae73ea54 - std::rt::lang_start::{{closure}}::hb914878b0f62cdfc
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:167:18
  38:     0xaaaaaef30080 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h6f396e33163198d5
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:284:13
  39:     0xaaaaaef30080 - std::panicking::try::do_call::h6a321d44b3abf5fc
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552:40
  40:     0xaaaaaef30080 - std::panicking::try::h0eb42c098714b2f3
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516:19
  41:     0xaaaaaef30080 - std::panic::catch_unwind::hf07fd6e09bae57e2
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142:14
  42:     0xaaaaaef30080 - std::rt::lang_start_internal::{{closure}}::h398d9caf4abe015f
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:148:48
  43:     0xaaaaaef30080 - std::panicking::try::do_call::h91387d694f1e2364
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552:40
  44:     0xaaaaaef30080 - std::panicking::try::hcc8c1230bee4591e
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516:19
  45:     0xaaaaaef30080 - std::panic::catch_unwind::h6bd43d0557e29b10
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142:14
  46:     0xaaaaaef30080 - std::rt::lang_start_internal::hea39f29bda0ceae5
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:148:20
  47:     0xaaaaae73ea24 - std::rt::lang_start::h774f184a4daa00d9
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:166:17
  48:     0xaaaaae735b90 - main
  49:     0xffff936273fc - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  50:     0xffff936274cc - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:392:3
  51:     0xaaaaae7347b0 - _start
  52:                0x0 - <unknown>
thread 'main' panicked at library/core/src/panicking.rs:144:5:
panic in a destructor during cleanup
thread caused non-unwinding panic. aborting.
Aborted (core dumped)
qingxiang-jia commented 8 months ago

Hi, I am sorry for the late reply.

I can definitely add support to these two languages. People also asked for Nepali. But I think as you can see, each languages is handled slightly differently and so this will take time to implement. (Also, we may need a new name for this project.)

Now, you seem to know these two languages well enough, and I know nothing. So, please let me know the following so I can decide what to do next:

  1. Is this language implemented in the varnam project? If so, does using cloud pinyin offer better experience?
  2. If not, will someone implement these two languages in the varnam project (they may have more people than just me here).
  3. If you passed the first two questions, how do people use the input method for these two languages?
    • Do you just type on a regular keyboard with US layout?
    • Do you type and then select candidates from the UI?
    • Do you switch between the language and English mode?
monk-blade commented 8 months ago
  1. Is this language implemented in the [varnam project] (https://varnamproject.com/)? If so, does using cloud pinyin offer better experience?

Yes, it is implemented but cloud backend provides better suggestions (In my usage, approx. 30-40% more accurate). Any GNU/Linux OS doesn't have like this. In Windows & macOS, transliteration keyboard of many Indian languages is inbuilt provided.

  1. If not, will someone implement these two languages in the varnam project (they may have more people than just me here).
  2. If you passed the first two questions, how do people use the input method for these two languages?
  • Do you just type on a regular keyboard with US layout?

Yes, regular US layout.

  • Do you type and then select candidates from the UI?

Yes

  • Do you switch between the language and English mode?

Yes

Note: Most of the Indian languages (20+) and nepali also have same output as I have listed in earlier comment. There will be less effort as there will be no annotation or matched_len variables. Just catch the output json,display and write.

qingxiang-jia commented 8 months ago

Thanks for answering the question. I am able to implement it. I will close this issue once it's done.

qingxiang-jia commented 8 months ago

I started implementing different languages. Do you expect to switch between input methods, like, switching between Hindi and Gujarati?

monk-blade commented 8 months ago

No. English & Any language - regular switching.

khumnath commented 8 months ago

i found some languages link for google ime "hindi": "hi-t-i0-und", "telegu": "te-t-i0-und", "bengali": "bn-t-i0-und", "tamil": "ta-t-i0-und", "malayalam": "ml-t-i0-und", "sanskrit": "sa-t-i0-und", "kannada": "kn-t-i0-und", "gujarati": "gu-t-i0-und", "marathi": "mr-t-i0-und", "odiya": "or-t-i0-und", "punjabi": "pu-t-i0-und", "urdu": "ur-t-i0-und", "nepali": "ne-t-i0-und", the google ime link is https://inputtools.google.com/request?text=nepal&itc=ne-t-i0-und&num=5&cp=0&cs=1&ie=utf-8&oe=utf-8&app=test

output json is ["SUCCESS",[["nepal",["नेपाल","नेपल","नपाल","नेप्ल","णेपल"],[],{"candidate_type":[0,0,0,0,0]}]]] first candidate is expected candidate for input

source for this suggestion: https://github.com/siddharth17196/english-hindi-transliteration

khumnath commented 8 months ago

I started implementing different languages. Do you expect to switch between input methods, like, switching between Hindi and Gujarati?

i think changing language using configuration file in user config folder is best. and add language map variable to change language link like this https://inputtools.google.com/request?text=$word&itc=$lang&num=5&cp=0&cs=1&ie=utf-8&oe=utf-8&app=test

lang_maps = { "hindi": "hi-t-i0-und", "telegu": "te-t-i0-und", "bengali": "bn-t-i0-und", "tamil": "ta-t-i0-und", "malayalam": "ml-t-i0-und", "sanskrit": "sa-t-i0-und", "kannada": "kn-t-i0-und", "gujarati": "gu-t-i0-und", "marathi": "mr-t-i0-und", "odiya": "or-t-i0-und", "punjabi": "pu-t-i0-und", "urdu": "ur-t-i0-und", "nepali": "ne-t-i0-und",

...

}

qingxiang-jia commented 8 months ago

i found some languages link for google ime "hindi": "hi-t-i0-und", "telegu": "te-t-i0-und", "bengali": "bn-t-i0-und", "tamil": "ta-t-i0-und", "malayalam": "ml-t-i0-und", "sanskrit": "sa-t-i0-und", "kannada": "kn-t-i0-und", "gujarati": "gu-t-i0-und", "marathi": "mr-t-i0-und", "odiya": "or-t-i0-und", "punjabi": "pu-t-i0-und", "urdu": "ur-t-i0-und", "nepali": "ne-t-i0-und", the google ime link is https://inputtools.google.com/request?text=nepal&itc=ne-t-i0-und&num=5&cp=0&cs=1&ie=utf-8&oe=utf-8&app=test

output json is ["SUCCESS",[["nepal",["नेपाल","नेपल","नपाल","नेप्ल","णेपल"],[],{"candidate_type":[0,0,0,0,0]}]]] first candidate is expected candidate for input

source for this suggestion: https://github.com/siddharth17196/english-hindi-transliteration

Yes, I am aware of those available languages. Thanks.

qingxiang-jia commented 8 months ago

I started implementing different languages. Do you expect to switch between input methods, like, switching between Hindi and Gujarati?

i think changing language using configuration file in user config folder is best. and add language map variable to change language link like this https://inputtools.google.com/request?text=$word&itc=$lang&num=5&cp=0&cs=1&ie=utf-8&oe=utf-8&app=test

lang_maps = { "hindi": "hi-t-i0-und", "telegu": "te-t-i0-und", "bengali": "bn-t-i0-und", "tamil": "ta-t-i0-und", "malayalam": "ml-t-i0-und", "sanskrit": "sa-t-i0-und", "kannada": "kn-t-i0-und", "gujarati": "gu-t-i0-und", "marathi": "mr-t-i0-und", "odiya": "or-t-i0-und", "punjabi": "pu-t-i0-und", "urdu": "ur-t-i0-und", "nepali": "ne-t-i0-und", # ... }

The difficulty of this approach is that we don't necessarily know that each language has the same interaction. For example, as we discussed, the interaction between Gujirati, Hindi and Nepali are similar but they are different from Pinyin. So it's easy to say let's just put those in a map and load different URL to get candidates, but that won't necessarily give us the best input experience.

Also, I think we need to consider the installation. I haven't close your issue about installation instruction because I haven't had a good plan yet. But here is what I have now:

  1. Each language has their own input method in Fcitx5, so they are not different than a normal Fcitx5 input method.
  2. The installation should be as simple as possible, even without packages for a specific distribution. We are such a small project and I don't think any distribution is interested in packaging it.
  3. Because of 1 and 2, for now, I think we could have a Fcitx5 Bridge per language. For example, Nepali will have its own Fcitx5 Bridge and user can just add Nepali in Fcitx5's UI. Users can switch between Nepali and other input methods using mechanism offered by Fcitx5.
  4. Because of 3, each Fcitx5 Bridge needs to have a unique ZMQ address (it doesn't yet have this, but is easy to implement).
  5. Because of 2 and 4, I think it's best to have the bridge to start a specific input method when Fcitx5 is loaded (typically when you login to the OS).

The end result of 1-5 is, the release of an input method will come with both the input method and the bridge. I will offer a script and a manual installation guide so one can install and uninstall an input method.

Please let me know if you have different opinions.

monk-blade commented 8 months ago

+1 for this approach

khumnath commented 8 months ago

Can we use if-else expression to distinguish pinyin and other input methods? This might simplify the input configuration for different languages. Instead of having separate input config for each language, we could just have one conf file for fcitx and one for fpc to switch languages. Moreover, if we separate the input methods, we could add more transliteration data that google input can’t handle, such as numbers and punctuations. This would improve the accuracy and convenience of typing in various languages.

qingxiang-jia commented 8 months ago

Can we use if-else expression to distinguish pinyin and other input methods? This might simplify the input configuration for different languages. Instead of having separate input config for each language, we could just have one conf file for fcitx and one for fpc to switch languages. Moreover, if we separate the input methods, we could add more transliteration data that google input can’t handle, such as numbers and punctuations. This would improve the accuracy and convenience of typing in various languages.

Yes, it's possible, but for now I would probably go with the approach I outlined earlier (for the reasons mentioned there). The approach you suggested has been adopted by Rime but I don't have that much bandwidth to spend. I prefer minimize efforts to rely on Fcitx5 as much as we can and keep things simple.

monk-blade commented 7 months ago

Ready for testing ? Any how to ?

qingxiang-jia commented 7 months ago

I am sorry I haven't got a chance to finish it. But I have made some big progress. I will try to find sometime to work on it this weekend.

qingxiang-jia commented 7 months ago

OK, the input method for Nepali is done. I will make a script to generate package to install and update readme. Hindi and Gujarati will come next.

qingxiang-jia commented 7 months ago

Hi everyone, I have made a release for both Pinyin and Nepali. Next: make Hindi and Gujarati and close this issue.

khumnath commented 7 months ago

copied release files first in local paths ~/.local/usr/bin/fcp # fcp excutable from release ~/.local/usr/share/fcitx5 # share folder from release ~/.local/usr/lib/fcitx5 corrected here # lib folder content input not working

then copied in system directories /usr/bin/fcp # fcp excutable from release /usr/share/fcitx5 # share folder from release /usr/lib/fcitx5 corrected here # lib folder content input not working shows full cloud nepali(unavailable)

qingxiang-jia commented 7 months ago

Please read the release note. You paths are incorrect:

  1. ./local isn't correct. The release notes mentioned /usr, not .local/usr.
  2. Under /usr is correct, but the release notes specifically asked not to break the folder structure, so it shouldn't be /usr/share/fcitx, but it should be /usr/share/fcitx5.

In summary, the correct paths should be:

khumnath commented 7 months ago

I did not break folder structure.

https://github.com/qingxiang-jia/full-cloud-pinyin/assets/50103558/6b88a7b2-bedf-4ddb-bc7d-b10bfbdcc5d8

20240212_195714 20240212_195559 20240212_195540 20240212_195519

khumnath commented 7 months ago

I discovered that the installation directories are all accurate, but the FCP executable is compiled with a newer version of glibc. Specifically, it’s looking for version GLIBC_2.38, which is not found (and required) by FCP. It seems that bleeding-edge Linux distributions are the ones that typically include this updated glibc package. fcp: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by fcp)

Screenshot_select-area_20240212204115

qingxiang-jia commented 7 months ago

My comments about incorrect directory (breaking folder structure) was based on the comments you made. It seems you found the right folders. That's good.

Regarding linking the newer version of the system libraries, you are right. In fact, I just found out that both fcp (the input method itself) and the bridge (enabling talking to Fcitx5) link to so many system libraries and that means, any one of them being incompatible will cause the input method fail to run.

Honestly, I am surprised that by default both languages (C++ and Rust) rely on linking so much. This is means distributing the binaries directly isn't a good solution. However, I still hope I could do that. So here is my plan:

  1. Investigate if it's possible to so a real self-contained executable in both C++ and Rust.
  2. If 1 turns out to be doable with reasonable amount of effort, I will do that and make another release.

Hopefully this will solve your issue. In the meantime, you can manually build both project and generate the files so you can install. Install NuShell (it doesn't need to be your default shell, just nu the_name_of_the_script.nu) and take a look at release.nu to see how to do it. Let me know if you encounter any issues.

qingxiang-jia commented 7 months ago

BTW, here is how much libraries they rely on. It's honestly shocking:

ldd /usr/lib/fcitx5/libbridge-fcn.so                                                        02/17/24 08:08:21 AM
    linux-vdso.so.1 (0x00007ffec3350000)
    libFcitx5Core.so.7 => /usr/lib/libFcitx5Core.so.7 (0x00007aedc8ba5000)
    libprotobuf.so.25 => /usr/lib/libprotobuf.so.25 (0x00007aedc8800000)
    libFcitx5Utils.so.2 => /usr/lib/libFcitx5Utils.so.2 (0x00007aedc8754000)
    libzmq.so.5 => /usr/lib/libzmq.so.5 (0x00007aedc866f000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007aedc8200000)
    libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007aedc864a000)
    libc.so.6 => /usr/lib/libc.so.6 (0x00007aedc801e000)
    libFcitx5Config.so.6 => /usr/lib/libFcitx5Config.so.6 (0x00007aedc8628000)
    libxkbcommon.so.0 => /usr/lib/libxkbcommon.so.0 (0x00007aedc85df000)
    libuuid.so.1 => /usr/lib/libuuid.so.1 (0x00007aedc8b9a000)
    libz.so.1 => /usr/lib/libz.so.1 (0x00007aedc85c5000)
    libabsl_die_if_null.so.2308.0.0 => /usr/lib/libabsl_die_if_null.so.2308.0.0 (0x00007aedc85c0000)
    libabsl_statusor.so.2308.0.0 => /usr/lib/libabsl_statusor.so.2308.0.0 (0x00007aedc85b8000)
    libabsl_log_internal_check_op.so.2308.0.0 => /usr/lib/libabsl_log_internal_check_op.so.2308.0.0 (0x00007aedc85af000)
    libabsl_log_internal_conditions.so.2308.0.0 => /usr/lib/libabsl_log_internal_conditions.so.2308.0.0 (0x00007aedc85aa000)
    libabsl_log_internal_message.so.2308.0.0 => /usr/lib/libabsl_log_internal_message.so.2308.0.0 (0x00007aedc859d000)
    libabsl_log_internal_nullguard.so.2308.0.0 => /usr/lib/libabsl_log_internal_nullguard.so.2308.0.0 (0x00007aedc8598000)
    libabsl_raw_hash_set.so.2308.0.0 => /usr/lib/libabsl_raw_hash_set.so.2308.0.0 (0x00007aedc8591000)
    libabsl_hash.so.2308.0.0 => /usr/lib/libabsl_hash.so.2308.0.0 (0x00007aedc858c000)
    libabsl_status.so.2308.0.0 => /usr/lib/libabsl_status.so.2308.0.0 (0x00007aedc8581000)
    libabsl_cord.so.2308.0.0 => /usr/lib/libabsl_cord.so.2308.0.0 (0x00007aedc856d000)
    libabsl_cordz_info.so.2308.0.0 => /usr/lib/libabsl_cordz_info.so.2308.0.0 (0x00007aedc8566000)
    libabsl_synchronization.so.2308.0.0 => /usr/lib/libabsl_synchronization.so.2308.0.0 (0x00007aedc8552000)
    libabsl_time.so.2308.0.0 => /usr/lib/libabsl_time.so.2308.0.0 (0x00007aedc853e000)
    libabsl_time_zone.so.2308.0.0 => /usr/lib/libabsl_time_zone.so.2308.0.0 (0x00007aedc8524000)
    libabsl_str_format_internal.so.2308.0.0 => /usr/lib/libabsl_str_format_internal.so.2308.0.0 (0x00007aedc850c000)
    libabsl_strings.so.2308.0.0 => /usr/lib/libabsl_strings.so.2308.0.0 (0x00007aedc84ef000)
    libabsl_throw_delegate.so.2308.0.0 => /usr/lib/libabsl_throw_delegate.so.2308.0.0 (0x00007aedc84e9000)
    libabsl_raw_logging_internal.so.2308.0.0 => /usr/lib/libabsl_raw_logging_internal.so.2308.0.0 (0x00007aedc84e2000)
    libabsl_spinlock_wait.so.2308.0.0 => /usr/lib/libabsl_spinlock_wait.so.2308.0.0 (0x00007aedc84dd000)
    /usr/lib64/ld-linux-x86-64.so.2 (0x00007aedc8ccb000)
    libsystemd.so.0 => /usr/lib/libsystemd.so.0 (0x00007aedc7f2a000)
    libm.so.6 => /usr/lib/libm.so.6 (0x00007aedc7e3e000)
    libgnutls.so.30 => /usr/lib/libgnutls.so.30 (0x00007aedc7c00000)
    libsodium.so.26 => /usr/lib/libsodium.so.26 (0x00007aedc847d000)
    libpgm-5.3.so.0 => /usr/lib/libpgm-5.3.so.0 (0x00007aedc7bb6000)
    libabsl_base.so.2308.0.0 => /usr/lib/libabsl_base.so.2308.0.0 (0x00007aedc7e37000)
    libabsl_examine_stack.so.2308.0.0 => /usr/lib/libabsl_examine_stack.so.2308.0.0 (0x00007aedc7e32000)
    libabsl_log_internal_format.so.2308.0.0 => /usr/lib/libabsl_log_internal_format.so.2308.0.0 (0x00007aedc7e2c000)
    libabsl_log_internal_proto.so.2308.0.0 => /usr/lib/libabsl_log_internal_proto.so.2308.0.0 (0x00007aedc7e27000)
    libabsl_strerror.so.2308.0.0 => /usr/lib/libabsl_strerror.so.2308.0.0 (0x00007aedc7e22000)
    libabsl_log_internal_log_sink_set.so.2308.0.0 => /usr/lib/libabsl_log_internal_log_sink_set.so.2308.0.0 (0x00007aedc7e1c000)
    libabsl_log_internal_globals.so.2308.0.0 => /usr/lib/libabsl_log_internal_globals.so.2308.0.0 (0x00007aedc7e17000)
    libabsl_log_globals.so.2308.0.0 => /usr/lib/libabsl_log_globals.so.2308.0.0 (0x00007aedc7e11000)
    libabsl_city.so.2308.0.0 => /usr/lib/libabsl_city.so.2308.0.0 (0x00007aedc7e0a000)
    libabsl_low_level_hash.so.2308.0.0 => /usr/lib/libabsl_low_level_hash.so.2308.0.0 (0x00007aedc7e05000)
    libabsl_cord_internal.so.2308.0.0 => /usr/lib/libabsl_cord_internal.so.2308.0.0 (0x00007aedc7ba5000)
    libabsl_crc_cord_state.so.2308.0.0 => /usr/lib/libabsl_crc_cord_state.so.2308.0.0 (0x00007aedc7b9e000)
    libabsl_cordz_functions.so.2308.0.0 => /usr/lib/libabsl_cordz_functions.so.2308.0.0 (0x00007aedc7b99000)
    libabsl_cordz_handle.so.2308.0.0 => /usr/lib/libabsl_cordz_handle.so.2308.0.0 (0x00007aedc7b91000)
    libabsl_stacktrace.so.2308.0.0 => /usr/lib/libabsl_stacktrace.so.2308.0.0 (0x00007aedc7b8c000)
    libabsl_kernel_timeout_internal.so.2308.0.0 => /usr/lib/libabsl_kernel_timeout_internal.so.2308.0.0 (0x00007aedc7b86000)
    libabsl_malloc_internal.so.2308.0.0 => /usr/lib/libabsl_malloc_internal.so.2308.0.0 (0x00007aedc7b7f000)
    libabsl_int128.so.2308.0.0 => /usr/lib/libabsl_int128.so.2308.0.0 (0x00007aedc7b78000)
    libabsl_strings_internal.so.2308.0.0 => /usr/lib/libabsl_strings_internal.so.2308.0.0 (0x00007aedc7b70000)
    libcap.so.2 => /usr/lib/libcap.so.2 (0x00007aedc7b64000)
    libgcrypt.so.20 => /usr/lib/libgcrypt.so.20 (0x00007aedc7a1b000)
    liblz4.so.1 => /usr/lib/liblz4.so.1 (0x00007aedc79f6000)
    liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007aedc79c3000)
    libzstd.so.1 => /usr/lib/libzstd.so.1 (0x00007aedc78ee000)
    libp11-kit.so.0 => /usr/lib/libp11-kit.so.0 (0x00007aedc7758000)
    libbrotlienc.so.1 => /usr/lib/libbrotlienc.so.1 (0x00007aedc76a6000)
    libbrotlidec.so.1 => /usr/lib/libbrotlidec.so.1 (0x00007aedc7697000)
    libidn2.so.0 => /usr/lib/libidn2.so.0 (0x00007aedc7675000)
    libunistring.so.5 => /usr/lib/libunistring.so.5 (0x00007aedc74bb000)
    libtasn1.so.6 => /usr/lib/libtasn1.so.6 (0x00007aedc74a2000)
    libnettle.so.8 => /usr/lib/libnettle.so.8 (0x00007aedc744a000)
    libhogweed.so.6 => /usr/lib/libhogweed.so.6 (0x00007aedc7401000)
    libgmp.so.10 => /usr/lib/libgmp.so.10 (0x00007aedc735b000)
    libabsl_symbolize.so.2308.0.0 => /usr/lib/libabsl_symbolize.so.2308.0.0 (0x00007aedc7353000)
    libabsl_log_sink.so.2308.0.0 => /usr/lib/libabsl_log_sink.so.2308.0.0 (0x00007aedc734c000)
    libabsl_crc32c.so.2308.0.0 => /usr/lib/libabsl_crc32c.so.2308.0.0 (0x00007aedc7346000)
    libabsl_exponential_biased.so.2308.0.0 => /usr/lib/libabsl_exponential_biased.so.2308.0.0 (0x00007aedc7341000)
    libabsl_debugging_internal.so.2308.0.0 => /usr/lib/libabsl_debugging_internal.so.2308.0.0 (0x00007aedc733b000)
    libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00007aedc7315000)
    libffi.so.8 => /usr/lib/libffi.so.8 (0x00007aedc7308000)
    libbrotlicommon.so.1 => /usr/lib/libbrotlicommon.so.1 (0x00007aedc72e5000)
    libabsl_demangle_internal.so.2308.0.0 => /usr/lib/libabsl_demangle_internal.so.2308.0.0 (0x00007aedc72db000)
    libabsl_crc_internal.so.2308.0.0 => /usr/lib/libabsl_crc_internal.so.2308.0.0 (0x00007aedc72d5000)
ldd ~/Code/full-cloud-pinyin/target/release/fcp                                                                                              02/17/24 08:08:27 AM
    linux-vdso.so.1 (0x00007fffee114000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x000076f2c4200000)
    libssl.so.3 => /usr/lib/libssl.so.3 (0x000076f2c4ca2000)
    libcrypto.so.3 => /usr/lib/libcrypto.so.3 (0x000076f2c3c00000)
    libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x000076f2c45db000)
    libm.so.6 => /usr/lib/libm.so.6 (0x000076f2c44ef000)
    libc.so.6 => /usr/lib/libc.so.6 (0x000076f2c3a1e000)
    /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x000076f2c4da8000)
khumnath commented 7 months ago

Let me build on my machine first. I will search those libraries too. But if lib version gives problem need to change some codes on fcp and fcp-bridge .

qingxiang-jia commented 7 months ago

I just checked. 100% static link isn't possible with the dependencies I have in this project. So @khumnath, I think the best solution for you is to compile it yourselves. Let me know if there's anything I can help.

khumnath commented 7 months ago

some errors presists. first picture is fcp and second is bridge. Screenshot_deepin-terminal_20240222125403 Screenshot_deepin-terminal_20240222125203

monk-blade commented 7 months ago

@khumnath please use latest version of rust.

khumnath commented 7 months ago

@khumnath please use latest version of rust.

did you manage to build? i think fcp is built with some warnings that is ok. main error is in fcitx5-bridge. there is something called protoc is older then expected in my machine. i have protoc version like this ~$ protoc --version libprotoc 3.21.12

khumnath commented 7 months ago

protoc buffer headers are define here explicitly https://github.com/qingxiang-jia/fcitx5-bridge/blob/e9622ae50625959be7bdd109ffcb769ae5630c2e/msgs.pb.h#L14 available protobuff compiler is lower then code requires . @qingxiang-jia can I edit those numbers to lower versions? I want to go with with debain stable default repository packages. if there are another codes that requires specific that version, I need to install protobuff from github release. EDIT: i changed version on that pb.h file but there are bunch of errors again. I am trying to install newer protoc now. EDIT2: There are two components, the Protocol Buffer Compiler (protoc) and the protobuf library. They must match versions, but I’m having trouble installing them correctly.

monk-blade commented 7 months ago

Check this : https://github.com/qingxiang-jia/fcitx5-bridge/issues/1 It may help

khumnath commented 7 months ago

i managed to build with these steps

installing

build tools

cmake g++ git

fcitx build modules

fcitx5-modules-dev libfcitx5config-dev libfcitx5core-dev libfcitx5utils-dev

other requirements

cppzmq(installed manually) protobuf-compiler libprotobuf-dev

for rust with cargo

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh and i make build script. have a look at this #!/bin/bash HEIGHT=15 WIDTH=40 CHOICE_HEIGHT=4 BACKTITLE="" TITLE="fcp installer" MENU="Choose one of the following options:" OPTIONS=(1 "build full cloud pinyin" 2 "build full cloud nepali") CHOICE=$(dialog --clear \ --backtitle "$BACKTITLE" \ --title "$TITLE" \ --menu "$MENU" \ $HEIGHT $WIDTH $CHOICE_HEIGHT \ "${OPTIONS[@]}" \ 2>&1 >/dev/tty) clear case $CHOICE in 1) echo "preparing to build and install full cloud pinyin with fcitx5-bridge" git clone qingxiang-jia/full-cloud-pinyin git clone qingxiang-jia/fcitx5-bridge cd full-cloud-pinyin cargo clean cargo build --release --features "fcp" sudo cp ./target/release/fcp /usr/local/bin cd .. cd fcitx5-bridge make clean make proto make init-release-usr make build sudo make install echo "Finished" ;; 2) echo "preparing to build and install full cloud nepali with fcitx5-bridge" git clone qingxiang-jia/full-cloud-pinyin git clone qingxiang-jia/fcitx5-bridge cd full-cloud-pinyin cargo clean cargo build --release --features "fcn" sudo cp ./target/release/fcp /usr/local/bin cd .. cd fcitx5-bridge make clean make proto make init-release-usr make build sudo make install echo "Finished" ;; esac

everithing is ok but input is not transliterating. EDIT: i had previous install from github release. I deleted those files manualy and built and installed. Now working transliteration but i found another problem. I opened another issue https://github.com/qingxiang-jia/full-cloud-pinyin/issues/17#issue-2150489006 I will try to add another languages too. Let's see what i can do. I think this issue can be closed.

qingxiang-jia commented 7 months ago

Thanks for the effort. I will put this in the ReadMe so others have a better idea how to build it on Ubuntu.

khumnath commented 7 months ago

Also i have a fpc.desktop file created in ~/.config/autostart containing script to auto run fpc binary on every login