compiling srp-2.1.2 under ubuntu - ubuntu-9.10

i have download srp-2.1.2 package and just try to compile it under ubuntu.
but it is not going to be compiled completely.
please tell me how to compile it under ubuntu .
error-
root#ubuntu:~/Desktop/srp-2.1.2/libsrp# make
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c t_client.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c t_conf.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c t_conv.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c t_getpass.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c t_sha.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c t_math.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c t_misc.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c t_pw.c
t_pw.c: In function ‘t_changepw’:
t_pw.c:468: warning: ignoring return value of ‘link’, declared with attribute warn_unused_result
t_pw.c:470: warning: ignoring return value of ‘link’, declared with attribute warn_unused_result
t_pw.c: In function ‘t_deletepw’:
t_pw.c:540: warning: ignoring return value of ‘link’, declared with attribute warn_unused_result
t_pw.c:542: warning: ignoring return value of ‘link’, declared with attribute warn_unused_result
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c t_read.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c t_server.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c t_truerand.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c cstr.c
cstr.c:24: warning: initialization from incompatible pointer type
cstr.c:24: warning: initialization from incompatible pointer type
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c srp.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c rfc2945_client.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c rfc2945_server.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c srp6_client.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c srp6_server.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c yp_misc.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c yp_tpasswd.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c yp_tconf.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c nsw_tpasswd.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c nsw_tconf.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c nsswitch.c
rm -f libsrp.a
ar cru libsrp.a t_client.o t_conf.o t_conv.o t_getpass.o t_sha.o t_math.o t_misc.o t_pw.o
t_read.o t_server.o t_truerand.o cstr.o srp.o rfc2945_client.o rfc2945_server.o
srp6_client.o srp6_server.o yp_misc.o yp_tpasswd.o yp_tconf.o nsw_tpasswd.o nsw_tconf.o
nsswitch.o
ranlib libsrp.a
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c tconf.c
tconf.c: In function ‘main’:
tconf.c:188: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
tconf.c:202: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
tconf.c:230: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
tconf.c:263: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
gcc -fPIC -O -o tconf tconf.o libsrp.a -lcrypto -ldl -lnsl
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c clitest.c
clitest.c: In function ‘main’:
clitest.c:51: warning: ignoring return value of ‘gets’, declared with attribute warn_unused_result
clitest.c:53: warning: ignoring return value of ‘gets’, declared with attribute warn_unused_result
clitest.c:57: warning: ignoring return value of ‘gets’, declared with attribute warn_unused_result
clitest.c:61: warning: ignoring return value of ‘gets’, declared with attribute warn_unused_result
clitest.c:74: warning: ignoring return value of ‘gets’, declared with attribute warn_unused_result
clitest.c:79: warning: ignoring return value of ‘gets’, declared with attribute warn_unused_result
gcc -fPIC -O -o clitest clitest.o libsrp.a -lcrypto -ldl -lnsl
clitest.o: In function `main':
clitest.c:(.text+0x56): warning: the `gets' function is dangerous and should not be used.
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c srvtest.c
srvtest.c: In function ‘main’:
srvtest.c:77: warning: ignoring return value of ‘gets’, declared with attribute warn_unused_result
srvtest.c:103: warning: ignoring return value of ‘gets’, declared with attribute warn_unused_result
srvtest.c:109: warning: ignoring return value of ‘gets’, declared with attribute warn_unused_result
srvtest.c:118: warning: ignoring return value of ‘gets’, declared with attribute warn_unused_result
gcc -fPIC -O -o srvtest srvtest.o libsrp.a -lcrypto -ldl -lnsl
srvtest.o: In function `main':
srvtest.c:(.text+0x15a): warning: the `gets' function is dangerous and should not be used.
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c getpwtest.c
gcc -fPIC -O -o getpwtest getpwtest.o libsrp.a -lcrypto -ldl -lnsl
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c srptest.c
gcc -fPIC -O -o srptest srptest.o libsrp.a -lcrypto -ldl -lnsl
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c srpbench.c
gcc -fPIC -O -o srpbench srpbench.o libsrp.a -lcrypto -ldl -lnsl
gcc -DHAVE_CONFIG_H -I. -I. -I. -fPIC -O -c srp6bench.c
srp6bench.c: In function ‘do_srp6preparam’:
srp6bench.c:197: warning: incompatible implicit declaration of built-in function ‘exit’
srp6bench.c: In function ‘usage’:
srp6bench.c:214: warning: incompatible implicit declaration of built-in function ‘exit’
srp6bench.c: In function ‘main’:
srp6bench.c:246: warning: incompatible implicit declaration of built-in function ‘exit’
gcc -fPIC -O -o srp6bench srp6bench.o libsrp.a -lcrypto -ldl -lnsl `
-
please tell me where is the problem as soon as possible
thanks
hi robsn thanks for this answer.
ok after compiling libsrp by using make it is going to create libsrp.a .please tell me can i use this libsrp.a as a shared library and how?.i want to use libsrp in a c# file under ubuntu by using dllimport.
`

