Error linking libxxx.so in Native Client (NaCl) - makefile

I am struggling to link libIrrlicht.so file with my example source files.
Here is my makefile
PROJECT:=testirrlicht
LDFLAGS:=-lppapi_gles2 -lppapi_cpp -Iinclude -lppapi libs/libIrrlicht.so
CXX_SOURCES:=testirrlicht.cc
 
THIS_MAKEFILE:=$(abspath $(lastword $(MAKEFILE_LIST)))
NACL_SDK_ROOT?=$(abspath $(dir $(THIS_MAKEFILE))../..)
 
CXXFLAGS:=-pthread -g -Wall -Werror -I./include -D_IRR_STATIC_LIB_ -fabi-version=1
 
OSNAME:=win
TC_PATH:=$(abspath $(NACL_SDK_ROOT)/toolchain/$(OSNAME)_x86_newlib)
CXX:=$(TC_PATH)/bin/i686-nacl-g++
 
CYGWIN ?= nodosfilewarning
export CYGWIN
 
all: $(PROJECT)_x86_32.nexe $(PROJECT)_x86_64.nexe
 
# Define 32 bit compile and link rules for C++ sources
x86_32_OBJS:=$(patsubst %.cc,%_32.o,$(CXX_SOURCES))
$(x86_32_OBJS) : %_32.o : %.cc $(THIS_MAKE)
        $(CXX) -o $# -c $< -m32 -O0 -g $(CXXFLAGS)
 
$(PROJECT)_x86_32.nexe : $(x86_32_OBJS)
        $(CXX) -o $# $^ -m32 -O0 -g $(CXXFLAGS) $(LDFLAGS)
 
# Define 64 bit compile and link rules for C++ sources
x86_64_OBJS:=$(patsubst %.cc,%_64.o,$(CXX_SOURCES))
$(x86_64_OBJS) : %_64.o : %.cc $(THIS_MAKE)
        $(CXX) -o $# -c $< -m64 -O0 -g $(CXXFLAGS)
 
$(PROJECT)_x86_64.nexe : $(x86_64_OBJS)
        $(CXX) -o $# $^ -m64 -O0 -g $(CXXFLAGS) $(LDFLAGS)
 
 
# Define a phony rule so it always runs, to build nexe and start up server.
.PHONY: RUN
RUN: all
        python ../httpd.py
