Skip to content

error: macro undefined: 'phf_map' #29

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
zr40 opened this issue Feb 6, 2014 · 9 comments
Closed

error: macro undefined: 'phf_map' #29

zr40 opened this issue Feb 6, 2014 · 9 comments

Comments

@zr40
Copy link
Contributor

zr40 commented Feb 6, 2014

Building rust-postgres fails with the following error:

$ make
rustc -O -Z debug-info -L submodules/rust-openssl/build/ -L submodules/rust-phf/build/ -L submodules/rust-phf/build/ --dep-info build/postgres.d \
        --out-dir build src/lib.rs
src/error.rs:18:54: 18:61 error: macro undefined: 'phf_map'
src/error.rs:18         static STATE_MAP: PhfMap<PostgresSqlState> = phf_map!(
                                                                     ^~~~~~~
error: aborting due to previous error
make: *** [build/libpostgres-e8d942e6-0.0.rlib] Segmentation fault: 11
@sfackler
Copy link
Owner

sfackler commented Feb 6, 2014

The fact that it segfaults after this is pretty disturbing. What OS are you on? Linux?

@zr40
Copy link
Contributor Author

zr40 commented Feb 6, 2014

I'm on OS X Mavericks.

Here's the lldb backtrace when the segfault occurs:

Current executable set to 'rustc' (x86_64).
(lldb) run
Process 37946 launched: '/usr/local/bin/rustc' (x86_64)
src/error.rs:18:54: 18:61 error: macro undefined: 'phf_map'
src/error.rs:18         static STATE_MAP: PhfMap<PostgresSqlState> = phf_map!(
                                                                     ^~~~~~~
error: aborting due to previous error
Process 37946 stopped
* thread #2: tid = 0xb8cdbd, 0x00000001000a8613 libstd-966edb7e-0.10-pre.dylib`rt::task::__extensions__::run::anon::anon::expr_fn::al + 227, stop reason = EXC_BAD_ACCESS (code=1, address=0x10e4a0b30)
    frame #0: 0x00000001000a8613 libstd-966edb7e-0.10-pre.dylib`rt::task::__extensions__::run::anon::anon::expr_fn::al + 227
libstd-966edb7e-0.10-pre.dylib`rt::task::__extensions__::run::anon::anon::expr_fn::al + 227:
-> 0x1000a8613:  movq   (%rax), %rax
   0x1000a8616:  movq   %rbx, %rdi
   0x1000a8619:  callq  *%rax
   0x1000a861b:  leaq   40(%rbx), %rax
(lldb) bt
* thread #2: tid = 0xb8cdbd, 0x00000001000a8613 libstd-966edb7e-0.10-pre.dylib`rt::task::__extensions__::run::anon::anon::expr_fn::al + 227, stop reason = EXC_BAD_ACCESS (code=1, address=0x10e4a0b30)
    frame #0: 0x00000001000a8613 libstd-966edb7e-0.10-pre.dylib`rt::task::__extensions__::run::anon::anon::expr_fn::al + 227
    frame #1: 0x0000000103b019b0
    frame #2: 0x00000001000a851f libstd-966edb7e-0.10-pre.dylib`rt::task::__extensions__::run::anon::expr_fn::ak + 79
    frame #3: 0x00000001000afa8c libstd-966edb7e-0.10-pre.dylib`rust_try + 12
    frame #4: 0x00000001000a8471 libstd-966edb7e-0.10-pre.dylib`rt::task::Task::run::h4d70bc3149520857ppah::v0.10.pre + 81
    frame #5: 0x00000001005ca70e libgreen-80d9e76a-0.10-pre.dylib`task::__extensions__::build_start_wrapper::anon::expr_fn::aD + 302
(lldb) 

@sfackler
Copy link
Owner

sfackler commented Feb 7, 2014

I can't repro this on my MacBook. Could you post the console output from a clean clone, configure and build?

@zr40
Copy link
Contributor Author

zr40 commented Feb 7, 2014

Same result. Rust itself is freshly built from master (commit rust-lang/rust@c3ccaac).

$ git clone https://github.com/sfackler/rust-postgres.git test/rust-postgres
Cloning into 'test/rust-postgres'...
remote: Reusing existing pack: 1913, done.
remote: Counting objects: 22, done.
remote: Compressing objects: 100% (22/22), done.
remote: Total 1935 (delta 7), reused 0 (delta 0)
Receiving objects: 100% (1935/1935), 717.89 KiB | 692.00 KiB/s, done.
Resolving deltas: 100% (1079/1079), done.
Checking connectivity... done
$ cd test/rust-postgres 
$ ./configure 
Submodule 'submodules/rust-openssl' (git://github.com/sfackler/rust-openssl) registered for path 'submodules/rust-openssl'
Submodule 'submodules/rust-phf' (git://github.com/sfackler/rust-phf) registered for path 'submodules/rust-phf'
Cloning into 'submodules/rust-openssl'...
remote: Reusing existing pack: 717, done.
remote: Total 717 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (717/717), 213.75 KiB | 0 bytes/s, done.
Resolving deltas: 100% (424/424), done.
Checking connectivity... done
Submodule path 'submodules/rust-openssl': checked out '490e518c6d24cd5418bbe5a2b7b0dec9c0d0bef4'
Cloning into 'submodules/rust-phf'...
remote: Counting objects: 179, done.
remote: Compressing objects: 100% (66/66), done.
remote: Total 179 (delta 109), reused 176 (delta 107)
Receiving objects: 100% (179/179), 26.28 KiB | 0 bytes/s, done.
Resolving deltas: 100% (109/109), done.
Checking connectivity... done
Submodule path 'submodules/rust-phf': checked out '16947cf75b2f49de80c86efb070e988a935cc1e7'
$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C submodules/rust-phf
mkdir -p build
rustc -O -Z extra-debug-info --dep-info build/phf.d --out-dir build phf.rs
rustc -O -Z extra-debug-info --dep-info build/phf_mac.d --out-dir build \
        -L build phf_mac.rs
touch submodules/rust-phf/build/libphf_mac-45b0b9bb-0.0.dylib submodules/rust-phf/build/libphf-fb3ec40e-0.0.dylib submodules/rust-phf/build/libphf-fb3ec40e-0.0.rlib
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C submodules/rust-openssl
mkdir -p build
rustc -O -Z debug-info --dep-info build/openssl.d --out-dir build lib.rs
ssl/mod.rs:469:21: 469:33 warning: unused result which must be used, #[warn(unused_must_use)] on by default
ssl/mod.rs:469                     self.flush();
                                   ^~~~~~~~~~~~
ssl/mod.rs:476:37: 476:49 warning: unused result which must be used, #[warn(unused_must_use)] on by default
ssl/mod.rs:476                 ErrorWantWrite => { self.flush(); }
                                                   ^~~~~~~~~~~~
ssl/mod.rs:487:13: 490:14 warning: unused result which must be used, #[warn(unused_must_use)] on by default
ssl/mod.rs:487             match self.ssl.get_wbio().read(self.buf) {
ssl/mod.rs:488                 Some(len) => self.stream.write(self.buf.slice_to(len)),
ssl/mod.rs:489                 None => break
ssl/mod.rs:490             };
touch submodules/rust-openssl/build/libopenssl-b13df791-0.0.rlib
mkdir -p build
rustc -O -Z debug-info -L submodules/rust-openssl/build/ -L submodules/rust-phf/build/ -L submodules/rust-phf/build/ -L submodules/rust-phf/build/ --dep-info build/postgres.d \
        --out-dir build src/lib.rs
src/error.rs:19:54: 19:61 error: macro undefined: 'phf_map'
src/error.rs:19         static STATE_MAP: PhfMap<PostgresSqlState> = phf_map!(
                                                                     ^~~~~~~
error: aborting due to previous error
make: *** [build/libpostgres-e8d942e6-0.0.rlib] Segmentation fault: 11

@sfackler
Copy link
Owner

sfackler commented Feb 7, 2014

If you go into submodules/rust-phf and run make check do you run into the error and segfault as well?

@zr40
Copy link
Contributor Author

zr40 commented Feb 7, 2014

Yes, that also segfaults after returning that error.

$ make check
rustc --test -O -Z extra-debug-info -L build \
        --dep-info build/phf_test.d --out-dir build test.rs
test.rs:12:38: 12:45 error: macro undefined: 'phf_map'
test.rs:12 static TRAILING_COMMA: PhfMap<int> = phf_map!(
                                                ^~~~~~~
test.rs:17:41: 17:48 error: macro undefined: 'phf_map'
test.rs:17 static NO_TRAILING_COMMA: PhfMap<int> = phf_map!(
                                                   ^~~~~~~
test.rs:23:31: 23:38 error: macro undefined: 'phf_map'
test.rs:23     static map: PhfMap<int> = phf_map!(
                                         ^~~~~~~
test.rs:35:31: 35:38 error: macro undefined: 'phf_map'
test.rs:35     static map: PhfMap<int> = phf_map!(
                                         ^~~~~~~
test.rs:50:31: 50:38 error: macro undefined: 'phf_map'
test.rs:50     static map: PhfMap<int> = phf_map!(
                                         ^~~~~~~
test.rs:65:31: 65:38 error: macro undefined: 'phf_map'
test.rs:65     static map: PhfMap<int> = phf_map!(
                                         ^~~~~~~
test.rs:80:31: 80:38 error: macro undefined: 'phf_map'
test.rs:80     static map: PhfMap<int> = phf_map!(
                                         ^~~~~~~
error: aborting due to 7 previous errors
make: *** [build/test] Segmentation fault: 11

@sfackler
Copy link
Owner

After some poking around, it appears that this happens to a Rust build from Homebrew, but not one that I manually built. In the short term, cloning and building mozilla/rust yourself should get you unblocked.

@sfackler
Copy link
Owner

This is being tracked upstream as rust-lang/rust#12178

@sfackler
Copy link
Owner

This should be fixed now if you update Homebrew and reinstall Rust.

petrosagg added a commit to petrosagg/rust-postgres that referenced this issue Apr 9, 2025
postgres-replication: reuse underlying allocation for tuple data
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

2 participants