I was able to reproduce this behaviour (the initially posted problem, see my comment). A temporary solution to get it compiled is:
make a safe copy of /usr/include/stdio.h
edit the original stdio.h:
On line 651 (extern _IO_ssize_t getline...) replace 'getline' with 'parseline'
compile srp
revert edits.

I only see warnings (no errors) which should not be a problem. Didn't it compile completely?
If your last posted line...
gcc -fPIC -O -o srp6bench srp6bench.o libsrp.a -lcrypto -ldl -lnsl `
...went well you should have a file called 'srp6bench'.
(Sorry for posting an answer but my reputation doesn't allow comments on others posts yet.)

Related

Cross-compiling Coqui + TFLite for armv7ahf in Yocto: R_ARM_TLS_LE32 relocation not permitted in shared object

I'm trying to do a Yocto build of libstt.so from the Coqui project, with TFLite as the backend, for the Snapdragon 210 which has an armv7ahf processor. I've been using the meta-tensorflow OpenEmbedded layer as a starting point.
Getting Bazel compiled and working with the Yocto cross-compilation toolchain was heinously complicated, but that's happily behind me now, and my layer has progressed to building libstt.so itself.
However, towards the end of the build in the linking phase I get this R_ARM_TLS_LE32 relocation not permitted in shared object error:
ld: bazel-out/arm-opt/bin/tensorflow/lite/kernels/libeigen_support.pic.a(eigen_support.pic.o)(.text._ZNK6tflite13eigen_support12_GLOBAL__N_122EigenThreadPoolWrapper15CurrentThreadIdEv+0x2c): R_ARM_TLS_LE32 relocation not permitted in shared object
bazel-out/arm-opt/bin/tensorflow/lite/kernels/libeigen_support.pic.a(eigen_support.pic.o): In function `tflite::eigen_support::(anonymous namespace)::EigenThreadPoolWrapper::CurrentThreadId() const':
eigen_support.cc:(.text._ZNK6tflite13eigen_support12_GLOBAL__N_122EigenThreadPoolWrapper15CurrentThreadIdEv+0x2c): dangerous relocation: unsupported relocation
I gather that R_ARM_TLS_LE32 is an ELF static Thread Local Storage relocation code, and that eigen_support is incorrectly being compiled with static code that the linker won't accept? But I'm definitely out of my depth here.
The build is being initiated with:
bazel build \
--config=monolithic \
--verbose_explanations --verbose_failures \
--action_env ANDROID_NDK_API_LEVEL=21 \
--config=android \
--config=android_arm \
--define runtime=tflite \
--cxxopt="-fpermissive" \
--cxxopt="-std=c++14" \
--cpu="${BAZEL_TARGET_CPU}" \
-c opt \
--copt="-D_GLIBCXX_USE_CXX11_ABI=0" \
--copt=-fvisibility=hidden \
--copt=-O3 \
--copt=-D_GLIBCXX_USE_C99 \
--crosstool_top=#local_config_yocto_compiler//:toolchain \
--host_crosstool_top=#bazel_tools//tools/cpp:toolchain \
--subcommands --explain=${T}/explain.log \
//native_client:libstt.so
}
eigen_support.pic.o itself is built with the following command (from the error log, formatted for ease of reading). Can you help me figure out why it's compiling wrong?
arm-oe-linux-gnueabi-gcc
-fstack-protector
-g0
-O2
-DNDEBUG
-ffunction-sections
-fdata-sections
-D_PYTHON_INCLUDE_TARGET
-MD
-MF bazel-out/arm-opt/bin/tensorflow/lite/kernels/_objs/eigen_support/eigen_support.pic.d
'-frandom-seed=bazel-out/arm-opt/bin/tensorflow/lite/kernels/_objs/eigen_support/eigen_support.pic.o'
-fPIC
-DEIGEN_MPL2_ONLY
'-DEIGEN_MAX_ALIGN_BYTES=64'
'-DEIGEN_HAS_TYPE_TRAITS=0'
-iquote .
-iquote bazel-out/arm-opt/bin
-iquote external/gemmlowp
-iquote bazel-out/arm-opt/bin/external/gemmlowp
-iquote external/eigen_archive
-iquote bazel-out/arm-opt/bin/external/eigen_archive
-iquote external/local_config_sycl
-iquote bazel-out/arm-opt/bin/external/local_config_sycl
-iquote external/ruy
-iquote bazel-out/arm-opt/bin/external/ruy
-iquote external/cpuinfo
-iquote bazel-out/arm-opt/bin/external/cpuinfo
-iquote external/clog
-iquote bazel-out/arm-opt/bin/external/clog
-Ibazel-out/arm-opt/bin/external/clog/_virtual_includes/clog
-isystem external/eigen_archive
-isystem bazel-out/arm-opt/bin/external/eigen_archive
-DTFLITE_WITH_RUY_GEMV
-w
-w
-fPIC
-D_GLIBCXX_USE_C99
-D_PYTHON_INCLUDE_TARGET
'-march=armv7-a'
'-mfpu=neon'
'-mfloat-abi=hard'
-Wl,-O1
'-Wl,--hash-style=gnu'
-Wl,--as-needed
-Wl,-z,relro,-z,now,-z,noexecstack
-fstack-protector-strong
-pie -fPIE '-D_FORTIFY_SOURCE=2'
-Wa,--noexecstack
-Wformat -Wformat-security '-Werror=format-security'
'--sysroot=/home/gbw/sc20_linux/poky/build/tmp-glibc/work/armv7ahf-neon-oe-linux-gnueabi/coqui/v0.10.0-alpha.9-r0/bazel/output_base/external/yocto_compiler/recipe-sysroot'
-O2
-Wa,--noexecstack
-fexpensive-optimizations
-frename-registers
-fomit-frame-pointer
-ftree-vectorize
-finline-functions
'-finline-limit=64'
'-Wno-error=maybe-uninitialized'
'-Wno-error=unused-result'
-fvisibility-inlines-hidden
'-std=c++14'
'-std=c++14' -fpermissive
'-std=c++14'
-DFARMHASH_NO_CXX_STRING
-Wno-sign-compare
-O3
-fno-exceptions
'-Wno-error=reorder'
-Wno-builtin-macro-redefined
'-D__DATE__="redacted"'
'-D__TIMESTAMP__="redacted"'
'-D__TIME__="redacted"'
-no-canonical-prefixes
-fno-canonical-system-headers
-c tensorflow/lite/kernels/eigen_support.cc
-o bazel-out/arm-opt/bin/tensorflow/lite/kernels/_objs/eigen_support/eigen_support.pic.o)
The issue was due to the -fPIE compiler flag being added by a bazelrc file that I didn't notice. Removing -fPIE fixed the error.