Here is my compilation error:
$ make
/cygdrive/d/naclsdk/pepper_18/toolchain/win_x86_newlib/bin/i686-nacl-g++ -o testirrlicht_x86_3.nexe testirrlicht_32.o -m32 -O0 -g -pthread -g -Wall -Werror -I./include -D_IRR_STATIC_LIB_ -abi-version=1 -lppapi_gles2 -lppapi_cpp -Iinclude -lppapi libs/libIrrlicht.so
/x86_64-nacl-ld: warning: libstdc++.so.6, needed by libs/libIrrlicht.so, not found (try using rpath or -rpath-link)
/x86_64-nacl-ld: warning: libm.so.3c8d1f2e, needed by libs/libIrrlicht.so, not found (try usin -rpath or -rpath-link)
/x86_64-nacl-ld: warning: libgcc_s.so.1, needed by libs/libIrrlicht.so, not found (try using -path or -rpath-link)
/x86_64-nacl-ld: warning: libpthread.so.3c8d1f2e, needed by libs/libIrrlicht.so, not found (tr using -rpath or -rpath-link)
/x86_64-nacl-ld: warning: libc.so.3c8d1f2e, needed by libs/libIrrlicht.so, not found (try usin -rpath or -rpath-link)
libs/libIrrlicht.so: undefined reference to `wcscpy#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glAttachShader'
libs/libIrrlicht.so: undefined reference to `operator new[](unsigned int)#GLIBCXX_3.4'
libs/libIrrlicht.so: undefined reference to `glEnable'
libs/libIrrlicht.so: undefined reference to `glBindAttribLocation'
libs/libIrrlicht.so: undefined reference to `glHint'
libs/libIrrlicht.so: undefined reference to `glLineWidth'
libs/libIrrlicht.so: undefined reference to `wcslen#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `asin#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glIsEnabled'
libs/libIrrlicht.so: undefined reference to `glGetShaderiv'
libs/libIrrlicht.so: undefined reference to `memset#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glFrontFace'
libs/libIrrlicht.so: undefined reference to `glGetActiveUniform'
libs/libIrrlicht.so: undefined reference to `glBindRenderbuffer'
libs/libIrrlicht.so: undefined reference to `glDisable'
libs/libIrrlicht.so: undefined reference to `operator delete(void*)#GLIBCXX_3.4'
libs/libIrrlicht.so: undefined reference to `glTexParameterf'
libs/libIrrlicht.so: undefined reference to `glClear'
libs/libIrrlicht.so: undefined reference to `gmtime#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glFramebufferTexture2D'
libs/libIrrlicht.so: undefined reference to `__cxa_guard_release#CXXABI_1.3'
libs/libIrrlicht.so: undefined reference to `strncpy#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `swprintf#GLIBC_2.2'
libs/libIrrlicht.so: undefined reference to `glGetError'
libs/libIrrlicht.so: undefined reference to `glUniform4iv'
libs/libIrrlicht.so: undefined reference to `mbstowcs#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `strtod#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glStencilFunc'
libs/libIrrlicht.so: undefined reference to `eglInitialize'
libs/libIrrlicht.so: undefined reference to `fmod#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glStencilMask'
libs/libIrrlicht.so: undefined reference to `glGetAttachedShaders'
libs/libIrrlicht.so: undefined reference to `sscanf#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glDisableVertexAttribArray'
libs/libIrrlicht.so: undefined reference to `glDeleteProgram'
libs/libIrrlicht.so: undefined reference to `glGenRenderbuffers'
libs/libIrrlicht.so: undefined reference to `__cxa_guard_acquire#CXXABI_1.3'
libs/libIrrlicht.so: undefined reference to `glUniformMatrix4fv'
libs/libIrrlicht.so: undefined reference to `glUseProgram'
libs/libIrrlicht.so: undefined reference to `glClearColor'
libs/libIrrlicht.so: undefined reference to `glUniformMatrix3fv'
libs/libIrrlicht.so: undefined reference to `strcmp#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glUniform1iv'
libs/libIrrlicht.so: undefined reference to `sin#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `longjmp#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `eglCreateContext'
libs/libIrrlicht.so: undefined reference to `localtime#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `ftell#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `sinf#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `eglMakeCurrent'
libs/libIrrlicht.so: undefined reference to `glDeleteBuffers'
libs/libIrrlicht.so: undefined reference to `glReadPixels'
libs/libIrrlicht.so: undefined reference to `glDeleteShader'
libs/libIrrlicht.so: undefined reference to `_setjmp#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `eglQueryString'
libs/libIrrlicht.so: undefined reference to `glCheckFramebufferStatus'
libs/libIrrlicht.so: undefined reference to `strtoul#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `puts#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glEnableVertexAttribArray'
libs/libIrrlicht.so: undefined reference to `glGenFramebuffers'
libs/libIrrlicht.so: undefined reference to `glActiveTexture'
libs/libIrrlicht.so: undefined reference to `glBufferData'
libs/libIrrlicht.so: undefined reference to `acosf#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `atol#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glColorMask'
libs/libIrrlicht.so: undefined reference to `ferror#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `eglSwapBuffers'
libs/libIrrlicht.so: undefined reference to `floorf#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glBlendFunc'
libs/libIrrlicht.so: undefined reference to `glDetachShader'
libs/libIrrlicht.so: undefined reference to `tan#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glGetProgramInfoLog'
libs/libIrrlicht.so: undefined reference to `acos#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glCopyTexSubImage2D'
libs/libIrrlicht.so: undefined reference to `fwrite#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `getenv#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `fseek#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glBindTexture'
libs/libIrrlicht.so: undefined reference to `glRenderbufferStorage'
libs/libIrrlicht.so: undefined reference to `fputc#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glGetProgramiv'
libs/libIrrlicht.so: undefined reference to `glDepthMask'
libs/libIrrlicht.so: undefined reference to `malloc#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glStencilOp'
libs/libIrrlicht.so: undefined reference to `strstr#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `cosf#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `printf#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glCreateShader'
libs/libIrrlicht.so: undefined reference to `glDeleteTextures'
libs/libIrrlicht.so: undefined reference to `strncmp#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glGenerateMipmap'
libs/libIrrlicht.so: undefined reference to `glBlendEquation'
libs/libIrrlicht.so: undefined reference to `glBufferSubData'
libs/libIrrlicht.so: undefined reference to `glCullFace'
libs/libIrrlicht.so: undefined reference to `glCreateProgram'
libs/libIrrlicht.so: undefined reference to `fflush#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `fread#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `stderr#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `memcpy#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glPixelStorei'
libs/libIrrlicht.so: undefined reference to `glGetIntegerv'
libs/libIrrlicht.so: undefined reference to `strlen#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glGenBuffers'
libs/libIrrlicht.so: undefined reference to `operator delete[](void*)#GLIBCXX_3.4'
libs/libIrrlicht.so: undefined reference to `__errno_location#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `atan2f#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `atan2#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glDrawElements'
libs/libIrrlicht.so: undefined reference to `glDeleteFramebuffers'
libs/libIrrlicht.so: undefined reference to `glFramebufferRenderbuffer'
libs/libIrrlicht.so: undefined reference to `cos#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `eglSwapInterval'
libs/libIrrlicht.so: undefined reference to `glUniformMatrix2fv'
libs/libIrrlicht.so: undefined reference to `glTexImage2D'
libs/libIrrlicht.so: undefined reference to `eglGetError'
libs/libIrrlicht.so: undefined reference to `pow#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glUniform2iv'
libs/libIrrlicht.so: undefined reference to `glDepthFunc'
libs/libIrrlicht.so: undefined reference to `memcmp#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `fopen#GLIBC_2.1'
libs/libIrrlicht.so: undefined reference to `glDrawArrays'
libs/libIrrlicht.so: undefined reference to `fmodf#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glDeleteRenderbuffers'
libs/libIrrlicht.so: undefined reference to `glClearDepthf'
libs/libIrrlicht.so: undefined reference to `glScissor'
libs/libIrrlicht.so: undefined reference to `time#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `fprintf#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `atof#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glTexSubImage2D'
libs/libIrrlicht.so: undefined reference to `powf#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glVertexAttribPointer'
libs/libIrrlicht.so: undefined reference to `atoi#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glGetBooleanv'
libs/libIrrlicht.so: undefined reference to `strcpy#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `wcscmp#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `memmove#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glGetString'
libs/libIrrlicht.so: undefined reference to `glBindBuffer'
libs/libIrrlicht.so: undefined reference to `__assert_fail#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glPolygonOffset'
libs/libIrrlicht.so: undefined reference to `glBindFramebuffer'
libs/libIrrlicht.so: undefined reference to `glLinkProgram'
libs/libIrrlicht.so: undefined reference to `glUniform3iv'
libs/libIrrlicht.so: undefined reference to `abort#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glUniform1fv'
libs/libIrrlicht.so: undefined reference to `glGetShaderInfoLog'
libs/libIrrlicht.so: undefined reference to `__cxa_pure_virtual#CXXABI_1.3'
libs/libIrrlicht.so: undefined reference to `sprintf#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glUniform2fv'
libs/libIrrlicht.so: undefined reference to `glShaderSource'
libs/libIrrlicht.so: undefined reference to `__cxa_atexit#GLIBC_2.1.3'
libs/libIrrlicht.so: undefined reference to `exit#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `snprintf#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `eglBindAPI'
libs/libIrrlicht.so: undefined reference to `operator new(unsigned int)#GLIBCXX_3.4'
libs/libIrrlicht.so: undefined reference to `glViewport'
libs/libIrrlicht.so: undefined reference to `glUniform3fv'
libs/libIrrlicht.so: undefined reference to `gettimeofday#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glUniform4fv'
libs/libIrrlicht.so: undefined reference to `eglGetDisplay'
libs/libIrrlicht.so: undefined reference to `eglTerminate'
libs/libIrrlicht.so: undefined reference to `glGetUniformLocation'
libs/libIrrlicht.so: undefined reference to `glTexParameteri'
libs/libIrrlicht.so: undefined reference to `eglCreateWindowSurface'
libs/libIrrlicht.so: undefined reference to `free#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `logf#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `setlocale#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `fclose#GLIBC_2.1'
libs/libIrrlicht.so: undefined reference to `sqrtf#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `glGenTextures'
libs/libIrrlicht.so: undefined reference to `glCompileShader'
libs/libIrrlicht.so: undefined reference to `ceilf#GLIBC_2.0'
libs/libIrrlicht.so: undefined reference to `eglChooseConfig'
libs/libIrrlicht.so: undefined reference to `sqrt#GLIBC_2.0'
collect2: ld returned 1 exit status
Makefile:58: recipe for target `testirrlicht_x86_32.nexe' failed
make: *** [testirrlicht_x86_32.nexe] Error 1

Fixed the problem.
I built library in glibc and the sample application using newlib. Now, I changed both to glibc and partially fixed some problem.
$ make
/cygdrive/d/naclsdk/pepper_18/toolchain/win_x86_glibc/bin/i686-nacl-gcc -o testirrlicht_x86_32.nexe testirrlicht_32.o -m32 -O0 -g -Wall -Iinclude -lpthread -lppapi_cpp -lppapi -lstdc++ -lgcc -lppapi_gles2 libs/libIrrlicht.so
/libexec/../lib/gcc/x86_64-nacl/4.4.3/../../../../x86_64-nacl/lib/../lib32/libppapi_cpp.so: warning: warning: pthread_cancel is not implemented and will always fail
libs/libIrrlicht.so: undefined reference to `eglCreateWindowSurface'
libs/libIrrlicht.so: undefined reference to `eglBindAPI'
libs/libIrrlicht.so: undefined reference to `eglCreateContext'
libs/libIrrlicht.so: undefined reference to `eglMakeCurrent'
libs/libIrrlicht.so: undefined reference to `eglGetDisplay'
libs/libIrrlicht.so: undefined reference to `eglChooseConfig'
libs/libIrrlicht.so: undefined reference to `eglInitialize'
libs/libIrrlicht.so: undefined reference to `eglQueryString'
/libexec/../lib/gcc/x86_64-nacl/4.4.3/../../../../x86_64-nacl/lib/../lib32/libppapi_cpp.so: undefined reference to `pp::CreateModule()'
libs/libIrrlicht.so: undefined reference to `eglSwapInterval'
libs/libIrrlicht.so: undefined reference to `eglSwapBuffers'
libs/libIrrlicht.so: undefined reference to `eglGetError'
libs/libIrrlicht.so: undefined reference to `eglTerminate'
collect2: ld returned 1 exit status
Makefile:58: recipe for target `testirrlicht_x86_32.nexe' failed
make: *** [testirrlicht_x86_32.nexe] Error 1

Related

Why does afl-clang-fast compile bitcode with an error?

I used the tool gllvm to build the whole-program LLVM bitcodes file (tiffsplit.bc). Then I used afl-clang-fast compile it to generate the instrumented binary. However, it gives an error. I found a similar problem on github. I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this.
My commands are as follows:
CC=gclang ./configure --enable-shared=no --enable-static=yes
make -j$(nproc)
get-bc tiffsplit
afl-clang-fast tiffsplit.bc -o tiffsplit
The error is as follwos:
/tmp/tiffsplit-fcc4f4.o: In function `TIFFDefaultTransferFunction':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:143: undefined reference to `pow'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:143: undefined reference to `floor'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:143: undefined reference to `pow'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:143: undefined reference to `floor'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:143: undefined reference to `pow'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:143: undefined reference to `floor'
/tmp/tiffsplit-fcc4f4.o: In function `DoubleToRational':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `floor'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `floor'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `floor'
/tmp/tiffsplit-fcc4f4.o: In function `DoubleToSrational':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `floor'
/tmp/tiffsplit-fcc4f4.o:/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: more undefined references to `floor' follow
/tmp/tiffsplit-fcc4f4.o: In function `LogL16toY':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `exp'
/tmp/tiffsplit-fcc4f4.o: In function `LogL16fromY':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `log'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `log'
/tmp/tiffsplit-fcc4f4.o: In function `XYZtoRGB24':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `sqrt'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `sqrt'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `sqrt'
/tmp/tiffsplit-fcc4f4.o: In function `LogL10toY':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `exp'
/tmp/tiffsplit-fcc4f4.o: In function `LogL10fromY':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `log'
/tmp/tiffsplit-fcc4f4.o: In function `oog_encode':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `atan2'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `atan2'
/tmp/tiffsplit-fcc4f4.o: In function `LogLuv24toXYZ':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `exp'
/tmp/tiffsplit-fcc4f4.o: In function `LogLuv24fromXYZ':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `log'
/tmp/tiffsplit-fcc4f4.o: In function `LogLuv32toXYZ':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `exp'
/tmp/tiffsplit-fcc4f4.o: In function `LogLuv32fromXYZ':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `log'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `log'
/tmp/tiffsplit-fcc4f4.o: In function `Luv24toRGB':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `sqrt'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `sqrt'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `sqrt'
/tmp/tiffsplit-fcc4f4.o: In function `Luv32toXYZ':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `exp'
/tmp/tiffsplit-fcc4f4.o: In function `Luv32toRGB':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `exp'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `sqrt'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `sqrt'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `sqrt'
/tmp/tiffsplit-fcc4f4.o: In function `L16toY':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `exp'
/tmp/tiffsplit-fcc4f4.o: In function `L16toGry':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `exp'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `sqrt'
/tmp/tiffsplit-fcc4f4.o: In function `Luv24fromXYZ':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `log'
/tmp/tiffsplit-fcc4f4.o: In function `L16fromY':
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `log'
/home/ubuntu/tiff-4.3.0/libtiff/tif_aux.c:409: undefined reference to `log'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
afl-clang-fast tiffsplit.bc -o tiffsplit -lm

Ruby - undefined local variable or method `_1'

