davidcole1340 / ext-php-rs

Bindings for the Zend API to build PHP extensions natively in Rust.
Apache License 2.0
598 stars 64 forks source link

Undefined symbols while building #311

Closed shyim closed 8 months ago

shyim commented 8 months ago

I am trying to build the hello world application with PHP 8.1.27 on my mac and getting following error.

 = note: Undefined symbols for architecture arm64:
            "_zend_ce_traversable", referenced from:
                ext_php_rs::zend::ce::traversable::h089e7d6026267058 in libext_php_rs-669e74370219ea33.rlib(ext_php_rs-669e74370219ea33.ext_php_rs.4306f0632f9e2866-cgu.09.rcgu.o)
            "_zend_ce_exception", referenced from:
                ext_php_rs::zend::ce::exception::he44752202538fe3f in libext_php_rs-669e74370219ea33.rlib(ext_php_rs-669e74370219ea33.ext_php_rs.4306f0632f9e2866-cgu.09.rcgu.o)
            "_zend_hash_get_current_key_zval_ex", referenced from:
                ext_php_rs::types::array::Iter::next_zval::hbff174f56c838cae in libext_php_rs-669e74370219ea33.rlib(ext_php_rs-669e74370219ea33.ext_php_rs.4306f0632f9e2866-cgu.08.rcgu.o)
            "_zend_hash_move_forward_ex", referenced from:
                ext_php_rs::types::array::Iter::next_zval::hbff174f56c838cae in libext_php_rs-669e74370219ea33.rlib(ext_php_rs-669e74370219ea33.ext_php_rs.4306f0632f9e2866-cgu.08.rcgu.o)
            "_zend_objects_store_del", referenced from:
                _ext_php_rs_zend_object_release in libext_php_rs-669e74370219ea33.rlib(2e40c9e35e9506f4-wrapper.o)
            "__efree", referenced from:
                _ext_php_rs_zend_string_release in libext_php_rs-669e74370219ea33.rlib(2e40c9e35e9506f4-wrapper.o)
            "__emalloc", referenced from:
                _ext_php_rs_zend_string_init in libext_php_rs-669e74370219ea33.rlib(2e40c9e35e9506f4-wrapper.o)
            "_zend_hash_get_current_key_type_ex", referenced from:
                ext_php_rs::types::array::Iter::next_zval::hbff174f56c838cae in libext_php_rs-669e74370219ea33.rlib(ext_php_rs-669e74370219ea33.ext_php_rs.4306f0632f9e2866-cgu.08.rcgu.o)
            "_zend_hash_get_current_data_ex", referenced from:
                ext_php_rs::types::array::Iter::next_zval::hbff174f56c838cae in libext_php_rs-669e74370219ea33.rlib(ext_php_rs-669e74370219ea33.ext_php_rs.4306f0632f9e2866-cgu.08.rcgu.o)
            "_gc_possible_root", referenced from:
                _ext_php_rs_zend_object_release in libext_php_rs-669e74370219ea33.rlib(2e40c9e35e9506f4-wrapper.o)
            "___zend_malloc", referenced from:
                _ext_php_rs_zend_string_init in libext_php_rs-669e74370219ea33.rlib(2e40c9e35e9506f4-wrapper.o)
            "_zend_throw_exception_object", referenced from:
                ext_php_rs::exception::throw_object::he7478897a957b4ab in libext_php_rs-669e74370219ea33.rlib(ext_php_rs-669e74370219ea33.ext_php_rs.4306f0632f9e2866-cgu.07.rcgu.o)
            "_instanceof_function_slow", referenced from:
                ext_php_rs::zend::class::_$LT$impl$u20$ext_php_rs..ffi.._zend_class_entry$GT$::instance_of::h847453b79ebb6b71 in libext_php_rs-669e74370219ea33.rlib(ext_php_rs-669e74370219ea33.ext_php_rs.4306f0632f9e2866-cgu.04.rcgu.o)
            "_zend_throw_exception_ex", referenced from:
                ext_php_rs::exception::throw_with_code::h9b9f9fcb81de2ea4 in libext_php_rs-669e74370219ea33.rlib(ext_php_rs-669e74370219ea33.ext_php_rs.4306f0632f9e2866-cgu.07.rcgu.o)
            "_zend_is_iterable", referenced from:
                ext_php_rs::types::zval::_$LT$impl$u20$ext_php_rs..ffi.._zval_struct$GT$::is_iterable::h019be3c154175dc9 in libext_php_rs-669e74370219ea33.rlib(ext_php_rs-669e74370219ea33.ext_php_rs.4306f0632f9e2866-cgu.04.rcgu.o)
            "_zval_ptr_dtor", referenced from:
                ext_php_rs::types::zval::_$LT$impl$u20$ext_php_rs..ffi.._zval_struct$GT$::change_type::hf2bebe82b351de42 in libext_php_rs-669e74370219ea33.rlib(ext_php_rs-669e74370219ea33.ext_php_rs.4306f0632f9e2866-cgu.04.rcgu.o)
            "_zend_wrong_parameters_count_error", referenced from:
                ext_php_rs::args::ArgParser::parse::h1babdec6352b98c6 in libext_php_rs-669e74370219ea33.rlib(ext_php_rs-669e74370219ea33.ext_php_rs.4306f0632f9e2866-cgu.11.rcgu.o)
          ld: symbol(s) not found for architecture arm64
          clang-16: error: linker command failed with exit code 1 (use -v to see invocation)

I am getting kinda the same error with PHP 8.3.3, seems not related to a specific PHP version. Maybe something changed in newer patch versions?

ryangjchandler commented 8 months ago

Have you followed the steps here? https://davidcole1340.github.io/ext-php-rs/getting-started/hello_world.html#cargoconfigtoml

shyim commented 8 months ago

ohh lol. didn't saw that while trying out the hello world 🙈 . Now it it is working. sorry :) At least when someone else searches for an issue, they will find this 😅