Compile ofxLibwebsockets on OF 0.9.0

Hi!

I’ve just started to move my project to OF 0.9.0 and I’m getting problems trying to compile @robotconscience’s ofxLibwebsockets library.

I have the latest OF of the master branch and the latest ofxLibwescockets on its 0.9.0 branch.

I’m just trying to compile an empty project created using the projectGenerator and the only addon I’m using is the ofxLibwebsockets, but I’m getting lots of errors for:

Undefined symbols for architecture i386:

I’ve tried to download and recompile libwebsockets as explained on the readme but this fails:

cmake "-DCMAKE_OSX_ARCHITECTURES=x86_64;i386" ..

…so I tried:

cmake "-DCMAKE_OSX_ARCHITECTURES=i386" ..

…and it compiles the lib fine.

I replace libwebsockets.a, but back to the project I still get the same type of errors when trying to compile.

Any help will be appreciated. Thanks! :wink:

Hi

Those errors seems related to glfw, not to libsockets. Also i see a deployment target 10.6, are you able to compile the project without libsocket.

Parece mas un error de intentar compilar para 10.6 (que creo que no funciona ya) que relacionado con libsocket

Yes, it’s definitely glfw. That said, I haven’t done a ton of testing yet with the in-progress 0.9.0, as I’ll have to overhaul all the libs once 64-bit support is complete!

Feel free to post on my github issues if you end up getting errors specific to libwebsockets rather than glfw! Can you compile the examples as-is with 0.9.0 or do you get the same issues?

Thanks guys!

@robotconscience Yes! At least example_server_echo works out of the box.

The generated .xcodeproj file from the projectGenerator has i386 architecture set as default.

This doesn’t seem to effect the other addons I’ve tried but it crashes with ofxLibwebsockets. That’s why I thought it was its fault.

Setting the architecture to x86_64 seems to fix it. Although now I get this:

Undefined symbols for architecture x86_64:
  "ofSoundBuffer::operator[](unsigned long)", referenced from:
      ofBaseSoundInput::audioIn(ofSoundBuffer&) in main.o
      ofBaseSoundOutput::audioOut(ofSoundBuffer&) in main.o
  "ofSetupOpenGL(int, int, ofWindowMode)", referenced from:
      _main in main.o
  "ofRunApp(ofBaseApp*)", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Which is the exact same error that @nunos has on [this thread][1].

So, what other things need to change in the .xcodeprojet in order to run 0.9.0?

Thanks for your time.
[1]: Help trying to run master branch

Hm! Looking at that thread it looks like you have to add files to the openFrameworks project. Check the last post in that thread!

I’m not totally sure on the new classes etc. in 0.9.0, but libwebsockets should be built as universal binary, so good to hear it’s working on 64-bit! Weird that that error only happens with ofxLibwebsockets, but maybe other addons you’ve tried don’t include static libraries like we do? Not sure on that one.

Keep me posted! Going to do a push to more thoroughly test 0.9.0 once it’s closer to launch.

Yup you’re right, it was the only addon with static libraries I’ve tried.

Finally got it compiling. On Build Settings > Architectures I had 64-bit Intel (x86_64). Clicking “other” and typing $(NATIVE_ARCH) fixed it.

What’s the difference with these different architecture options?

x86_64 is 64-bit, and NATIVE_ARCH is 32-bit. I don’t think 64-bit is finished yet in the OF branch, but when it is all should work with both architectures!

Hi guys I am really new to mac and I am a little confused and having some linker problems in Xcode (c++)… I am using npp2 repository and I am trying to compile an example but I got a lot of errors. What could be the problem ? please any help appreciated. I am showing some of the errors.