I'm getting the error undefined local variable or method '_1' for main:Object when I run the following code. Any idea why I'm getting this error? and how can I store the result in a variable.
result="-e hostname=webserver001 -e username=root -e password=testing123"
p result.scan(/\w+=\w+/)
.map { _1.split("=") }
.to_h
Error:
Traceback (most recent call last):
2: from main.rb:4:in `<main>'
1: from main.rb:4:in `map'
main.rb:4:in `block in <main>': undefined local variable or method `_1' for main:Object (NameError)
exit status 1
You're probably running an older version of ruby - the numbered parameters for blocks have been available in ruby since 2.7 - see https://www.bigbinary.com/blog/ruby-2-7-introduces-numbered-parameters-as-default-block-parameters
You can make it work on older version by using
p result.scan(/\w+=\w+/)
.map { |s| s.split("=") }
.to_h

Why is RSpec giving a NoMethodError when method exists?

I'm getting the error below
$ bundle exec rspec calculatorcli_spec.rb
Failure/Error: c = CalculatorCLI.parse
NoMethodError:
undefined method `parse' for CalculatorCLI:Class
from the below simple calculator class
CalculatorCLI is a class, and you're missing its initialization
either change CalculatorCLI.parse to CalculatorCLI.new.parseor changedef parsetodef self.parseinCalculatorCLI` definition

