Opened 21 months ago

Last modified 21 months ago

#65685 new defect

sparsehash fails to link on Rosetta: Undefined symbols "MallocExtension::instance()"

Reported by: barracuda156 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.7.2
Keywords: powerpc, rosetta, snowleopard Cc:
Port: sparsehash

Description

mv -f .deps/time_hash_map-time_hash_map.Tpo .deps/time_hash_map-time_hash_map.Po
/usr/bin/g++-4.2 -D_THREAD_SAFE  -Wall -W -Wwrite-strings -Woverloaded-virtual -Wshadow -pipe -Os -D_THREAD_SAFE  -L/opt/local/lib -Wl,-headerpad_max_install_names -o time_hash_map time_hash_map-time_hash_map.o    -ltcmalloc  
ld: warning: in /opt/local/lib/libtcmalloc.dylib, file was built for ppc7400 which is not the architecture being linked (x86_64)
Undefined symbols:
  "MallocExtension::instance()", referenced from:
      CurrentMemoryUsage()      in time_hash_map-time_hash_map.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[1]: *** [time_hash_map] Error 1

Change History (3)

comment:1 Changed 21 months ago by kencu (Ken)

because there is no arch flag in the referenced build line, g++-4.2 looks around to guess what you are trying to do, and defaults to building as x86_64 on this system.

when it tries to link against the libtcmalloc.dylib, it finds the library is built for ppc7400. So it can't link.

you need to add an arch flag to the build/link of sparsehash for your desired build arch, and you should be good to go.

this is exactly the kind of "generic good fix" I was talking about before, that benefits all users.

Last edited 21 months ago by kencu (Ken) (previous) (diff)

comment:2 Changed 21 months ago by kencu (Ken)

BTW, if you would include the full log in your tickets you will get better thoughts / opinions / advice / fixes.

comment:3 in reply to:  1 Changed 21 months ago by barracuda156

Replying to kencu:

because there is no arch flag in the referenced build line, g++-4.2 looks around to guess what you are trying to do, and defaults to building as x86_64 on this system.

when it tries to link against the libtcmalloc.dylib, it finds the library is built for ppc7400. So it can't link.

you need to add an arch flag to the build/link of sparsehash for your desired build arch, and you should be good to go.

this is exactly the kind of "generic good fix" I was talking about before, that benefits all users.

Thank you, that worked!

(Yes, I usually include logs, unless the issue appears clear enough.)

Note: See TracTickets for help on using tickets.