Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Valgrind fails to build on Lion (While linking, fails to find __bzero) #13042

Closed
sharth opened this issue Jun 26, 2012 · 39 comments
Closed

Valgrind fails to build on Lion (While linking, fails to find __bzero) #13042

sharth opened this issue Jun 26, 2012 · 39 comments

Comments

@sharth
Copy link
Contributor

sharth commented Jun 26, 2012

This is on OS X Lion 10.7.4...

Here's some output. I've reduced it so that the useful parts are more obvious.

As the title states, it's a linking error where it fails to find the symbol __bzero.


[12:26pm][wlynch@watermelon ~] brew install valgrind
==> Downloading http://valgrind.org/downloads/valgrind-3.7.0.tar.bz2
Already downloaded: /Library/Caches/Homebrew/valgrind-3.7.0.tar.bz2
==> ./configure --prefix=/Users/wlynch/Homebrew/Cellar/valgrind/3.7.0 --mandir=/Users/wlynch/Homebrew/Cellar/valgrind/3.7.0/share/man --enable-only64bit --build=amd64-darwin
==> make
echo "# This is a generated file, composed of the following suppression rules:" > default.supp
echo "# " exp-sgcheck.supp xfree-3.supp xfree-4.supp darwin10-drd.supp darwin11.supp  >> default.supp
cat exp-sgcheck.supp xfree-3.supp xfree-4.supp darwin10-drd.supp darwin11.supp  >> default.supp
make  all-recursive
Making all in include
make[2]: Nothing to be done for `all'.
Making all in VEX
make  all-am
/usr/bin/clang -DHAVE_CONFIG_H -I. -I..  -I.. -I../include -I../VEX/pub -DVGA_amd64=1 -DVGO_darwin=1 -DVGP_amd64_darwin=1 -DVGPV_amd64_darwin_vanilla=1 -Ipriv -isystem /Users/wlynch/Homebrew/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include  -arch x86_64 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -fno-builtin -mmacosx-version-min=10.5 -fno-stack-protector -Wbad-function-cast -Wcast-qual -Wcast-align -fstrict-aliasing -Wno-long-long -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -Wno-pointer-sign -fno-stack-protector -MT libvex_amd64_darwin_a-main_globals.o -MD -MP -MF .deps/libvex_amd64_darwin_a-main_globals.Tpo -c -o libvex_amd64_darwin_a-main_globals.o `test -f 'priv/main_globals.c' || echo './'`priv/main_globals.c
/usr/bin/clang -DHAVE_CONFIG_H -I. -I..  -I.. -I../include -I../VEX/pub -DVGA_amd64=1 -DVGO_darwin=1 -DVGP_amd64_darwin=1 -DVGPV_amd64_darwin_vanilla=1 -Ipriv -isystem /Users/wlynch/Homebrew/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include  -arch x86_64 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -fno-builtin -mmacosx-version-min=10.5 -fno-stack-protector -Wbad-function-cast -Wcast-qual -Wcast-align -fstrict-aliasing -Wno-long-long -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -Wno-pointer-sign -fno-stack-protector -MT libvex_amd64_darwin_a-main_main.o -MD -MP -MF .deps/libvex_amd64_darwin_a-main_main.Tpo -c -o libvex_amd64_darwin_a-main_main.o `test -f 'priv/main_main.c' || echo './'`priv/main_main.c
/usr/bin/clang -DHAVE_CONFIG_H -I. -I..  -I.. -I../include -I../VEX/pub -DVGA_amd64=1 -DVGO_darwin=1 -DVGP_amd64_darwin=1 -DVGPV_amd64_darwin_vanilla=1 -Ipriv -isystem /Users/wlynch/Homebrew/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include  -arch x86_64 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -fno-builtin -mmacosx-version-min=10.5 -fno-stack-protector -Wbad-function-cast -Wcast-qual -Wcast-align -fstrict-aliasing -Wno-long-long -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -Wno-pointer-sign -fno-stack-protector -MT libvex_amd64_darwin_a-main_util.o -MD -MP -MF .deps/libvex_amd64_darwin_a-main_util.Tpo -c -o libvex_amd64_darwin_a-main_util.o `test -f 'priv/main_util.c' || echo './'`priv/main_util.c
/usr/bin/clang -DHAVE_CONFIG_H -I. -I..  -I.. -I../include -I../VEX/pub -DVGA_amd64=1 -DVGO_darwin=1 -DVGP_amd64_darwin=1 -DVGPV_amd64_darwin_vanilla=1 -Ipriv -isystem /Users/wlynch/Homebrew/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include  -arch x86_64 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -fno-builtin -mmacosx-version-min=10.5 -fno-stack-protector -Wbad-function-cast -Wcast-qual -Wcast-align -fstrict-aliasing -Wno-long-long -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -Wno-pointer-sign -fno-stack-protector -MT libvex_amd64_darwin_a-ir_defs.o -MD -MP -MF .deps/libvex_amd64_darwin_a-ir_defs.Tpo -c -o libvex_amd64_darwin_a-ir_defs.o `test -f 'priv/ir_defs.c' || echo './'`priv/ir_defs.c
mv -f .deps/libvex_amd64_darwin_a-main_globals.Tpo .deps/libvex_amd64_darwin_a-main_globals.Po
/usr/bin/clang -DHAVE_CONFIG_H -I. -I..  -I.. -I../include -I../VEX/pub -DVGA_amd64=1 -DVGO_darwin=1 -DVGP_amd64_darwin=1 -DVGPV_amd64_darwin_vanilla=1 -Ipriv -isystem /Users/wlynch/Homebrew/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include  -arch x86_64 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -fno-builtin -mmacosx-version-min=10.5 -fno-stack-protector -Wbad-function-cast -Wcast-qual -Wcast-align -fstrict-aliasing -Wno-long-long -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -Wno-pointer-sign -fno-stack-protector -MT libvex_amd64_darwin_a-ir_match.o -MD -MP -MF .deps/libvex_amd64_darwin_a-ir_match.Tpo -c -o libvex_amd64_darwin_a-ir_match.o `test -f 'priv/ir_match.c' || echo './'`priv/ir_match.c
...
mv -f .deps/memcheck_amd64_darwin-mc_errors.Tpo .deps/memcheck_amd64_darwin-mc_errors.Po
mv -f .deps/memcheck_amd64_darwin-mc_translate.Tpo .deps/memcheck_amd64_darwin-mc_translate.Po
mv -f .deps/memcheck_amd64_darwin-mc_main.Tpo .deps/memcheck_amd64_darwin-mc_main.Po
../coregrind/link_tool_exe_darwin 0x138000000 /usr/bin/clang  -Wno-long-long -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -Wno-pointer-sign -fno-stack-protector  -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib -L/Users/wlynch/Homebrew/lib -o memcheck-amd64-darwin  -arch x86_64 -O2 -g -Wall -Wmissing-prototypes -Wshadow -Wpointer-arith -Wstrict-prototypes -Wmissing-declarations -Wno-format-zero-length -fno-strict-aliasing -fno-builtin -mmacosx-version-min=10.5 -fno-stack-protector -O2 -nodefaultlibs -nostartfiles -Wl,-u,__start -Wl,-e,__start -arch x86_64 memcheck_amd64_darwin-mc_leakcheck.o memcheck_amd64_darwin-mc_malloc_wrappers.o memcheck_amd64_darwin-mc_main.o memcheck_amd64_darwin-mc_translate.o memcheck_amd64_darwin-mc_machine.o memcheck_amd64_darwin-mc_errors.o ../coregrind/libcoregrind-amd64-darwin.a ../VEX/libvex-amd64-darwin.a -lgcc 
link_tool_exe_darwin: /usr/bin/ld -static -arch x86_64 -macosx_version_min 10.5 -o memcheck-amd64-darwin -u __start -e __start -image_base 0x138000000 -stack_addr 0x134000000 -stack_size 0x800000 memcheck_amd64_darwin-mc_leakcheck.o memcheck_amd64_darwin-mc_malloc_wrappers.o memcheck_amd64_darwin-mc_main.o memcheck_amd64_darwin-mc_translate.o memcheck_amd64_darwin-mc_machine.o memcheck_amd64_darwin-mc_errors.o ../coregrind/libcoregrind-amd64-darwin.a ../VEX/libvex-amd64-darwin.a
Undefined symbols for architecture x86_64:
  "___bzero", referenced from:
      _hijack_thread_state in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-amd64-darwin.o)
ld: symbol(s) not found for architecture x86_64
make[3]: *** [memcheck-amd64-darwin] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
config.log was copied to /Users/wlynch/Library/Logs/Homebrew
==> Build Environment
HOMEBREW_PREFIX: /Users/wlynch/Homebrew
CPU: quad-core 64-bit sandybridge
OS X: 10.7.4-x86_64
Xcode: 4.3.3
CC: /usr/bin/clang
CXX: /usr/bin/clang++ => /usr/bin/clang
LD: /usr/bin/clang
CFLAGS: -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include
CXXFLAGS: -Os -w -pipe -march=native -Qunused-arguments -mmacosx-version-min=10.7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include
CPPFLAGS: -isystem /Users/wlynch/Homebrew/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include
LDFLAGS: -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib -L/Users/wlynch/Homebrew/lib
MACOSX_DEPLOYMENT_TARGET: 10.7
MAKEFLAGS: -j4
Error: Failed executing: make (valgrind.rb:26)
These existing issues may help you:
    https://github.com/mxcl/homebrew/issues/12217
Otherwise, this may help you fix or report the issue:
    https://github.com/mxcl/homebrew/wiki/bug-fixing-checklist
[12:27pm][wlynch@watermelon ~] 
@sharth
Copy link
Contributor Author

sharth commented Jun 26, 2012

You can see the full output here: https://gist.github.com/2997272

@sharth
Copy link
Contributor Author

sharth commented Jun 26, 2012

And brew doctor is relatively clean.

[12:34pm][wlynch@watermelon ~] brew doctor

Error: Your Homebrew is not installed to /usr/local
You can install Homebrew anywhere you want, but some brews may only build
correctly if you install in /usr/local. Sorry!

@aspcartman
Copy link

Fixed it by extracting valgrind cached zip (got it from /Library/Caches/Homebrew) to my desktop, and just making it like homebrew would:

./configure --prefix=/usr/local/Cellar/valgrind/3.7.0 --mandir=/usr/local/Cellar/valgrind/3.7.0/share/man --enable-only64bit --build=amd64-darwin
make
sudo make install

and then

brew link valgrind

I don't understand whats wrong.

@jacknagel
Copy link
Contributor

@samueljohn maybe related to the ENV changes?

@samueljohn
Copy link
Contributor

Yes may perhaps be related (on Xcode-only building valgrind fails). Then the fix in #13037 should fix this for CLT and Xcode+CLT systems.

@aspcartman
Copy link

Maybe, but i can't guess what is it exactly.

On 26.06.2012, at 22:07, Jack Nagelreply@reply.github.com wrote:

@samueljohn maybe related to the ENV changes?


Reply to this email directly or view it on GitHub:
#13042 (comment)

@samueljohn
Copy link
Contributor

@sharth you doctor shows:

Error: Your Homebrew is not installed to /usr/local
You can install Homebrew anywhere you want, but some brews may only build
correctly if you install in /usr/local. Sorry!

This output is interesting. Let me explain. Some software does use the stuff in /usr/local/lib and /usr/local/include automatically since these are UNIX (POSIX) standards. Normally, it should be possible to teach the software to build with the libs and includes in other places by means of settings the right CFLAGS and LDFLAGS (among others). I have done this to support building software for people with Xcode-only systems (so without Command Line Tools). Most software builds just fine with the right settings. However, I am not able to build valgrind and few others. Having homebrew in a non-standard prefix is similar as the situation with Xcode-only systems in this regard.

The (different) issue @aspcartman has is surly fixed by #13037.

@samueljohn
Copy link
Contributor

I am still trying to figure out how to persuade valgrind to build with Xcode only :-/

@Jud
Copy link

Jud commented Jun 27, 2012

FWIW - I just got this error on a fresh MBP + Retina on OSX Lion.

https://gist.github.com/3001460

I have Xcode + Command Line Tools installed. The output of brew doctor is: "Your system is raring to brew."

@aspcartman
Copy link

If you eager for valgrind - you can do this my way, described above. Homebrew will accept it as it was it's own.

Funny it is - noone had this issue before me, i was a first one to get stuck. First one at something, atleast :D

Best regards,
Ruslan Fedorov

On Wednesday, June 27, 2012 at 8:28 AM, Jud wrote:

FWIW - I just got this error on a fresh MBP + Retina on OSX Lion.

https://gist.github.com/3001460

I have Xcode + Command Line Tools installed. The output of brew doctor is: "Your system is raring to brew."


Reply to this email directly or view it on GitHub:
#13042 (comment)

@2bits
Copy link
Contributor

2bits commented Jun 28, 2012

@samueljohn The Valgrind developers are very active and care about Macs. You should find some good help there. After getting your lastest patches to Homebrew core, I am at ef37ddd80562a48d359ade98f6c5c9c1ed3c38f9 and I can't compile Valgrind. I get the exact same error as the OP here. I also get the same error if I try ENV.macosxsdk 10.6. I noticed in the compile output that they are specifying -macosx_version_min 10.5.

So I added this to the formula just under def install, and I can build Valgrind again.

    ENV.remove_from_cflags '-mmacosx-version-min=10.7'
    ENV.remove 'CXXFLAGS', '-mmacosx-version-min=10.7'

By telling the compilers that our minimum version is 10.7 on Lion, we are excluding symbols that come from 10.6 or 10.5. By specifying something like 10.5, any symbols from 10.5 will be there plus symbols from 10.6 and 10.7 will be weak linked and loadable with some runtime searching. I have no idea how many formulas build against earlier API, but we may end up just specifying an earlier version for ML, Lion, and Snow Leopard. Thoughts?

@samueljohn
Copy link
Contributor

@2bits we currently don't have that -mmacosx-version-min in our CXXFLAGS, only in the CFLAGS. Either we do this on a per formula basis, as you did, or globally. I am not sure...

@2bits
Copy link
Contributor

2bits commented Jun 28, 2012

This wasn't done in the formula, and I only modify my PATH and my PYTHONPATH. I'm at ef37ddd80562a48d359ade98f6c5c9c1ed3c38f9 and when I brew install -i valgrind and type set I can see that's how my CXXFLAGS and CFLAGS are both set:

CFLAGS='-Os -w -pipe -march=native -Xclang -target-feature -Xclang -aes -Qunused-arguments -mmacosx-version-min=10.7'
CPPFLAGS='-isystem /usr/local/include'
CXXFLAGS='-Os -w -pipe -march=native -Xclang -target-feature -Xclang -aes -Qunused-arguments -mmacosx-version-min=10.7'
OBJCFLAGS='-Os -w -pipe -march=native -Xclang -target-feature -Xclang -aes -Qunused-arguments -mmacosx-version-min=10.7'
OBJCXXFLAGS='-Os -w -pipe -march=native -Xclang -target-feature -Xclang -aes -Qunused-arguments -mmacosx-version-min=10.7'

Because the formula hasn't run configure, I'm fairly certain these are being set by the core install code.

@samueljohn
Copy link
Contributor

So forget what I said. We have these in CXXFLAGS, too :-)

Do you need to set the PYTHONPATH?

@2bits
Copy link
Contributor

2bits commented Jun 28, 2012

I set PYTHONPATH so I can test software brewed against system Python.

@samueljohn
Copy link
Contributor

Yep, alright. I thought it was something special for valgrind.

@adamv
Copy link
Contributor

adamv commented Jun 29, 2012

With our latest core fixes from last night, I'm able to build valgrind on Lion with the default Homebrew install folder.

@2bits
Copy link
Contributor

2bits commented Jun 29, 2012

I still can't build valgrind on Lion 10.7.4 with XCode-4.3.3 after brew update just now. I get the same error.

Undefined symbols for architecture x86_64:
  "___bzero", referenced from:
      _hijack_thread_state in libcoregrind-amd64-darwin.a(libcoregrind_amd64_darwin_a-syswrap-amd64-darwin.o)
ld: symbol(s) not found for architecture x86_64

I removed 90% of my installed brews. So I don't think it's my system which is raring to brew. I only have these left:

autoconf    cksfv       gfortran    libtool     surfraw     wtf
automake    cmake       git         pkg-config  tkdiff      xz

@tapichu
Copy link

tapichu commented Jun 30, 2012

I'm having the same issue with Lion 10.7.4 and Xcode 4.3.3.

https://gist.github.com/3025307

@2bits
Copy link
Contributor

2bits commented Jul 1, 2012

You need to edit the valgrind formula in Textedit or using brew edit valgrind and add a few lines under def install so that it looks like this:

  skip_clean 'lib'

  def install
    # If you force a version, you get missing symbol __bzero.  cf #13042
    ENV.remove 'CFLAGS', " -mmacosx-version-min=#{MACOS_VERSION}"
    ENV.remove 'CXXFLAGS', " -mmacosx-version-min=#{MACOS_VERSION}"

    args = ["--prefix=#{prefix}", "--mandir=#{man}"]

I just tested that on a clean install of Homebrew on 10.7.4 with XCode-4.3.3 + CLT.

@2bits
Copy link
Contributor

2bits commented Jul 1, 2012

@samueljohn Any progress on XCode only building valgrind?

@tapichu
Copy link

tapichu commented Jul 1, 2012

@2bits thank you

@fotos
Copy link
Contributor

fotos commented Jul 1, 2012

@2bits yes, that did it, thanks! 👍

@hnakamur
Copy link
Contributor

hnakamur commented Jul 7, 2012

@2bits thank you!

To all,
Can we merge this modification to the valgrind formula?

@2bits
Copy link
Contributor

2bits commented Jul 7, 2012

@samueljohn does this fix break xcode-only installs of valgrind?

@samueljohn
Copy link
Contributor

I can check on monday.

@samueljohn
Copy link
Contributor

@2bits on xcode_only I currently get this

Making all in coregrind
make[2]: *** No rule to make target `/usr/include/mach/mach_vm.defs', needed by `m_mach/mach_vmUser.c'.  Stop.

