oooutlk / tcltk

Rust bindings to Tcl/Tk commands
Apache License 2.0
22 stars 3 forks source link

Does not build #16

Open smaudet opened 7 months ago

smaudet commented 7 months ago

Does not work out of the box:

Cargo version: 1.76.0 rust version: 1.76.0

cargo build
    Updating crates.io index
  Downloaded bitflags v1.3.2
  Downloaded autocfg v1.2.0
  Downloaded bitflags v2.5.0
  Downloaded anyhow v1.0.82
  Downloaded equivalent v1.0.1
  Downloaded peeking_take_while v0.1.2
  Downloaded glob v0.3.1
  Downloaded proc-macro-crate v3.1.0
  Downloaded cfg-if v1.0.0
  Downloaded cexpr v0.6.0
  Downloaded lazy_static v1.4.0
  Downloaded heck v0.3.3
  Downloaded errno v0.3.8
  Downloaded which v4.4.2
  Downloaded walkdir v2.5.0
  Downloaded toml_datetime v0.6.5
  Downloaded strum_macros v0.19.4
  Downloaded shlex v1.3.0
  Downloaded serde_spanned v0.6.5
  Downloaded same-file v1.0.6
  Downloaded rustc-hash v1.1.0
  Downloaded quote v1.0.36
  Downloaded pkg-config v0.3.30
  Downloaded once_cell v1.19.0
  Downloaded num_enum_derive v0.7.2
  Downloaded uuid v1.8.0
  Downloaded proc-macro2 v1.0.79
  Downloaded log v0.4.21
  Downloaded toml v0.7.8
  Downloaded indexmap v1.9.3
  Downloaded getrandom v0.2.14
  Downloaded clang-sys v1.7.0
  Downloaded num_enum v0.7.2
  Downloaded libloading v0.8.3
  Downloaded unicode-ident v1.0.12
  Downloaded serde_derive v1.0.197
  Downloaded toml_edit v0.19.15
  Downloaded serde v1.0.197
  Downloaded unicode-segmentation v1.11.0
  Downloaded toml_edit v0.21.1
  Downloaded nom v7.1.3
  Downloaded winnow v0.5.40
  Downloaded hashbrown v0.14.3
  Downloaded hashbrown v0.12.3
  Downloaded minimal-lexical v0.2.1
  Downloaded memchr v2.7.2
  Downloaded indexmap v2.2.6
  Downloaded aho-corasick v1.1.3
  Downloaded lazycell v1.3.0
  Downloaded home v0.5.9
  Downloaded either v1.10.0
  Downloaded syn v1.0.109
  Downloaded regex v1.10.4
  Downloaded syn v2.0.58
  Downloaded regex-syntax v0.8.3
  Downloaded rustix v0.38.32
  Downloaded bind_syn v0.1.0
  Downloaded cex v0.5.2
  Downloaded mutf8 v0.2.0
  Downloaded cex_derive v0.5.2
  Downloaded inwelling v0.5.5
  Downloaded enumx v0.4.3
  Downloaded clib v0.2.4
  Downloaded strum v0.19.5
  Downloaded heredom v0.1.0
  Downloaded enumx_derive v0.4.2
  Downloaded tuplex v0.1.2
  Downloaded tcl_derive v0.1.5
  Downloaded regex-automata v0.4.6
  Downloaded tcl v0.1.9
  Downloaded bindgen v0.64.0
  Downloaded libc v0.2.153
  Downloaded linux-raw-sys v0.4.13
  Downloaded tk v0.1.10
  Downloaded 74 crates (9.2 MB) in 4.32s (largest was `tk` at 2.3 MB)
   Compiling proc-macro2 v1.0.79
   Compiling unicode-ident v1.0.12
   Compiling serde v1.0.197
   Compiling equivalent v1.0.1
   Compiling hashbrown v0.14.3
   Compiling winnow v0.5.40
   Compiling syn v1.0.109
   Compiling libc v0.2.153
   Compiling cfg-if v1.0.0
   Compiling same-file v1.0.6
   Compiling walkdir v2.5.0
   Compiling indexmap v2.2.6
   Compiling quote v1.0.36
   Compiling glob v0.3.1
   Compiling autocfg v1.2.0
   Compiling rustix v0.38.32
   Compiling clang-sys v1.7.0
   Compiling indexmap v1.9.3
   Compiling syn v2.0.58
   Compiling linux-raw-sys v0.4.13
   Compiling minimal-lexical v0.2.1
   Compiling memchr v2.7.2
   Compiling regex-syntax v0.8.3
   Compiling bitflags v2.5.0
   Compiling nom v7.1.3
   Compiling toml_datetime v0.6.5
   Compiling serde_spanned v0.6.5
   Compiling toml_edit v0.19.15
   Compiling regex-automata v0.4.6
   Compiling libloading v0.8.3
   Compiling hashbrown v0.12.3
   Compiling either v1.10.0
   Compiling anyhow v1.0.82
   Compiling bindgen v0.64.0
   Compiling home v0.5.9
   Compiling which v4.4.2
   Compiling toml v0.7.8
   Compiling inwelling v0.5.5
   Compiling regex v1.10.4
   Compiling cexpr v0.6.0
   Compiling log v0.4.21
   Compiling peeking_take_while v0.1.2
   Compiling rustc-hash v1.1.0
   Compiling lazycell v1.3.0
   Compiling lazy_static v1.4.0
   Compiling bitflags v1.3.2
   Compiling shlex v1.3.0
   Compiling pkg-config v0.3.30
   Compiling toml_edit v0.21.1
   Compiling enumx_derive v0.4.2
   Compiling getrandom v0.2.14
   Compiling uuid v1.8.0
   Compiling cex_derive v0.5.2
   Compiling serde_derive v1.0.197
   Compiling proc-macro-crate v3.1.0
   Compiling tcl v0.1.9
   Compiling enumx v0.4.3
   Compiling bind_syn v0.1.0
   Compiling unicode-segmentation v1.11.0
   Compiling tuplex v0.1.2
   Compiling num_enum_derive v0.7.2
   Compiling cex v0.5.2
   Compiling heck v0.3.3
   Compiling tcl_derive v0.1.5
   Compiling tk v0.1.10
   Compiling mutf8 v0.2.0
   Compiling heredom v0.1.0
   Compiling strum_macros v0.19.4
   Compiling num_enum v0.7.2
   Compiling once_cell v1.19.0
   Compiling strum v0.19.5
   Compiling clib v0.2.4