suppress warnings from system headers did not work

I try to compile gmock headers and get tons of warnings like:
/opt/foreign_components/gmock-1.7.0/fused-src/gtest/gtest.h:10298:40: warning: 'testing::internal::ParamIteratorInterface* testing::internal::ValuesInIteratorRangeGenerator::Iterator::Clone() const [with T = bool]' can be marked override [-Wsuggest-override]
I already include the gmock headers with -isystem as described here:
How to suppress GCC warnings from library headers?
I compile with:
g++ -Wsuggest-override -I ../ -I ../../generic/ -isystem /opt/foreign_components/gmock-1.7.0/fused-src/gmock/ -isystem /opt/foreign_components/gmock-1.7.0/fused-src -g -Wall -pedantic -pthread -std=c++14 -O2 /opt/foreign_components/gmock-1.7.0/fused-src/gmock-gtest-all.cc -c -o build-ut-std-xsysg-nomemdbg-o2-dynamic-noncov//opt/foreign_components/gmock-1.7.0 /fused-src/gmock-gtest-all.o
How can I solve this issue?

Argument unused during compilation?

From the research I have done, the problem seems to be with clang. If that is the case, how would I fix this on a Mac? Would switching to Ubuntu/Linux be a better option?
I'm not sure if it is relevant, but my professor is having us code using C syntax using g++ and saving our files as '.cpp' before we dive into C++.
Warning:
clang: warning: argument unused during compilation: '-ansi'
[-Wunused-command-line-argument]
Makefile:
CC = g++
calendar: main.o calendar.o appt.o day.o time.o
$(CC) main.o calendar.o appt.o day.o time.o -g -ansi -Wall -o calendar.out
%.o: %.cpp
$(CC) -Wall -c $<
You are correct in believing that this warning is issued by clang++ in these
circumstances and not by g++, and that you see it on your Mac because g++ is
really clang++.
The GCC option -ansi is meaningful for compilation and not meaningful
for linkage. Clang is warning you because you are passing it in your linkage recipe:
$(CC) main.o calendar.o appt.o day.o time.o -g -ansi -Wall -o calendar.out
where it is ineffective, and not passing it to your compilation recipe:
$(CC) -Wall -c $<
The wording of the diagnostic is misleading since it is provoked here
precisely by the absence of compilation. Nevertheless, it does
draw attention to a mistake on your part. Remove -ansi from your linkage recipe and add it to your compilation recipe.