Ruby methods confusion

If I run:
myObj.methods - Object.methods
I see the method I expect listed in the results:
[:myMethod]
If I then run:
myObj.myMethod()
I get the following error:
symbol lookup error ... undefined symbol: myMethod
What is happening? Am I calling myMethod correctly?

Where is Float#to_d?

Sometimes I see code using to_d. The ruby documentation even states there is a Float#to_d method. However, it's not in my version of ruby (ruby 1.9.3p263 (2012-08-23 revision 36792).
1.9.3p263 :001 > "0.0".to_d
NoMethodError: undefined method `to_d' for "0.0":String
from (irb):1
from /home/iblue/.rvm/rubies/ruby-1.9.3-head/bin/irb:16:in `<main>'
1.9.3p263 :002 > 0.0.to_d
NoMethodError: undefined method `to_d' for 0.0:Float
from (irb):2
from /home/iblue/.rvm/rubies/ruby-1.9.3-head/bin/irb:16:in `<main>'
1.9.3p263 :003 > 0.to_d
NoMethodError: undefined method `to_d' for 0:Fixnum
from (irb):3
from /home/iblue/.rvm/rubies/ruby-1.9.3-head/bin/irb:16:in `<main>'
No to_d in Float, String or Fixnum. What's going on?
As stated in the example of the documentation you need
require 'bigdecimal'
require 'bigdecimal/util'

Resources