Menu

How to compile esqlOC on a Mac?

Paulo Dias
2021-01-22
2021-01-30
  • Paulo Dias

    Paulo Dias - 2021-01-22

    I'm trying to generate esqlOC from sources in a Mac, but something is preventing me to run the make step.

    I believe it is something related to the C compiler available on MacOS, but I'm completely blind in this matter.

    Could someone kindly help me on that? Maybe I should change something in the makefile... but what?

    The "configure" step runs fine, but when I try to "make" this is what I get:

    /Library/Developer/CommandLineTools/usr/bin/make  all-recursive
    Making all in esqlOC
    /bin/sh ../libtool --tag=CXX   --mode=link CC  -g -O2   -o esqlOC esqlOC.o vcache.o  -lodbc 
    libtool: link: CC -g -O2 -o esqlOC esqlOC.o vcache.o -Wl,-bind_at_load  /usr/local/lib/libodbc.dylib -liconv -pthread
    clang: warning: argument unused during compilation: '-pthread' [-Wunused-command-line-argument]
    Undefined symbols for architecture x86_64:
      "std::terminate()", referenced from:
          ___clang_call_terminate in esqlOC.o
      "typeinfo for char const*", referenced from:
          CobPgm::processexec() in esqlOC.o
          CobPgm::processgenvars() in esqlOC.o
          GCC_except_table2 in esqlOC.o
      "typeinfo for char*", referenced from:
          CobPgm::CobPgm(char*) in esqlOC.o
          CobPgm::process2(cobline&, string&, int) in esqlOC.o
          CobPgm::processvar(cobline&, int&) in esqlOC.o
          CobPgm::processSEL(cobline&, int&) in esqlOC.o
          CobPgm::processINSUPDEL(cobline&, int&) in esqlOC.o
          CobPgm::processEXECUTEIMMED(cobline&, int&) in esqlOC.o
          CobPgm::processOPENCURSOR(cobline&, int&) in esqlOC.o
          ...
      "operator delete(void*)", referenced from:
          sarray::~sarray() in esqlOC.o
          string::~string() in esqlOC.o
          _main in esqlOC.o
          sarray::add(char const*) in esqlOC.o
          CobPgm::CobPgm(char*) in esqlOC.o
          string::substr(int, int) in esqlOC.o
          varcache::~varcache() in esqlOC.o
          ...
      "operator new[](unsigned long)", referenced from:
          sarray::add(char const*) in esqlOC.o
          CobPgm::CobPgm(char*) in esqlOC.o
          string::substr(int, int) in esqlOC.o
          CobPgm::processprep() in esqlOC.o
          CobPgm::processgenvars() in esqlOC.o
          CobPgm::processvarstat() in esqlOC.o
          string::operator+=(string&) in esqlOC.o
          ...
      "operator new(unsigned long)", referenced from:
          _main in esqlOC.o
          CobPgm::CobPgm(char*) in esqlOC.o
          string::substr(int, int) in esqlOC.o
          CobPgm::processprep() in esqlOC.o
          CobPgm::processvarstat() in esqlOC.o
          string::operator+(string&) in esqlOC.o
          CobPgm::process2(cobline&, string&, int) in esqlOC.o
          ...
      "___cxa_allocate_exception", referenced from:
          CobPgm::CobPgm(char*) in esqlOC.o
          CobPgm::processexec() in esqlOC.o
          CobPgm::processgenvars() in esqlOC.o
          CobPgm::process2(cobline&, string&, int) in esqlOC.o
          CobPgm::processvar(cobline&, int&) in esqlOC.o
          CobPgm::processSEL(cobline&, int&) in esqlOC.o
          CobPgm::processINSUPDEL(cobline&, int&) in esqlOC.o
          ...
      "___cxa_begin_catch", referenced from:
          _main in esqlOC.o
          CobPgm::process() in esqlOC.o
          ___clang_call_terminate in esqlOC.o
      "___cxa_end_catch", referenced from:
          _main in esqlOC.o
          CobPgm::process() in esqlOC.o
      "___cxa_rethrow", referenced from:
          CobPgm::process() in esqlOC.o
      "___cxa_throw", referenced from:
          CobPgm::CobPgm(char*) in esqlOC.o
          CobPgm::processexec() in esqlOC.o
          CobPgm::processgenvars() in esqlOC.o
          CobPgm::process2(cobline&, string&, int) in esqlOC.o
          CobPgm::processvar(cobline&, int&) in esqlOC.o
          CobPgm::processSEL(cobline&, int&) in esqlOC.o
          CobPgm::processINSUPDEL(cobline&, int&) in esqlOC.o
          ...
      "___gxx_personality_v0", referenced from:
          _main in esqlOC.o
          CobPgm::process() in esqlOC.o
          CobPgm::CobPgm(char*) in esqlOC.o
          string::substr(int, int) in esqlOC.o
          varcache::~varcache() in esqlOC.o
          clarray::~clarray() in esqlOC.o
          cobline::~cobline() in esqlOC.o
          ...
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [esqlOC] Error 1
    make[1]: *** [all-recursive] Error 1
    make: *** [all] Error 2
    

    I

     
    • Brian Tiffin

      Brian Tiffin - 2021-01-30

      Not an expert on Mac, Paulo, but those messages seem to indicate that the linker is in C mode and wants to be in C++ mode.

      You'll need to figure out a way to force C++ and not just plain C ABI mode for the ld link phase of clang. Or whatever ld is actually called in LLVM land on a Mac.

      Sadly no clue on what the easiest way to do that might be, Paulo, but I'd start by deep diving into the man page for clang, clang++, and ld on the Mac; look to --tag=CXX and see if the surrounding docs may have a hint on options to force C++ ABI linkage.

      Read up on -Wl,-bind_at_load too, that would be another place I would look, just because it looks unfamiliar to me.

      Might be as simple as forcing CC to clang++, if it happens to be using clang in any of the tool chain steps; don't know if that is even a thing, and can't tell from here.

      For ld here (GNU/Linux) there is mention of -Ur versus -r for proper relocation of C++ constructors, (but what I just typed may be a total waste of time red herring for you).

      Ask more if those hints don't lead to at least the start of solution path. Or maybe we'll get lucky and Sergey or other C++ expert will pop their head in and share some facts.

      Have good,
      Blue

       

      Last edit: Brian Tiffin 2021-01-30
    • Vincent (Bryan) Coen

      Check first if it is available via Homebrew
      Check what C compiler and version you have installed if needed use Homebrew to install GCC.

       

Anonymous
Anonymous

Add attachments
Cancel