dspinellis / dgsh

Shell supporting pipelines to and from multiple processes
http://www.spinellis.gr/sw/dgsh/
Other
323 stars 22 forks source link

Unable to Build on MacOs Mojave #108

Closed mitchwagner closed 5 years ago

mitchwagner commented 5 years ago

Hi,

I was attempting to build dgsh on MacOS Mojave; I followed the build instructions for Debian/Ubuntu GNU/Linux, posted here: https://www.spinellis.gr/sw/dgsh/#debian

After making sure I installed all listed prerequisites, I ran:

git clone --recursive https://github.com/dspinellis/dgsh.git
make config
make

This resulted in the following error during the make command:

Making all in src
/bin/sh ../libtool  --tag=CC   --mode=link gcc  -g -O2   -o dgsh-readval dgsh-readval.o kvstore.o libdgsh.a 
libtool: link: gcc -g -O2 -o dgsh-readval dgsh-readval.o kvstore.o  libdgsh.a
Undefined symbols for architecture x86_64:
  "_dgsh_force_include", referenced from:
      _dgsh_force_include_function in libdgsh.a(negotiate.o)
     (maybe you meant: _dgsh_force_include_function)
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]: *** [dgsh-readval] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
dspinellis commented 5 years ago

I think that core-tools/src/dgsh-elf.s needs to be adjusted for macOS Mojave. You may try compiling into assembly (cc -S) a small C program containing int force_include; to see how it should be defined. Then add that definition to core-tools/src/dgsh-elf.s. I'd appreciate a pull request.

mfragkoulis commented 5 years ago

The commit does what @dspinellis suggests. Since the data in the dgsh-elf.s file are used to identify a dgsh program by means of checking whether it is linked with the dgsh library, more work is required for this to also work on MacOS. This work is under way for a while now in the osx-build branch (so this is a known issue). In particular, check out dgsh_util.c. With this opportunity I'll try to push this work forward so that we can close this issue.

mfragkoulis commented 5 years ago

The issue should be resolved now. By the way, there is a more efficient implementation of parsing macho files under way via mmap instead of file read/seek operations. That said, besides performance the existing implementation should work fine. @mitchwagner you can retry building. If everything looks good, we can close this issue.

dspinellis commented 5 years ago

Seems to work now.