error[E0425]: cannot find function, tuple struct or tuple variant `Tcl_IsSafe` in crate `clib`
   --> /home/smaudet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:629:19
    |
629 |             clib::Tcl_IsSafe( self.as_ptr() ) != 0
    |                   ^^^^^^^^^^ not found in `clib`

error[E0425]: cannot find function, tuple struct or tuple variant `Tcl_MakeSafe` in crate `clib`
   --> /home/smaudet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:653:19
    |
653 |             clib::Tcl_MakeSafe( self.as_ptr() ).code_to_result( self )
    |                   ^^^^^^^^^^^^ not found in `clib`

error[E0425]: cannot find function, tuple struct or tuple variant `Tcl_CreateSlave` in crate `clib`
   --> /home/smaudet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:678:54
    |
678 |             Ok( Interpreter( Interp::from_raw( clib::Tcl_CreateSlave(
    |                                                      ^^^^^^^^^^^^^^^ not found in `clib`

error[E0425]: cannot find function, tuple struct or tuple variant `Tcl_GetSlave` in crate `clib`
   --> /home/smaudet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:707:33
    |
707 |         Interp::from_raw( clib::Tcl_GetSlave(
    |                                 ^^^^^^^^^^^^ not found in `clib`

error[E0425]: cannot find function, tuple struct or tuple variant `Tcl_GetMaster` in crate `clib`
   --> /home/smaudet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:731:33
    |
731 |         Interp::from_raw( clib::Tcl_GetMaster(
    |                                 ^^^^^^^^^^^^^ not found in `clib`

error[E0425]: cannot find function, tuple struct or tuple variant `Tcl_ExposeCommand` in crate `clib`
   --> /home/smaudet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:757:19
    |
757 |             clib::Tcl_ExposeCommand(
    |                   ^^^^^^^^^^^^^^^^^ not found in `clib`

error[E0425]: cannot find function, tuple struct or tuple variant `Tcl_HideCommand` in crate `clib`
   --> /home/smaudet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:788:19
    |
788 |             clib::Tcl_HideCommand(
    |                   ^^^^^^^^^^^^^^^ not found in `clib`

For more information about this error, try `rustc --explain E0425`.
error: could not compile `tcl` (lib) due to 7 previous errors

Cargo.toml:

[package]
name = "RustHello"
version = "0.1.0"
edition = "2021"

[[bin]]
name = "TkUi"
path = "src/tk_ui.rs"

[dependencies]
tk = "0.1.10"

tk_ui.rs:

use tk::*;
use tk::cmd::*;

fn main() -> TkResult<()> {
    let tk = make_tk!()?;
    let root = tk.root();
    root.add_label( -text("constructs widgets and layout step by step") )?
        .pack(())?;
    let f = root
        .add_frame(())?
        .pack(())?;
    let _btn = f
        .add_button( "btn" -text("quit") -command("destroy .") )?
        .pack(())?;
    Ok( main_loop() )
}
oooutlk commented 7 months ago

Maybe crate inwelling failed to get its job done. It’s quite annoying. Would you please run cargo clean -p clib then cargo build to see if it compiles?

smaudet commented 7 months ago

After cargo clean -p clib, I did:

cargo build Compiling clib v0.2.4 Compiling tcl v0.1.9 error[E0425]: cannot find function, tuple struct or tuple variant Tcl_IsSafe in crate clib --> /home/smaudet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:629:19 | 629 | clib::Tcl_IsSafe( self.as_ptr() ) != 0 | ^^^^^^^^^^ not found in clib

error[E0425]: cannot find function, tuple struct or tuple variant Tcl_MakeSafe in crate clib --> /home/smaudet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:653:19 | 653 | clib::Tcl_MakeSafe( self.as_ptr() ).code_to_result( self ) | ^^^^^^^^^^^^ not found in clib

error[E0425]: cannot find function, tuple struct or tuple variant Tcl_CreateSlave in crate clib --> /home/smaudet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:678:54 | 678 | Ok( Interpreter( Interp::from_raw( clib::Tcl_CreateSlave( | ^^^^^^^^^^^^^^^ not found in clib

error[E0425]: cannot find function, tuple struct or tuple variant Tcl_GetSlave in crate clib --> /home/smaudet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:707:33 | 707 | Interp::from_raw( clib::Tcl_GetSlave( | ^^^^^^^^^^^^ not found in clib

error[E0425]: cannot find function, tuple struct or tuple variant Tcl_GetMaster in crate clib --> /home/smaudet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:731:33 | 731 | Interp::from_raw( clib::Tcl_GetMaster( | ^^^^^^^^^^^^^ not found in clib

error[E0425]: cannot find function, tuple struct or tuple variant Tcl_ExposeCommand in crate clib --> /home/smaudet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:757:19 | 757 | clib::Tcl_ExposeCommand( | ^^^^^^^^^^^^^^^^^ not found in clib

error[E0425]: cannot find function, tuple struct or tuple variant Tcl_HideCommand in crate clib --> /home/smaudet/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:788:19 | 788 | clib::Tcl_HideCommand( | ^^^^^^^^^^^^^^^ not found in clib

For more information about this error, try rustc --explain E0425. error: could not compile tcl (lib) due to 7 previous errors

I'm thinking whatever clib does is not enough. It seems to be causing problems, maybe there is something else to replace it with?

Geek2France commented 7 months ago

Hello same problem for me.

$ cargo version cargo 1.77.0 (3fe68eabf 2024-02-29) $ cargo clean -p clib Removed 21 files, 37.4MiB total $ cargo build Compiling clib v0.2.4 Compiling tcl v0.1.9 error[E0425]: cannot find function, tuple struct or tuple variant Tcl_IsSafe in crate clib --> /home/myuser/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:629:19 | 629 | clib::Tcl_IsSafe( self.as_ptr() ) != 0 | ^^^^^^^^^^ not found in clib

error[E0425]: cannot find function, tuple struct or tuple variant Tcl_MakeSafe in crate clib --> /home/myuser/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:653:19 | 653 | clib::Tcl_MakeSafe( self.as_ptr() ).code_to_result( self ) | ^^^^^^^^^^^^ not found in clib

error[E0425]: cannot find function, tuple struct or tuple variant Tcl_CreateSlave in crate clib --> /home/myuser/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:678:54 | 678 | Ok( Interpreter( Interp::from_raw( clib::Tcl_CreateSlave( | ^^^^^^^^^^^^^^^ not found in clib

error[E0425]: cannot find function, tuple struct or tuple variant Tcl_GetSlave in crate clib --> /home/myuser/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:707:33 | 707 | Interp::from_raw( clib::Tcl_GetSlave( | ^^^^^^^^^^^^ not found in clib

error[E0425]: cannot find function, tuple struct or tuple variant Tcl_GetMaster in crate clib --> /home/myuser/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:731:33 | 731 | Interp::from_raw( clib::Tcl_GetMaster( | ^^^^^^^^^^^^^ not found in clib

error[E0425]: cannot find function, tuple struct or tuple variant Tcl_ExposeCommand in crate clib --> /home/myuser/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:757:19 | 757 | clib::Tcl_ExposeCommand( | ^^^^^^^^^^^^^^^^^ not found in clib

error[E0425]: cannot find function, tuple struct or tuple variant Tcl_HideCommand in crate clib --> /home/myuser/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tcl-0.1.9/src/interp.rs:788:19 | 788 | clib::Tcl_HideCommand( | ^^^^^^^^^^^^^^^ not found in clib

For more information about this error, try rustc --explain E0425. error: could not compile tcl (lib) due to 7 previous errors

oooutlk commented 6 months ago

I’m quite busy in past several weeks. Recently I will try to update clib to see if new version will fix your problems.

pgarpgar commented 5 months ago

With Ubuntu 22.04 I needed to install tcl-dev and tk-dev:

sudo apt install tcl-dev tk-dev

profmadden commented 5 months ago

This is similar to troubles I have on a Mac.

It appears that older Tcl/Tk libraries don't have Tcl_IsSafe and similar, so it's not showing up in clib, which is preventing this package from building. For Linux, I think @pgarpgar has the right fix. On the Mac, I'm still fighting with this -- Mac ships with ancient Tcl/Tk, and every step of the build toolchain seems to opt for that instead of a current version that I've compiled. System libraries on the Mac are locked down, so I can't easily replace the old stuff. :-/