Undefined symbols for architecture x86_64:
“NPP2::PatternSet::load_pattern(std::string const&)”, referenced from:
_main in train_net.o
“NPP2::Net::saveNet(std::string const&) const”, referenced from:
_main in train_net.o
“std::__1::__vector_base_common::__throw_length_error() const”, referenced from:
std::__1::vector<NPP2::BasicLayerType*, std::__1::allocatorNPP2::BasicLayerType* >::__append(unsigned long) in libnpp2.a(npp2.o)
void std::__1::vector<int, std::__1::allocator >::__push_back_slow_path(int const&) in libnpp2.a(npp2.o)
std::__1::vector<NPP2::BasicLayerType*, std::__1::allocatorNPP2::BasicLayerType* >::allocate(unsigned long) in libnpp2.a(npp2.o)
std::__1::vector<NPP2::BasicLayerType*, std::__1::allocatorNPP2::BasicLayerType* >::__append(unsigned long, NPP2::BasicLayerType* const&) in libnpp2.a(npp2.o)
void std::__1::vector<AbstractRegistry::Entry, std::__1::allocatorAbstractRegistry::Entry >::__push_back_slow_path<AbstractRegistry::Entry const>(AbstractRegistry::Entry const&) in libnpp2.a(Registry.o)
“std::__1::locale::has_facet(std::__1::locale::id&) const”, referenced from:
std::__1::basic_filebuf<char, std::__1::char_traits >::basic_filebuf() in libnpp2.a(PatternSet.o)
std::__1::basic_filebuf<char, std::__1::char_traits >::basic_filebuf() in libnpp2.a(npp2.o)
“std::__1::locale::use_facet(std::__1::locale::id&) const”, referenced from:
std::__1::basic_ostream<char, std::__1::char_traits >& std::__1::endl<char, std::__1::char_traits >(std::__1::basic_ostream<char, std::__1::char_traits >&) in libnpp2.a(PatternSet.o)
std::__1::basic_filebuf<char, std::__1::char_traits >::imbue(std::__1::locale const&) in libnpp2.a(PatternSet.o)
std::__1::basic_filebuf<char, std::__1::char_traits >::basic_filebuf() in libnpp2.a(PatternSet.o)
std::__1::basic_ostream<char, std::__1::char_traits >& std::__1::__put_character_sequence<char, std::__1::char_traits >(std::__1::basic_ostream<char, std::__1::char_traits >&, char const*, unsigned long) in libnpp2.a(PatternSet.o)
NPP2::Net::loadNet(std::__1::basic_istream<char, std::__1::char_traits >&) in libnpp2.a(npp2.o)
std::__1::basic_ostream<char, std::__1::char_traits >& std::__1::endl<char, std::__1::char_traits >(std::__1::basic_ostream<char, std::__1::char_traits >&) in libnpp2.a(npp2.o)
std::__1::basic_istream<char, std::__1::char_traits >& std::__1::operator>><char, std::__1::char_traits, std::__1::allocator >(std::__1::basic_istream<char, std::__1::char_traits >&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >&) in libnpp2.a(npp2.o)

“std::__1::ios_base::getloc() const”, referenced from:
std::__1::basic_ostream<char, std::__1::char_traits >& std::__1::endl<char, std::__1::char_traits >(std::__1::basic_ostream<char, std::__1::char_traits >&) in libnpp2.a(PatternSet.o)
std::__1::basic_ostream<char, std::__1::char_traits >& std::__1::__put_character_sequence<char, std::__1::char_traits >(std::__1::basic_ostream<char, std::__1::char_traits >&, char const*, unsigned long) in libnpp2.a(PatternSet.o)
NPP2::Net::loadNet(std::__1::basic_istream<char, std::__1::char_traits >&) in libnpp2.a(npp2.o)
std::__1::basic_ostream<char, std::__1::char_traits >& std::__1::endl<char, std::__1::char_traits >(std::__1::basic_ostream<char, std::__1::char_traits >&) in libnpp2.a(npp2.o)
std::__1::basic_istream<char, std::__1::char_traits >& std::__1::operator>><char, std::__1::char_traits, std::__1::allocator >(std::__1::basic_istream<char, std::__1::char_traits >&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >&) in libnpp2.a(npp2.o)
std::__1::basic_ostream<char, std::__1::char_traits >& std::__1::__put_character_sequence<char, std::__1::char_traits >(std::__1::basic_ostream<char, std::__1::char_traits >&, char const*, unsigned long) in libnpp2.a(npp2.o)
std::__1::basic_ostream<char, std::__1::char_traits >& std::__1::endl<char, std::__1::char_traits >(std::__1::basic_ostream<char, std::__1::char_traits >&) in libnpp2.a(FullyConnectedLayer.o)

“std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::__init(char const*, unsigned long)”, referenced from:
NPP2::Net::createLayers(int, int*, int) in libnpp2.a(npp2.o)
NPP2::Net::createLayers(std::__1::vector<NPP2::LayerArguments*, std::__1::allocatorNPP2::LayerArguments* > const&, int, bool) in libnpp2.a(npp2.o)
NPP2::Net::loadNet(std::__1::basic_istream<char, std::__1::char_traits >&) in libnpp2.a(npp2.o)
NPP2::Net::saveNet(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) const in libnpp2.a(npp2.o)
NPP2::Net::loadNet(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) in libnpp2.a(npp2.o)
NPP2::NPPException::NPPException(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) in libnpp2.a(NPPException.o)
_layerfactory_FullyConnectedLayer::_layerfactory_FullyConnectedLayer() in libnpp2.a(FullyConnectedLayer.o)

“std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::__init(char const*, unsigned long, unsigned long)”, referenced from:
std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > std::__1::operator+<char, std::__1::char_traits, std::__1::allocator >(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) in libnpp2.a(NPPException.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Showing first 200 notices only