OS X - Bah.Serial [Solved]

BlitzMax Forums/Brucey's Modules/OS X - Bah.Serial [Solved]

PhotonTom(Posted 2014) [#1]
I can't get the module to work.
I'm completely new to Mac OS X and am currently running 10.6.8 in a VM. I've installed the only version of Xcode I could find that didn't force me to upgrade to 10.9 which was version 3.2.1. I'm running BlitzMax version 1.49.
I'm trying to get Bah.Serial to work correctly. It compiles fine, but when compiling example_01 it fails when linking giving the following text.
Building example_01
Compiling:example_01.bmx
Linking:example_01.mt
Undefined symbols:
  "serial::Serial::getDSR()", referenced from:
      _bmx_serial_getdsr in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::getStopbits() const", referenced from:
      _bmx_serial_getstopbits in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::open()", referenced from:
      _bmx_serial_open in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::flush()", referenced from:
      _bmx_serial_flush in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::read(unsigned char*, unsigned long)", referenced from:
      _bmx_serial_read in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::setFlowcontrol(serial::flowcontrol_t)", referenced from:
      _bmx_serial_setflowcontrol in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::setStopbits(serial::stopbits_t)", referenced from:
      _bmx_serial_setstopbits in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::setParity(serial::parity_t)", referenced from:
      _bmx_serial_setparity in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::getCD()", referenced from:
      _bmx_serial_getcd in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::flushInput()", referenced from:
      _bmx_serial_flushinput in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::Serial(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int, serial::Timeout, serial::bytesize_t, serial::parity_t, serial::stopbits_t, serial::flowcontrol_t)", referenced from:
      _bmx_serial_create in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
      _bmx_serial_create in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::getParity() const", referenced from:
      _bmx_serial_getparity in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::close()", referenced from:
      _bmx_serial_close in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::waitForChange()", referenced from:
      _bmx_serial_waitforchange in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::available()", referenced from:
      _bmx_serial_available in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::setRTS(bool)", referenced from:
      _bmx_serial_setrts in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::getFlowcontrol() const", referenced from:
      _bmx_serial_getflowcontrol in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::getRI()", referenced from:
      _bmx_serial_getri in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::flushOutput()", referenced from:
      _bmx_serial_flushoutput in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::setBaudrate(unsigned int)", referenced from:
      _bmx_serial_setbaudrate in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::write(unsigned char const*, unsigned long)", referenced from:
      _bmx_serial_write in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::setPort(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      _bmx_serial_setport in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::readline(unsigned long, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)", referenced from:
      _bmx_serial_readline in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::setDTR(bool)", referenced from:
      _bmx_serial_setdtr in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::getBaudrate() const", referenced from:
      _bmx_serial_getbaudrate in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::write(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)", referenced from:
      _bmx_serial_writestring in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::getPort() const", referenced from:
      _bmx_serial_getport in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::getCTS()", referenced from:
      _bmx_serial_getcts in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::getBytesize() const", referenced from:
      _bmx_serial_getbytesize in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::setBytesize(serial::bytesize_t)", referenced from:
      _bmx_serial_setbytesize in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::isOpen() const", referenced from:
      _bmx_serial_isopen in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::sendBreak(int)", referenced from:
      _bmx_serial_sendbreak in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
  "serial::Serial::setBreak(bool)", referenced from:
      _bmx_serial_setbreak in serial.release.mt.macos.x86.a(glue.cpp.release.mt.macos.x86.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
Build Error: Failed to link /Applications/BlitzMax - Full/mod/bah.mod/serial.mod/examples/example_01.mt.app/Contents/MacOS/example_01.mt

It is the same for debug/release/threaded/non threaded.
This module and code works perfectly fine on my Windows system. Any ideas how to fix other than upgrade to 10.9?
Thanks


Brucey(Posted 2014) [#2]
The errors imply the module hasn't compiled correctly.

If you build the module from the command-line (starting in BlitzMax/bin) it should all look like this :
> ./bmk makemods -a bah.serial
Compiling:serial.cc
Compiling:unix.cc
Compiling:glue.cpp
Compiling:list_osx.cpp
Compiling:source.bmx
Compiling:common.bmx
Compiling:serial.bmx
Archiving:serial.debug.macos.x86.a
Compiling:serial.cc
Compiling:unix.cc
Compiling:glue.cpp
Compiling:list_osx.cpp
Compiling:source.bmx
Compiling:common.bmx
Compiling:serial.bmx
Archiving:serial.release.macos.x86.a

That's for a normal, non-threaded build.


PhotonTom(Posted 2014) [#3]
This is what I get when I compile it:
Thomas-Preeces-Mac:bin tom$ ./bmk makemods -a bah.serial
Compiling:glue.cpp
Compiling:list_osx.cpp
Compiling:source.bmx
Compiling:common.bmx
Compiling:serial.bmx
Archiving:serial.debug.macos.x86.a
Compiling:glue.cpp
Compiling:list_osx.cpp
Compiling:source.bmx
Compiling:common.bmx
Compiling:serial.bmx
Archiving:serial.release.macos.x86.a
Thomas-Preeces-Mac:bin tom$ 

This is a fresh copy from the googlecode repository too. Doesn't seem to want to compile serial.cc or unix.cc


Brucey(Posted 2014) [#4]
It seems your (default) bmk doesn't like .cc file extensions, which is a tad unfortunate, although I don't know how you managed to compile on Windows if you are using the same version...
The standard one does have some limitations, and I must have added support for .cc to my version at some point in the past.

You have a couple of options.

* rename the .cc files with .cpp, and amend the source.bmx file to match.

* use my custom bmk, which is known to work. You can find a copy of it here. (Compile bmk.bmx for release/console, and deploy in the bin folder with the included core.bmk and make.bmk - backup your bmk first, just in case).


PhotonTom(Posted 2014) [#5]
Ah that's fixed it.
Forgot that I had added your custom bmk to my windows installation. Hence why it was working fine on windows.
Thanks again for the help :)


Hummelpups(Posted 2015) [#6]
got it to work while testing around with arduino, blitzmax and osx.
i renamed the filtes to .cpp

just for readers information