You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@teaclave.apache.org by xin201501 <no...@github.com.INVALID> on 2023/01/06 02:37:04 UTC

[apache/incubator-teaclave-sgx-sdk] V2.0.0 preview:can't build `pgx` crate with error:can't find crate for `proc_macro` (Issue #415)

`pgx` is a crate to wirte custom functions to postgres database.
It has `no_std` features to turn off std,(but I think in v2.0.0 we don't have to turn off std for most crates.)
I used the `project template` in the samplecode folder.
Here is my `Cargo.toml` file:
```cargo.toml
[package]
name = "sample"
version = "1.0.0"
authors = ["XXX"]
edition = "2021"

[lib]
name = "sample"
crate-type = ["staticlib"]

[features]
default = ["pg15"]
pg11 = ["pgx/pg11"]
pg12 = ["pgx/pg12"]
pg13 = ["pgx/pg13"]
pg14 = ["pgx/pg14"]
pg15 = ["pgx/pg15"]

[dependencies]
pgx = {version = "0.6.1",default-features = false}

[dev-dependencies]

# uncomment these if compiling outside of 'pgx'
[profile.dev]
panic = "unwind"
lto = "thin"

[profile.release]
panic = "unwind"
opt-level = 3
lto = "fat"
codegen-units = 1
```
---
here is the  compile output:
```zsh
--- samplecode/pgx_in_sgx ‹v2.0.0-preview* ?› » CC=gcc-10 CXX=g++-10 make
/home/xin201501/sgx_sdk_2_17_1/sgxsdk/bin/x64/sgx_edger8r  --trusted enclave/enclave.edl --search-path /home/xin201501/incubator-teaclave-sgx-sdk/common/inc --search-path /home/xin201501/incubator-teaclave-sgx-sdk/sgx_edl/edl --trusted-dir enclave
/home/xin201501/sgx_sdk_2_17_1/sgxsdk/bin/x64/sgx_edger8r  --untrusted enclave/enclave.edl --search-path /home/xin201501/incubator-teaclave-sgx-sdk/common/inc --search-path /home/xin201501/incubator-teaclave-sgx-sdk/sgx_edl/edl --untrusted-dir app
GEN => enclave/enclave_t.c enclave/enclave_t.h app/enclave_u.c app/enclave_u.h
   Compiling sgx_types v2.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/sgx_types)
   Compiling libc v0.2.139
   Compiling sgx_urts v2.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/sgx_urts)
   Compiling app v1.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/samplecode/pgx_in_sgx/app)
   Compiling sgx_uprotected_fs v2.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/sgx_protected_fs/ufs)
    Finished release [optimized] target(s) in 1.58s
LINK => bin/app
    Updating crates.io index
   Compiling compiler_builtins v0.1.82
   Compiling sgx_build_helper v2.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/sgx_build_helper/build_helper)
   Compiling core v0.0.0 (/home/xin201501/.rustup/toolchains/nightly-2022-10-22-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core)
   Compiling sgx_types v2.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/sgx_types)
   Compiling sgx_trts v2.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/sgx_trts)
   Compiling sgx_download_prebuilt v2.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/sgx_build_helper/download_prebuilt)
   Compiling sgx_unwind v2.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/sgx_unwind)
   Compiling sgx_tlibc_sys v2.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/sgx_libc/sgx_tlibc_sys)
   Compiling sgx_crypto_sys v2.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/sgx_crypto/sgx_crypto_sys)
   Compiling rustc-std-workspace-core v1.99.0 (/home/xin201501/.rustup/toolchains/nightly-2022-10-22-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/rustc-std-workspace-core)
   Compiling alloc v0.0.0 (/home/xin201501/.rustup/toolchains/nightly-2022-10-22-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc)
   Compiling sgx_alloc v2.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/sgx_alloc)
   Compiling hashbrown_tstd v0.12.0 (/home/xin201501/incubator-teaclave-sgx-sdk/sgx_tstd/hashbrown)
   Compiling panic_unwind v0.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/rustlib/panic_unwind)
   Compiling sgx_ffi v2.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/sgx_ffi)
   Compiling sgx_sync v2.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/sgx_sync)
   Compiling panic_abort v0.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/rustlib/panic_abort)
   Compiling sgx_oc v2.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/sgx_oc)
   Compiling sgx_rsrvmm v2.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/sgx_rsrvmm)
   Compiling std v0.0.0 (/home/xin201501/incubator-teaclave-sgx-sdk/rustlib/std)
    Finished release [optimized] target(s) in 24.81s
error: failed to parse manifest at `/home/xin201501/incubator-teaclave-sgx-sdk/samplecode/pgx_in_sgx/enclave/Cargo.toml`

Caused by:
  feature `pg11` includes `pgx-tests/pg11`, but `pgx-tests` is not a dependency
make: *** [Makefile:181:enclave] 错误 101
--- samplecode/pgx_in_sgx ‹v2.0.0-preview* ?› » CC=gcc-10 CXX=g++-10 make   2 ↵
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Blocking waiting for file lock on package cache
    Finished release [optimized] target(s) in 1.22s
LINK => bin/app
    Finished release [optimized] target(s) in 0.09s
   Compiling proc-macro2 v1.0.49
   Compiling quote v1.0.23
   Compiling unicode-ident v1.0.6
   Compiling syn v1.0.107
   Compiling autocfg v1.1.0
   Compiling memchr v2.5.0
   Compiling libc v0.2.139
   Compiling cfg-if v1.0.0
   Compiling log v0.4.17
   Compiling serde v1.0.152
   Compiling serde_derive v1.0.152
   Compiling once_cell v1.17.0
   Compiling eyre v0.6.8
   Compiling serde_json v1.0.91
   Compiling regex-syntax v0.6.28
   Compiling thiserror v1.0.38
   Compiling lazy_static v1.4.0
   Compiling indexmap v1.9.2
   Compiling crossbeam-utils v0.8.14
   Compiling memoffset v0.7.1
   Compiling tracing-core v0.1.30
   Compiling crossbeam-epoch v0.9.13
   Compiling tinyvec_macros v0.1.0
   Compiling pin-project-lite v0.2.9
   Compiling aho-corasick v0.7.20
   Compiling overload v0.1.1
   Compiling glob v0.3.0
   Compiling tinyvec v1.6.0
   Compiling nu-ansi-term v0.46.0
   Compiling tracing-log v0.1.3
   Compiling clang-sys v1.4.0
   Compiling sharded-slab v0.1.4
   Compiling thread_local v1.1.4
   Compiling indenter v0.3.3
   Compiling hashbrown v0.12.3
   Compiling ryu v1.0.12
   Compiling itoa v1.0.5
   Compiling smallvec v1.10.0
   Compiling ucd-trie v0.1.5
   Compiling scopeguard v1.1.0
   Compiling unicode-normalization v0.1.22
   Compiling unicode-bidi v0.3.8
   Compiling minimal-lexical v0.2.1
   Compiling seq-macro v0.3.2
   Compiling rayon-core v1.10.1
   Compiling regex-automata v0.1.10
   Compiling regex v1.7.0
   Compiling percent-encoding v2.2.0
   Compiling semver v1.0.16
   Compiling fixedbitset v0.4.2
   Compiling cty v0.2.2
   Compiling form_urlencoded v1.1.0
   Compiling cstr_core v0.2.6
   Compiling nom v7.1.2
   Compiling petgraph v0.6.2
   Compiling idna v0.3.0
   Compiling crossbeam-deque v0.8.2
   Compiling matchers v0.1.0
   Compiling crossbeam-channel v0.5.6
   Compiling dirs-sys v0.3.7
   Compiling num_cpus v1.15.0
   Compiling atty v0.2.14
   Compiling libloading v0.7.4
   Compiling unescape v0.1.0
   Compiling convert_case v0.5.0
   Compiling bindgen v0.60.1
error[E0463]: can't find crate for `proc_macro`
   --> /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.49/src/lib.rs:122:1
    |
122 | extern crate proc_macro;
    | ^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error[E0635]: unknown feature `proc_macro_span`
  --> /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.49/src/lib.rs:92:13
   |
92 |     feature(proc_macro_span, proc_macro_span_shrink)
   |             ^^^^^^^^^^^^^^^

error[E0635]: unknown feature `proc_macro_span_shrink`
  --> /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.49/src/lib.rs:92:30
   |
92 |     feature(proc_macro_span, proc_macro_span_shrink)
   |                              ^^^^^^^^^^^^^^^^^^^^^^

Some errors have detailed explanations: E0463, E0635.
For more information about an error, try `rustc --explain E0463`.
error: could not compile `proc-macro2` due to 3 previous errors
warning: build failed, waiting for other jobs to finish...
make: *** [Makefile:181:enclave] 错误 101
```
I think the real "problematic crate" may be `proc-marco2` crate.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/415
You are receiving this because you are subscribed to this thread.

Message ID: <ap...@github.com>

Re: [apache/incubator-teaclave-sgx-sdk] V2.0.0 preview:can't build `pgx` crate with error:can't find crate for `proc_macro` (Issue #415)

Posted by xin201501 <no...@github.com.INVALID>.
Closed #415 as completed.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/415#event-8313066169
You are receiving this because you are subscribed to this thread.

Message ID: <ap...@github.com>

Re: [apache/incubator-teaclave-sgx-sdk] V2.0.0 preview:can't build `pgx` crate with error:can't find crate for `proc_macro` (Issue #415)

Posted by volcano <no...@github.com.INVALID>.
Thanks for reporting this issue. I solved it by adding `proc-macro` to sysroot. I updated `template`, you can try to compile your project again.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/415#issuecomment-1374504428
You are receiving this because you are subscribed to this thread.

Message ID: <ap...@github.com>

Re: [apache/incubator-teaclave-sgx-sdk] V2.0.0 preview:can't build `pgx` crate with error:can't find crate for `proc_macro` (Issue #415)

Posted by xin201501 <no...@github.com.INVALID>.
Thanks!
**It compiles when only adding this crate `pgx` as a dependency and not using it to write some functions.**(In other words no functions use this dependency).
When using it to write some Enclave functions,**the enclave part of my project finishes compiling,but fails to link**:
```zsh
    Finished dev [unoptimized + debuginfo] target(s) in 1m 23s
/usr/bin/ld: ./lib/libenclave.a(pgx_pg_sys-fc533ebe75dea904.pgx_pg_sys.646afbca-cgu.9.rcgu.o): in function `pgx_pg_sys::submodules::panic::do_ereport':
/home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/panic.rs:368: undefined reference to `ErrorContext'
/usr/bin/ld: ./lib/libenclave.a(pgx_pg_sys-fc533ebe75dea904.pgx_pg_sys.646afbca-cgu.9.rcgu.o): in function `pgx_pg_sys::all_versions::MemoryContextSwitchTo':
/home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/lib.rs:513: undefined reference to `CurrentMemoryContext'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/lib.rs:515: undefined reference to `CurrentMemoryContext'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/lib.rs:513: undefined reference to `CurrentMemoryContext'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/lib.rs:515: undefined reference to `CurrentMemoryContext'
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o): in function `list_nth_cell':
/home/xin201501/.pgx/15.1/pgx-install/include/postgresql/server/nodes/pg_list.h:258: undefined reference to `ExceptionalCondition'
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o): in function `list_nth':
/home/xin201501/.pgx/15.1/pgx-install/include/postgresql/server/nodes/pg_list.h:280: undefined reference to `ExceptionalCondition'
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o): in function `GetMemoryChunkContext':
/home/xin201501/.pgx/15.1/pgx-install/include/postgresql/server/utils/memutils.h:131: undefined reference to `ExceptionalCondition'
/usr/bin/ld: /home/xin201501/.pgx/15.1/pgx-install/include/postgresql/server/utils/memutils.h:124: undefined reference to `ExceptionalCondition'
/usr/bin/ld: /home/xin201501/.pgx/15.1/pgx-install/include/postgresql/server/utils/memutils.h:123: undefined reference to `ExceptionalCondition'
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o): in function `pgx_elog':
/home/xin201501/incubator-teaclave-sgx-sdk/samplecode/template/enclave/target/x86_64-unknown-linux-sgx/debug/build/pgx-pg-sys-451c5dc41c4634b5/out/cshim/pgx-cshim.c:38: undefined reference to `errstart'
/usr/bin/ld: /home/xin201501/incubator-teaclave-sgx-sdk/samplecode/template/enclave/target/x86_64-unknown-linux-sgx/debug/build/pgx-pg-sys-451c5dc41c4634b5/out/cshim/pgx-cshim.c:38: undefined reference to `errmsg_internal'
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o): in function `pgx_ereport':
/home/xin201501/incubator-teaclave-sgx-sdk/samplecode/template/enclave/target/x86_64-unknown-linux-sgx/debug/build/pgx-pg-sys-451c5dc41c4634b5/out/cshim/pgx-cshim.c:98: undefined reference to `errstart'
/usr/bin/ld: /home/xin201501/incubator-teaclave-sgx-sdk/samplecode/template/enclave/target/x86_64-unknown-linux-sgx/debug/build/pgx-pg-sys-451c5dc41c4634b5/out/cshim/pgx-cshim.c:99: undefined reference to `errcode'
/usr/bin/ld: /home/xin201501/incubator-teaclave-sgx-sdk/samplecode/template/enclave/target/x86_64-unknown-linux-sgx/debug/build/pgx-pg-sys-451c5dc41c4634b5/out/cshim/pgx-cshim.c:100: undefined reference to `errmsg'
/usr/bin/ld: /home/xin201501/incubator-teaclave-sgx-sdk/samplecode/template/enclave/target/x86_64-unknown-linux-sgx/debug/build/pgx-pg-sys-451c5dc41c4634b5/out/cshim/pgx-cshim.c:102: undefined reference to `errdetail'
/usr/bin/ld: /home/xin201501/incubator-teaclave-sgx-sdk/samplecode/template/enclave/target/x86_64-unknown-linux-sgx/debug/build/pgx-pg-sys-451c5dc41c4634b5/out/cshim/pgx-cshim.c:105: undefined reference to `errcontext_msg'
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o): in function `fastgetattr':
/home/xin201501/.pgx/15.1/pgx-install/include/postgresql/server/access/htup_details.h:761: undefined reference to `ExceptionalCondition'
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o): in function `list_nth_cell':
/home/xin201501/.pgx/15.1/pgx-install/include/postgresql/server/nodes/pg_list.h:259: undefined reference to `ExceptionalCondition'
/usr/bin/ld: /home/xin201501/.pgx/15.1/pgx-install/include/postgresql/server/nodes/pg_list.h:259: undefined reference to `ExceptionalCondition'
/usr/bin/ld: /home/xin201501/.pgx/15.1/pgx-install/include/postgresql/server/nodes/pg_list.h:259: undefined reference to `ExceptionalCondition'
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o): in function `list_nth_int':
/home/xin201501/.pgx/15.1/pgx-install/include/postgresql/server/nodes/pg_list.h:291: undefined reference to `ExceptionalCondition'
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o):/home/xin201501/.pgx/15.1/pgx-install/include/postgresql/server/nodes/pg_list.h:259: more undefined references to `ExceptionalCondition' follow
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o): in function `pgx_elog':
/home/xin201501/incubator-teaclave-sgx-sdk/samplecode/template/enclave/target/x86_64-unknown-linux-sgx/debug/build/pgx-pg-sys-451c5dc41c4634b5/out/cshim/pgx-cshim.c:38: undefined reference to `errfinish'
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o): in function `pgx_errcontext_msg':
/home/xin201501/incubator-teaclave-sgx-sdk/samplecode/template/enclave/target/x86_64-unknown-linux-sgx/debug/build/pgx-pg-sys-451c5dc41c4634b5/out/cshim/pgx-cshim.c:48: undefined reference to `errcontext_msg'
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o): in function `pgx_ereport':
/home/xin201501/incubator-teaclave-sgx-sdk/samplecode/template/enclave/target/x86_64-unknown-linux-sgx/debug/build/pgx-pg-sys-451c5dc41c4634b5/out/cshim/pgx-cshim.c:107: undefined reference to `errfinish'
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o): in function `heap_getattr':
/home/xin201501/.pgx/15.1/pgx-install/include/postgresql/server/access/htup_details.h:798: undefined reference to `getmissingattr'
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o): in function `fastgetattr':
/home/xin201501/.pgx/15.1/pgx-install/include/postgresql/server/access/htup_details.h:764: undefined reference to `nocachegetattr'
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o): in function `heap_getattr':
/home/xin201501/.pgx/15.1/pgx-install/include/postgresql/server/access/htup_details.h:803: undefined reference to `heap_getsysattr'
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o): in function `pgx_ARR_NELEMS':
/home/xin201501/incubator-teaclave-sgx-sdk/samplecode/template/enclave/target/x86_64-unknown-linux-sgx/debug/build/pgx-pg-sys-451c5dc41c4634b5/out/cshim/pgx-cshim.c:201: undefined reference to `ArrayGetNItems'
/usr/bin/ld: ./lib/libenclave.a(pgx-cshim.o): in function `pgx_SpinLockAcquire':
/home/xin201501/incubator-teaclave-sgx-sdk/samplecode/template/enclave/target/x86_64-unknown-linux-sgx/debug/build/pgx-pg-sys-451c5dc41c4634b5/out/cshim/pgx-cshim.c:231: undefined reference to `s_lock'
/usr/bin/ld: ./lib/libenclave.a(pgx_pg_sys-fc533ebe75dea904.pgx_pg_sys.646afbca-cgu.15.rcgu.o): in function `pgx_pg_sys::submodules::thread_check::init_active_thread':
/home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/thread_check.rs:41: undefined reference to `pthread_atfork'
/usr/bin/ld: ./lib/libenclave.a(pgx_pg_sys-fc533ebe75dea904.pgx_pg_sys.646afbca-cgu.3.rcgu.o): in function `pgx_pg_sys::submodules::ffi::pg_guard_ffi_boundary_impl':
/home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:72: undefined reference to `CurrentMemoryContext'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:73: undefined reference to `PG_exception_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:74: undefined reference to `error_context_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:76: undefined reference to `__sigsetjmp'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:80: undefined reference to `PG_exception_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:100: undefined reference to `CurrentMemoryContext'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:129: undefined reference to `PG_exception_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:130: undefined reference to `error_context_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:86: undefined reference to `PG_exception_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:87: undefined reference to `error_context_stack'
/usr/bin/ld: ./lib/libenclave.a(pgx_pg_sys-fc533ebe75dea904.pgx_pg_sys.646afbca-cgu.3.rcgu.o): in function `pgx_pg_sys::pg15::CopyErrorData::{{closure}}':
/home/xin201501/incubator-teaclave-sgx-sdk/samplecode/template/enclave/target/x86_64-unknown-linux-sgx/debug/build/pgx-pg-sys-451c5dc41c4634b5/out/pg15.rs:13399: undefined reference to `CopyErrorData'
/usr/bin/ld: ./lib/libenclave.a(pgx_pg_sys-fc533ebe75dea904.pgx_pg_sys.646afbca-cgu.3.rcgu.o): in function `pgx_pg_sys::submodules::ffi::pg_guard_ffi_boundary_impl':
/home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:72: undefined reference to `CurrentMemoryContext'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:73: undefined reference to `PG_exception_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:74: undefined reference to `error_context_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:76: undefined reference to `__sigsetjmp'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:80: undefined reference to `PG_exception_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:100: undefined reference to `CurrentMemoryContext'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:129: undefined reference to `PG_exception_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:130: undefined reference to `error_context_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:86: undefined reference to `PG_exception_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:87: undefined reference to `error_context_stack'
/usr/bin/ld: ./lib/libenclave.a(pgx_pg_sys-fc533ebe75dea904.pgx_pg_sys.646afbca-cgu.3.rcgu.o): in function `pgx_pg_sys::pg15::FreeErrorData::{{closure}}':
/home/xin201501/incubator-teaclave-sgx-sdk/samplecode/template/enclave/target/x86_64-unknown-linux-sgx/debug/build/pgx-pg-sys-451c5dc41c4634b5/out/pg15.rs:13408: undefined reference to `FreeErrorData'
/usr/bin/ld: ./lib/libenclave.a(pgx_pg_sys-fc533ebe75dea904.pgx_pg_sys.646afbca-cgu.3.rcgu.o): in function `pgx_pg_sys::submodules::ffi::pg_guard_ffi_boundary_impl':
/home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:72: undefined reference to `CurrentMemoryContext'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:73: undefined reference to `PG_exception_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:74: undefined reference to `error_context_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:76: undefined reference to `__sigsetjmp'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:80: undefined reference to `PG_exception_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:100: undefined reference to `CurrentMemoryContext'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:129: undefined reference to `PG_exception_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:130: undefined reference to `error_context_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:86: undefined reference to `PG_exception_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:87: undefined reference to `error_context_stack'
/usr/bin/ld: ./lib/libenclave.a(pgx_pg_sys-fc533ebe75dea904.pgx_pg_sys.646afbca-cgu.3.rcgu.o): in function `pgx_pg_sys::pg15::palloc0::{{closure}}':
/home/xin201501/incubator-teaclave-sgx-sdk/samplecode/template/enclave/target/x86_64-unknown-linux-sgx/debug/build/pgx-pg-sys-451c5dc41c4634b5/out/pg15.rs:13716: undefined reference to `palloc0'
/usr/bin/ld: ./lib/libenclave.a(pgx_pg_sys-fc533ebe75dea904.pgx_pg_sys.646afbca-cgu.3.rcgu.o): in function `pgx_pg_sys::submodules::ffi::pg_guard_ffi_boundary_impl':
/home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:72: undefined reference to `CurrentMemoryContext'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:73: undefined reference to `PG_exception_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:74: undefined reference to `error_context_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:76: undefined reference to `__sigsetjmp'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:80: undefined reference to `PG_exception_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:100: undefined reference to `CurrentMemoryContext'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:129: undefined reference to `PG_exception_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:130: undefined reference to `error_context_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:86: undefined reference to `PG_exception_stack'
/usr/bin/ld: /home/xin201501/.cargo/registry/src/github.com-1ecc6299db9ec823/pgx-pg-sys-0.6.1/src/submodules/ffi.rs:87: undefined reference to `error_context_stack'
/usr/bin/ld: ./lib/libenclave.a(pgx_pg_sys-fc533ebe75dea904.pgx_pg_sys.646afbca-cgu.3.rcgu.o): in function `pgx_pg_sys::pg15::pfree::{{closure}}':
/home/xin201501/incubator-teaclave-sgx-sdk/samplecode/template/enclave/target/x86_64-unknown-linux-sgx/debug/build/pgx-pg-sys-451c5dc41c4634b5/out/pg15.rs:13755: undefined reference to `pfree'
collect2: error: ld returned 1 exit status
make: *** [Makefile:160:bin/enclave.so] 错误 1
```
---
Many `undefined references` are used by `pg_sys` crate,an underlying crate which has many `FFI Calls` to communicate with underlying database.
I found that this `pg_sys` crate uses its own `CFLAGS` to compile some C code.Perhaps they are not compatible with enclave environment.
These C functions are indeed hard to deal with.We almost have no control of them...

-- 
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/415#issuecomment-1374742943
You are receiving this because you are subscribed to this thread.

Message ID: <ap...@github.com>