gcc: gnustep-config: No such file or directory and unrecognized command line option -fobjc-flags

Hi all please provide me solution for this i want to execute objective using command line
1)
command : gcc -o filename 'gnustep-config --objc-flags' 'gnustep-config --base-libs' -o filename.m
error :
gcc: gnustep-config: No such file or directory
gcc:gnustep-config: No such file or directory
cc1obj: error: unrecognized command line option "-fobjc-flags"
cc1obj: error: unrecognized command line option "-fbase-libs"
2)
command : gcc -o filename 'gnustep-config --objc-flags' -lgnustep-base filename.m
error :
gcc: gnustep-config: No such file or directory
cc1obj: error: unrecognized command line option "-fobjc-flags"
When i used "-lgnustep-base" one of my error resolved but what about gnustep-config --objc-flags package...
Please provide me solution ......
hey I found the solution !!!!
just type the command "gnustep-config --objc-flags" in command prompt...
You will get o/p like : " /-MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -D_REENTRANT -fPIC -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -g -O2 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -fgnu-runtime -fconstant-string-class=NSConstantString -I. -I/root/GNUstep/Library/Headers -I/usr/local/include/GNUstep -I/usr/include/GNUstep "
so now you need to copy all this and placed it to the command prompt like this:
"gcc -MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -D_REENTRANT -fPIC -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -g -O2 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -fgnu-runtime -fconstant-string-class=NSConstantString -I. -I/root/GNUstep/Library/Headers -I/usr/local/include/GNUstep -I/usr/include/GNUstep -o filename -lgnustep-base filename.m "
type all command without any space.......

Error linking with clang+llvm

I am trying to apply LLVM optimizations to a few Image Feature Extraction algorithms which have been implemented using openCV. The LLVM-based profiler works fine with simple programs (For instance, HelloWorld), and the feature extraction algorithms too work separately as expected.
However I was unable to use the profiler for the algorithms and got the following error while linking the OpenCV libraries to the optimized code.
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
COLLECT_GCC_OPTIONS='-v' '-g' '-L/home/silky/opencv/share/OpenCV/3rdparty/lib' '- L/home/silky/opencv/OpenCVInstall/x86/lib' '-shared-libgcc' '-mtune=generic' '-march=x86-64' as --gdwarf2 --64 -o /tmp/ccAhPffW.o out.s
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.6/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-g' '-L/home/silky/opencv/share/OpenCV/3rdparty/lib' '-L/home/silky/opencv/OpenCVInstall/x86/lib' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/4.6/collect2 --sysroot=/ --build-id --no-add-needed --as-needed --eh-frame-hdr -m elf_x86_64 --hash-style=gnu -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.6/crtbegin.o -L/home/silky/opencv/share/OpenCV/3rdparty/lib -L/home/silky/opencv/OpenCVInstall/x86/lib -L/usr/lib/gcc/x86_64-linux-gnu/4.6 -L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.6/../../.. /tmp/ccAhPffW.o -lpthread -lrt -lopencv_calib3d -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgproc -lopencv_ml -lopencv_objdetect -lopencv_video -lopencv_nonfree -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/4.6/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crtn.o
/tmp/ccAhPffW.o:(.debug_info+0x49a14): undefined reference to `.Lline_table_start1'
collect2: ld returned 1 exit status
I've used the following commands to compile and link the files.
clang -emit-llvm -c -Wall -g -O0 -DCLOCK_GETTIME_TIMING -DOPENCV_2_4 -I/home/opencv/OpenCVInstall/x86/include -o ThreadManager.bc FeatureExtraction/ThreadManager.cpp
clang -emit-llvm -c -Wall -g -O0 -DCLOCK_GETTIME_TIMING -DOPENCV_2_4 -I/home/opencv/OpenCVInstall/x86/include -o FeatureExtraction.bc FeatureExtraction/FeatureExtraction.cpp
llvm-link FeatureExtraction.bc ThreadManager.bc -o FE.bc
clang $CFLAGS -o profiler.o cacheSim.cpp //LLVM profiler
opt -load /home/llvm/llvm/Debug+Asserts/lib/cacheProf.so -cacheProf FE.bc>out.bc
llc FE.bc -o out.s
g++ -v -g out.s profiler.o -L/home/opencv/share/OpenCV/3rdparty/lib -L/home/opencv/OpenCVInstall/x86/lib -lpthread -lrt -lopencv_calib3d -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgproc -lopencv_ml -lopencv_objdetect -lopencv_video -lopencv_nonfree
Could some one please tell me if I am linking the files or loading the files in a wrong way?
Is clang compilation different from how g++ works?