Getting errors while compiling Clewn - c

My environment:
OS: OSX ML 10.8.5
VIM: 7.4
GCC: 4.2.1 (Apple LLVM version 5.0)
GDB: GNU gdb 6.3.50-20050815
I want to debugging in VIM with C programming language. After I seached Google, I found Clewn, but when I make it, it returned the following messages.
make all-recursive
Making all in .
gcc -DHAVE_CLEWN -g -O2 -Wall -o clewn clewn.o gdb_lvl2.o gdb_lvl3.o misc.o netbeans.o obstack.o pty.o -lreadline -lcurses
Undefined symbols for architecture x86_64:
"_ding", referenced from:
_clewn_beep in misc.o
"_rl_getc", referenced from:
_cli_getc in clewn.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]: *** [clewn] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Excuse for my English, hope you know what I means. And thank you so much!!!

I haven't used clewn since around 2007–2008 and never on OS X, but you could try the following to at least get it to compile.
"_ding", referenced from:
_clewn_beep in misc.o
Simply comment out the body of the clewn_beep function. At least for now.
"_rl_getc", referenced from:
_cli_getc in clewn.o
Try replacing the call to rl_getc in clewn.c with a call to cli_getc and see if that works.
I also had to add the following line in clewn.c to get it to compile (OS X 10.8.5):
extern int rl_done;

Related

make doesn't link math lib when compiling

I get the following error while compiling xpdf using make. I've tried using the command:
LIBS=-lm make
However, it doesn't work. I know the problem is that the c compiler cannot recognise the math symbols in the source code because the math library is not available to it, but I don't know how to fix it.
[ 71%] Linking CXX executable pdftohtml
/usr/bin/ld: CMakeFiles/xpdf_objs.dir/Gfx.cc.o: undefined reference to symbol 'acos##GLIBC_2.2.5'
//usr/lib64/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [xpdf/CMakeFiles/pdftohtml.dir/build.make:219: xpdf/pdftohtml] Error 1
make[1]: *** [CMakeFiles/Makefile2:428: xpdf/CMakeFiles/pdftohtml.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
I have put my Makefile and makeLists.txt on pastebin for more information
I realised I had to use the g++ compiler instead of gcc after reading the man page for gcc which stated:
The usual way to run GCC is to run the executable called gcc, or
machine-gcc when cross-compiling, or machine-gcc-version to run a
specific
version of GCC. When you compile C++ programs, you should invoke GCC as g++ instead.

Trouble debugging C program in Eclipse on Yosemite

I am getting the following persistent errors trying to debug a C program in Eclipse Juno on my mac:
Building target: TimeStamps
Invoking: MacOS X C Linker
gcc -v -o "TimeStamps" ./graphic/arrow.o ./graphic/axesdraw.o . . .
Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.10.0 -o
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [TimeStamps] Error 1
So, I am confused about how to fix this in Eclipse. The main routing is in timestamp_test.c
I have -g -v as compiler flags, and -v as a linker flag.
No .o files are made.
Based on the the error given, you need to add the main function to timestamp_test.c.
Or pass the file that have the main function implemented to the compiler.

Undefined symbols argp_parse and arpg_usage when installing rng-tools on OSX

I am currently trying to install rng-tools on OSX, as I have a specific need for it to speed up a certain simulator that I am currently using. At first, I faced the problem of not having argp, so I installed argp-standalone from Homebrew. However, I still receive the following error message when trying to make rng-tools:
gcc -g -O2 -o rngtest stats.o rngtest.o librngd.a
Undefined symbols for architecture x86_64:
"_argp_parse", referenced from:
_main in rngtest.o
"_argp_usage", referenced from:
_parse_opt in rngtest.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[2]: *** [rngtest] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
I checked /usr/local/include/argp.h and it does seem to contain the correct function definitions referenced in rngtest.c, so any thoughts on what might be the problem?
I just needed rngtest which I managed to compile on OSX using this https://github.com/fproulx/rngtest (which also needs brew install argp-standalone). I made that into a homebrew formula which can be obtained here: https://github.com/oderwat/homebrew-experiments

Compiling and linking libev on Mac OS X

Yet another symbol(s) not found issue with Mac OS X. I wrote a C program that uses the libev event loop library that when compiled produces this output:
$ make
clang midnight.c midnight_logging.c -o midnight
Undefined symbols for architecture x86_64:
"_ev_default_loop", referenced from:
_main in midnight-Wlcawk.o
"_ev_io_start", referenced from:
_main in midnight-Wlcawk.o
"_ev_run", referenced from:
_main in midnight-Wlcawk.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: *** [midnight] Error 1
I used homebrew to install libev. The shared library is in /usr/local/lib per normal and I've used every combination of compiler arguments including "-I /usr/local/lib", "-l libev" and "-L /usr/local/lib".
Assistance appreciated, I'd rather not have to statically compile.
But you do not link against libev! The compiler isn't a clairvoyant (nor is the linker), you have to tell it what to search for those symbols...
clang midnight.c midnight_logging.c -o midnight -lev

openSSL mac undefined symbol

I'm developing a TLSclient for MAC, and I'm having a little building my project on MACOSX (working very well on linux) and most particulary in using openssl libs.
Here's my console error I hope you could help me deal with:
gcc -lpthread -o *.o /opt//local/var/macports/software/openssl97/0.9.7m_0/opt/local/lib/openssl97/lib/libssl.a /opt//local/var/macports/software/openssl97/0.9.7m_0/opt/local/lib/openssl97/lib/libcrypto.a -ldl
Undefined symbols:
"_SSL_CTX_set_info_callback", referenced from:
_MTLSServer_Setup in MTLSServer.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [mtls_server] Error 1
Thanks for your help
In OpenSSL 0.9.7 SSL_CTX_set_info_callback is a macro, and your code is trying to link to a function. This probably means you don't have the correct path to the headers.
I'm a little puzzled for other things in your command line:
Why are you statically linking with an old version of OpenSSL 0.9.7. Recent versions of Mac OS X have 0.9.8 included.
The -o *.o seems to be an error it should be -o something *.o
The -lpthread argument should be after libcrypto.

Resources