The file /usr/include/mach/mach_vm.defs does not exist on my system. It is located at
#{MacOS.sdk_path}/usr/include/mach/mach_vm.defs :-(

@samueljohn
Copy link
Contributor

system "make", "CPPFLAGS=#{ENV.cppflags}", "LDFLAGS=#{ENV.ldflags}", "CFLAGS=#{ENV.cflags}" helps a bit but still failing in the end.

I'll continue tomorrow.

@2bits
Copy link
Contributor

2bits commented Jul 9, 2012

There are some good projects like valgrind. You should be able to find a way around this.

@samueljohn
Copy link
Contributor

Ok, concerning the xcode-only build problems, I just found that I already filed an upstream bug for exactly the hardcoded paths to /usr/include/mach_vm.defs with a suggestion on how to fix it. LOL, kinda a surprise finding that ticket filed by myself ^^

So for now valgrind needs the CLT and I cannot test the original posters __bzero issue :-(

@samueljohn
Copy link
Contributor

@2bits I confirmed that unsetting the '-mmacosx-version-min=10.7' solved the __bzero issue.

@2bits
Copy link
Contributor

2bits commented Jul 10, 2012

That was funny you made that bug report in February. So can we patch for the hard coded paths until they fix it?

@samueljohn
Copy link
Contributor

@2bits Yes, that was shoking to find :-) and still no reply yet :-(

In my fork I have a patch to compile valgrind on xcode-only. But I am not 100%sure I did everything right because I don't really use and know valgrind. I can open a pull request if you like.

@2bits
Copy link
Contributor

2bits commented Jul 10, 2012

Yes open a pull request for Valgrind, fix it for XCode-only include issue and fix the -mmacosx-version-min for everyone too. Test it with brew test -v valgrind. If that works, we are good to go. We need to get this fixed because a lot of people rely on it.

Searching valgrind bug reports for OSX I found a few things like this thread about -new-linker. I wonder if that would have any affect. I doubt it because it seems to be for 32bit code, but you never know.

@2bits
Copy link
Contributor

2bits commented Jul 10, 2012

You will want to use MACOS_VERSION instead of a hard coded version number in your Pull Request I think

    ENV.remove 'CFLAGS', " -mmacosx-version-min=#{MACOS_VERSION}"
    ENV.remove 'CXXFLAGS', " -mmacosx-version-min=#{MACOS_VERSION}"

@samueljohn
Copy link
Contributor

Okay I'll do that tomorrow.

@springmeyer
Copy link
Contributor

bump, just hit this as well, the workaround above fixed it.

@samueljohn
Copy link
Contributor

My pull request #13548 should close this issue, too (and allows successful build of valgrind on Xcode-only systems).

@adamv
Copy link
Contributor

adamv commented Aug 24, 2012

Presuming closed after a brew update.

@adamv adamv closed this as completed Aug 24, 2012
@Homebrew Homebrew locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.