arturoc / ofxHttpServer

http server openframeworks addon based on libmicrohttpd
15 stars 16 forks source link

Linker errors on Mavericks #2

Open jedahan opened 10 years ago

jedahan commented 10 years ago

The embedded libmicrohttpd server throws a bunch of errors for me:

Ld bin/buttCancerDebug.app/Contents/MacOS/buttCancerDebug normal i386
    cd /Users/jedahan/Dropbox/code/jedahan/openFrameworks/apps/myApps/buttCancer
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -L/Users/jedahan/Dropbox/code/jedahan/openFrameworks/apps/myApps/buttCancer/bin -F/Users/jedahan/Dropbox/code/jedahan/openFrameworks/apps/myApps/buttCancer/bin -F/Users/jedahan/Dropbox/code/jedahan/openFrameworks/apps/myApps/buttCancer/../../../libs/glut/lib/osx -filelist /Users/jedahan/Library/Developer/Xcode/DerivedData/buttCancer-bmguzlpjlvbkooapdgvrepxbxubw/Build/Intermediates/buttCancer.build/Debug/buttCancer.build/Objects-normal/i386/buttCancerDebug.LinkFileList -dead_strip ../../../libs/poco/lib/osx/PocoCrypto.a ../../../libs/poco/lib/osx/PocoData.a ../../../libs/poco/lib/osx/PocoDataODBC.a ../../../libs/poco/lib/osx/PocoDataSQLite.a ../../../libs/poco/lib/osx/PocoFoundation.a ../../../libs/poco/lib/osx/PocoNet.a ../../../libs/poco/lib/osx/PocoNetSSL.a ../../../libs/poco/lib/osx/PocoUtil.a ../../../libs/poco/lib/osx/PocoXML.a ../../../libs/poco/lib/osx/PocoZip.a ../../../libs/tess2/lib/osx/tess2.a ../../../libs/glew/lib/osx/glew.a ../../../libs/cairo/lib/osx/cairo-script-interpreter.a ../../../libs/cairo/lib/osx/cairo.a ../../../libs/cairo/lib/osx/pixman-1.a ../../../libs/fmodex/lib/osx/libfmodex.dylib ../../../libs/rtAudio/lib/osx/rtAudio.a ../../../libs/openssl/lib/osx/crypto.a ../../../libs/openssl/lib/osx/ssl.a ../../../libs/glfw/lib/osx/libglfw3.a ../../../addons/ofxOpenCv/libs/opencv/lib/osx/opencv.a -stdlib=libstdc++ -framework Accelerate -framework QTKit -framework GLUT /Users/jedahan/Dropbox/code/jedahan/openFrameworks/libs/openFrameworksCompiled/lib/osx/openFrameworksDebug.a -framework AGL -framework ApplicationServices -framework AudioToolbox -framework Carbon -framework CoreAudio -framework CoreFoundation -framework CoreServices -framework OpenGL -framework QuickTime -framework AppKit -framework Cocoa -framework IOKit -framework CoreVideo -Xlinker -dependency_info -Xlinker /Users/jedahan/Library/Developer/Xcode/DerivedData/buttCancer-bmguzlpjlvbkooapdgvrepxbxubw/Build/Intermediates/buttCancer.build/Debug/buttCancer.build/Objects-normal/i386/buttCancerDebug_dependency_info.dat -o /Users/jedahan/Dropbox/code/jedahan/openFrameworks/apps/myApps/buttCancer/bin/buttCancerDebug.app/Contents/MacOS/buttCancerDebug

Undefined symbols for architecture i386:
  "_MHD_start_daemon", referenced from:
      ofxHTTPServer::start(unsigned int, bool) in ofxHTTPServer.o
  "_MHD_get_connection_values", referenced from:
      ofxHTTPServer::answer_to_connection(void*, MHD_Connection*, char const*, char const*, char const*, char const*, unsigned long*, void**) in ofxHTTPServer.o
  "_MHD_set_connection_value", referenced from:
      ofxHTTPServer::answer_to_connection(void*, MHD_Connection*, char const*, char const*, char const*, char const*, unsigned long*, void**) in ofxHTTPServer.o
  "_MHD_lookup_connection_value", referenced from:
      ofxHTTPServer::answer_to_connection(void*, MHD_Connection*, char const*, char const*, char const*, char const*, unsigned long*, void**) in ofxHTTPServer.o
  "_MHD_create_post_processor", referenced from:
      ofxHTTPServer::answer_to_connection(void*, MHD_Connection*, char const*, char const*, char const*, char const*, unsigned long*, void**) in ofxHTTPServer.o
  "_MHD_add_response_header", referenced from:
      ofxHTTPServer::send_page(MHD_Connection*, long, char const*, int, std::string) in ofxHTTPServer.o
      ofxHTTPServer::send_redirect(MHD_Connection*, char const*, int) in ofxHTTPServer.o
  "_MHD_create_response_from_data", referenced from:
      ofxHTTPServer::send_page(MHD_Connection*, long, char const*, int, std::string) in ofxHTTPServer.o
      ofxHTTPServer::send_redirect(MHD_Connection*, char const*, int) in ofxHTTPServer.o
  "_MHD_queue_response", referenced from:
      ofxHTTPServer::send_page(MHD_Connection*, long, char const*, int, std::string) in ofxHTTPServer.o
      ofxHTTPServer::send_redirect(MHD_Connection*, char const*, int) in ofxHTTPServer.o
  "_MHD_destroy_response", referenced from:
      ofxHTTPServer::send_page(MHD_Connection*, long, char const*, int, std::string) in ofxHTTPServer.o
      ofxHTTPServer::send_redirect(MHD_Connection*, char const*, int) in ofxHTTPServer.o
  "_MHD_post_process", referenced from:
      ofxHTTPServer::answer_to_connection(void*, MHD_Connection*, char const*, char const*, char const*, char const*, unsigned long*, void**) in ofxHTTPServer.o
  "_MHD_destroy_post_processor", referenced from:
      ofxHTTPServer::request_completed(void*, MHD_Connection*, void**, MHD_RequestTerminationCode) in ofxHTTPServer.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

When I try to manually add libmicrohttpd.a, the linked ignores it, citing:

ld: warning: ignoring file /Users/jedahan/Dropbox/code/jedahan/openFrameworks/addons/ofxHttpServer/libs/microhttpd/lib/macosx/libmicrohttpd.a, file was built for archive which is not the architecture being linked (i386): /Users/jedahan/Dropbox/code/jedahan/openFrameworks/addons/ofxHttpServer/libs/microhttpd/lib/macosx/libmicrohttpd.a

Is there a way to tell the compiler to link against x86_64?

jedahan commented 10 years ago

Alternatively could you provide a universal binary of libmicrohttpd.a?

alexeyroudenko commented 10 years ago

you can compile, using "sudo port install libmicrohttpd +universal", replace library and in Xcode add for section "other linker flags" values "-lgnutls -lgcrypt"

or you can download universal arch library from there: http://www.alexeyrudenko.com/files/libmicrohttpd.a