SRI-CSL / gllvm

Whole Program LLVM: wllvm ported to go
BSD 3-Clause "New" or "Revised" License
298 stars 34 forks source link

Linking issue while building memcached using gLLVM #66

Open Mohannadcse opened 2 years ago

Mohannadcse commented 2 years ago

I'm using the scripts Makefile and Makefile_libevent from https://github.com/SRI-CSL/OCCAM-Benchmarks/tree/master/examples/portfolio/memcached to generate the bitcode of Memcached. But I'm receiving the following error:

gclang  -g -O2 -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls  -L/workspaces/neck-identification/gllvmTry/install/libevent/lib  -Wl,-rpath,/workspaces/neck-identification/gllvmTry/install/libevent/lib -o memcached memcached-memcached.o memcached-hash.o memcached-jenkins_hash.o memcached-murmur3_hash.o memcached-slabs.o memcached-items.o memcached-assoc.o memcached-thread.o memcached-daemon.o memcached-stats.o memcached-util.o memcached-cache.o    -lpthread -levent 
memcached-hash.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: multiple definition of `hash'
memcached-memcached.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: first defined here
memcached-jenkins_hash.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: multiple definition of `hash'
memcached-memcached.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: first defined here
memcached-slabs.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: multiple definition of `hash'
memcached-memcached.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: first defined here
memcached-items.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: multiple definition of `hash'
memcached-memcached.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: first defined here
memcached-assoc.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: multiple definition of `hash'
memcached-memcached.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: first defined here
memcached-thread.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: multiple definition of `hash'
memcached-memcached.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: first defined here
memcached-daemon.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: multiple definition of `hash'
memcached-memcached.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: first defined here
memcached-stats.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: multiple definition of `hash'
memcached-memcached.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: first defined here
memcached-util.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: multiple definition of `hash'
memcached-memcached.o:/workspaces/neck-identification/gllvmTry/memcached-1.4.25/./hash.h:5: first defined here
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR:Failed to compile using given arguments:
clang [-g -O2 -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -L/workspaces/neck-identification/gllvmTry/install/libevent/lib -Wl,-rpath,/workspaces/neck-identification/gllvmTry/install/libevent/lib -o memcached memcached-memcached.o memcached-hash.o memcached-jenkins_hash.o memcached-murmur3_hash.o memcached-slabs.o memcached-items.o memcached-assoc.o memcached-thread.o memcached-daemon.o memcached-stats.o memcached-util.o memcached-cache.o -lpthread -levent]
exit status: exit status 1
Makefile:541: recipe for target 'memcached' failed
make[3]: *** [memcached] Error 1
make[3]: Leaving directory '/workspaces/neck-identification/gllvmTry/memcached-1.4.25'
Makefile:1034: recipe for target 'install-recursive' failed
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory '/workspaces/neck-identification/gllvmTry/memcached-1.4.25'
Makefile:1334: recipe for target 'install' failed
make[1]: *** [install] Error 2
make[1]: Leaving directory '/workspaces/neck-identification/gllvmTry/memcached-1.4.25'
Makefile:28: recipe for target '/workspaces/neck-identification/gllvmTry/install/memcached/bin/memcached' failed
make: *** [/workspaces/neck-identification/gllvmTry/install/memcached/bin/memcached] Error 2
ianamason commented 2 years ago

So all I can suggest it that you try to get the link to work with clang

clang  -g -O2 -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls  -L/workspaces/neck-identification/gllvmTry/install/libevent/lib  -Wl,-rpath,/workspaces/neck-identification/gllvmTry/install/libevent/lib -o memcached memcached-memcached.o memcached-hash.o memcached-jenkins_hash.o memcached-murmur3_hash.o memcached-slabs.o memcached-items.o memcached-assoc.o memcached-thread.o memcached-daemon.o memcached-stats.o memcached-util.o memcached-cache.o    -lpthread -levent 

on the command line, you will probably have to play around with the flags. Then try it again with those same flags.