Skip to content

error: linking with cc failed: exit status: 1 #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
shijunti19 opened this issue Jul 17, 2023 · 1 comment
Closed

error: linking with cc failed: exit status: 1 #133

shijunti19 opened this issue Jul 17, 2023 · 1 comment

Comments

@shijunti19
Copy link

Is it related to my inability to compile on Centos
rust-lang/rust#113104

rustc --version
rustc 1.69.0 (84c898d65 2023-04-16)

"-Wl,-z,relro,-z,now" "-Wl,-O1" "-nodefaultlibs"
  = note: /usr/bin/ld: /mnt/x/xiaolu/rust/php/a031/target/release/deps/a031-2138c8368c6736ee.a031.6483571e-cgu.12.rcgu.o: in function `phper::functions::call_raw_common':
          a031.6483571e-cgu.12:(.text._ZN5phper9functions15call_raw_common17hb55ad66c3e9ecf43E+0x75): undefined reference to `executor_globals'
          /usr/bin/ld: /mnt/x/xiaolu/rust/php/a031/target/release/deps/a031-2138c8368c6736ee.a031.6483571e-cgu.12.rcgu.o: in function `phper::functions::ZFunc::call':
          a031.6483571e-cgu.12:(.text._ZN5phper9functions5ZFunc4call17h991d71825814632dE+0x55): undefined reference to `zend_call_known_function'
          /usr/bin/ld: a031.6483571e-cgu.12:(.text._ZN5phper9functions5ZFunc4call17h991d71825814632dE+0x93): undefined reference to `executor_globals'
          /usr/bin/ld: /mnt/x/xiaolu/rust/php/a031/target/release/deps/a031-2138c8368c6736ee.a031.6483571e-cgu.9.rcgu.o: in function `a031::main':
          a031.6483571e-cgu.9:(.text._ZN4a0314main17hb40a4c8c9b22b24fE+0xc): undefined reference to `zend_ce_exception'
          /usr/bin/ld: a031.6483571e-cgu.9:(.text._ZN4a0314main17hb40a4c8c9b22b24fE+0x8a): undefined reference to `zend_update_property'
          /usr/bin/ld: /mnt/x/xiaolu/rust/php/a031/target/release/deps/libphper-17ed872cf194abb4.rlib(phper-17ed872cf194abb4.phper.2ca4b959-cgu.13.rcgu.o): in function `<phper::types::TypeInfo as core::fmt::Debug>::fmt':
          phper.2ca4b959-cgu.13:(.text._ZN59_$LT$phper..types..TypeInfo$u20$as$u20$core..fmt..Debug$GT$3fmt17hdae16aadc0245db3E+0xdb): undefined reference to `zend_get_type_by_const'
          /usr/bin/ld: /mnt/x/xiaolu/rust/php/a031/target/release/deps/libphper-17ed872cf194abb4.rlib(phper-17ed872cf194abb4.phper.2ca4b959-cgu.14.rcgu.o): in function `std::thread::local::LocalKey<T>::with':
          phper.2ca4b959-cgu.14:(.text._ZN3std6thread5local17LocalKey$LT$T$GT$4with17h5840b6fcea976187E+0x23): undefined reference to `executor_globals'
          /usr/bin/ld: /mnt/x/xiaolu/rust/php/a031/target/release/deps/libphper-17ed872cf194abb4.rlib(phper-17ed872cf194abb4.phper.2ca4b959-cgu.14.rcgu.o): in function `std::thread::local::LocalKey<T>::with':
          phper.2ca4b959-cgu.14:(.text._ZN3std6thread5local17LocalKey$LT$T$GT$4with17haca76368edcb164eE+0x3d): undefined reference to `executor_globals'
          /usr/bin/ld: /mnt/x/xiaolu/rust/php/a031/target/release/deps/libphper-17ed872cf194abb4.rlib(phper-17ed872cf194abb4.phper.2ca4b959-cgu.4.rcgu.o): in function `phper::errors::ThrowObject::new':
          phper.2ca4b959-cgu.4:(.text._ZN5phper6errors11ThrowObject3new17h55aaf068a425ee7dE+0x1e): undefined reference to `zend_ce_throwable'
          /usr/bin/ld: /mnt/x/xiaolu/rust/php/a031/target/release/deps/libphper_sys-ef863276b04bb385.rlib(php_wrapper.o): in function `phper_zval_ptr_dtor':
          php_wrapper.c:(.text.phper_zval_ptr_dtor+0x1): undefined reference to `zval_ptr_dtor'
          /usr/bin/ld: /mnt/x/xiaolu/rust/php/a031/target/release/deps/libphper_sys-ef863276b04bb385.rlib(php_wrapper.o): in function `phper_object_init_ex':
          php_wrapper.c:(.text.phper_object_init_ex+0x5): undefined reference to `object_init_ex'
          /usr/bin/ld: /mnt/x/xiaolu/rust/php/a031/target/release/deps/libphper_sys-ef863276b04bb385.rlib(php_wrapper.o): in function `phper_zend_object_release':
          php_wrapper.c:(.text.phper_zend_object_release+0x11): undefined reference to `zend_objects_store_del'
          /usr/bin/ld: php_wrapper.c:(.text.phper_zend_object_release+0x19): undefined reference to `gc_possible_root'
          /usr/bin/ld: /mnt/x/xiaolu/rust/php/a031/target/release/deps/libphper_sys-ef863276b04bb385.rlib(php_wrapper.o): in function `phper_instanceof_function':
          php_wrapper.c:(.text.phper_instanceof_function+0x6): undefined reference to `instanceof_function_slow'
          /usr/bin/ld: /mnt/x/xiaolu/rust/php/a031/target/release/deps/libphper_sys-ef863276b04bb385.rlib(php_wrapper.o): in function `phper_emalloc':
          php_wrapper.c:(.text.phper_emalloc+0x1): undefined reference to `_emalloc'
          collect2: error: ld returned 1 exit status

  = note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

error: could not compile `a031` due to previous error

Caused by:
  process didn't exit successfully: `rustc --crate-name a031 --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=120 --crate-type bin --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C metadata=2138c8368c6736ee -C extra-filename=-2138c8368c6736ee --out-dir /mnt/x/xiaolu/rust/php/a031/target/release/deps -L dependency=/mnt/x/xiaolu/rust/php/a031/target/release/deps --extern a031=/mnt/x/xiaolu/rust/php/a031/target/release/deps/liba031-8b142ad1b90c8d09.rlib --extern gmsm=/mnt/x/xiaolu/rust/php/a031/target/release/deps/libgmsm-5165a464c849750b.rlib --extern hex=/mnt/x/xiaolu/rust/php/a031/target/release/deps/libhex-bac9e27907d25766.rlib --extern idgenerator_thin=/mnt/x/xiaolu/rust/php/a031/target/release/deps/libidgenerator_thin-4fc1f95ac416344a.rlib --extern jieba_rs=/mnt/x/xiaolu/rust/php/a031/target/release/deps/libjieba_rs-9e0c58d1ab587520.rlib --extern phper=/mnt/x/xiaolu/rust/php/a031/target/release/deps/libphper-17ed872cf194abb4.rlib --extern quick_xml=/mnt/x/xiaolu/rust/php/a031/target/release/deps/libquick_xml-e26f1081692a9d8d.rlib -L native=/mnt/x/xiaolu/rust/php/a031/target/release/build/phper-sys-8ec2937c074e2932/out` (exit status: 1)
@shijunti19
Copy link
Author

I can compile normally after deleting main

main.rs

use phper::{errors::exception_class, objects::ZObject};
fn main() {
    let mut result: ZObject = exception_class().new_object([]).unwrap();
    result.set_property("code", 403);
    println!("结果:{:?}", result);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant