I have following codes in opencv.cpp file:
#include "opencv.hpp"
#include <stdbool.h>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/cudawarping.hpp>
#include "opencv2/cudaimgproc.hpp"
void opencv_mat_resize(const opencv_mat src,
opencv_mat dst,
int width,
int height,
int interpolation,
int hardware_acceleration)
{
if (hardware_acceleration == 0) {
cv::resize(*static_cast<const cv::Mat*>(src),
*static_cast<cv::Mat*>(dst),
cv::Size(width, height),
0,
0,
interpolation);
} else {
cv::cuda::GpuMat gpuInImage;
cv::cuda::GpuMat gpuOutImage;
gpuInImage.upload(*static_cast<const cv::Mat*>(src));
cv::cuda::resize(gpuInImage, gpuOutImage, cv::Size(width, height));
gpuOutImage.download(*static_cast<cv::Mat*>(dst));
}
}
And I had using it in golang like following way:
// #cgo CFLAGS: -msse -msse2 -msse3 -msse4.1 -msse4.2 -mavx
// #cgo darwin CFLAGS: -I${SRCDIR}/deps/osx/include
// #cgo linux CFLAGS: -I${SRCDIR}/deps/linux/include
// #cgo CXXFLAGS: -std=c++11
// #cgo darwin CXXFLAGS: -I${SRCDIR}/deps/osx/include
// #cgo linux CXXFLAGS: -I${SRCDIR}/deps/linux/include
// #cgo LDFLAGS: -lopencv_core -lopencv_imgcodecs -lopencv_imgproc -ljpeg -lpng -lwebp -lippicv -lz
// #cgo darwin LDFLAGS: -L${SRCDIR}/deps/osx/lib -L${SRCDIR}/deps/osx/share/OpenCV/3rdparty/lib
// #cgo linux LDFLAGS: -L${SRCDIR}/deps/linux/lib -L${SRCDIR}/deps/linux/share/OpenCV/3rdparty/lib
// #include "opencv.hpp"
import "C"
func (f *Framebuffer) ResizeTo(width, height int, dst *Framebuffer) error {
if width < 1 {
width = 1
}
if height < 1 {
height = 1
}
err := dst.resizeMat(width, height, f.pixelType)
if err != nil {
return err
}
hardwareAcceleration := os.Getenv("RESIZE_HARDWARE_ACCELERATION")
if enabled, err := strconv.ParseUint(hardwareAcceleration, 10, 64); err != nil || enabled == 0 {
C.opencv_mat_resize(f.mat, dst.mat, C.int(width), C.int(height), C.CV_INTER_AREA, C.int(0))
} else {
C.opencv_mat_resize(f.mat, dst.mat, C.int(width), C.int(height), C.CV_INTER_AREA, C.int(1))
}
return nil
}
And go build returns errors:
/etc/go/pkg/tool/linux_amd64/link: running g++ failed: exit status 1
/usr/bin/ld: /tmp/go-link-1971014753/000024.o: in function `opencv_mat_resize':
/home/andrew/source/.../opencv.cpp:187: undefined reference to `cv::cuda::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int, cv::cuda::Stream&)'
collect2: error: ld returned 1 exit status
Environment Variables:
CPLUS_INCLUDE_PATH=/usr/local/include/opencv4:/usr/local/include/opencv4:
LD_LIBRARY_PATH=:/usr/local/cuda-11.7/lib64
The codes has no error report in vscode, in my opinion, that means my opencv libs made corrrectly. But I could not pass the go build. I do not understand where I missing.
Compile cos.c
void func() {
double a = __builtin_cos(3.0);
}
using
clang -S -emit-llvm -c cos.c
I've got
define dso_local void #func() {
%1 = alloca double, align 8
%2 = call double #cos(double 3.000000e+00)
store double %2, double* %1, align 8
ret void
}
declare dso_local double #cos(double)
But I want to obtain the llvm intrinsics #llvm.fcos.f64 for cos instead of #cos, i.e. the generated code should be like that
...
%2 = call double #llvm.fcos.f64(double 3.000000e+00)
...
}
declare double #llvm.cos.f64(double)
How can I force clang to do that? Maybe I should use another function instead of __builtin_cos?
With -ffast-math (which implies -fno-math-errno), clang -O3 will inline __builtin_cos to #llvm.cos.f64
double func(double in) {
double a = __builtin_cos(in);
return a;
}
clang -O3 -ffast-math -emit-llvm on Godbolt (with debug stuff removed)
define dso_local double #_Z4funcd(double) local_unnamed_addr #0 !dbg !7 {
%2 = tail call fast double #llvm.cos.f64(double %0), !dbg !15
ret double %2, !dbg !17
}
I'm trying to build a program in which I use gstreamer and opencv to manipulate images. This is my main file:
#include "GstSource.hpp"
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/highgui/highgui_c.h>
#include <iostream>
static const int Key_Escape = 27;
int main(int argc, char *argv[])
{
cv::namedWindow("Gstreamer");
cvMoveWindow("Gstreamer",100,100);
GstreamerPlayer player;
if (! player.open("videotestsrc") )
std::cerr << "Unable to open pipeline" << std::endl;
if ( !player.setWidth(640) || !player.setHeight(480) ) {
std::cerr << "Unable to change resolution" << std::endl;
return 1;
}
bool fps_readed = false;
while (true) {
if (!player.grabFrame()) {
std::cerr << "Failed to grab frame" << std::endl;
break;
}
GstreamerImage * frame = player.getImage();
if (!frame) {
std::cerr << "Failed to retrieve frame" << std::endl;
break;
}
if (!fps_readed) {
std::cout << "Video playing at " << player.getFps() << " fps" < std::endl;
fps_readed = true;
}
cv::Mat canvas = cv::Mat(frame->height, frame->width, CV_8UC3, frame->data);
if ( canvas.empty() )
break;
cv::imshow("Gstreamer", canvas);
int key = cv::waitKey(10);
if (key == Key_Escape)
break;
}
}
and this is the .pro file:
QT += core
QT -= gui
TARGET = provaQT
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
INCLUDEPATH += /usr/include/gstreamer-1.0 \
/usr/local/include \
/usr/include/glib-2.0 \
/usr/lib/arm-linux-gnueabihf/glib-2.0/include \
/usr/lib/arm-linux-gnueabihf
LIBS += -L"/usr/lib/arm-linux-gnueabihf" -lglib-2.0 -lgobject-2.0 \
-L"/usr/local/lib" -lopencv_core -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_videoio \
-L"/usr/lib/arm-linux-gnueabihf/gstreamer-1.0" -lgnl -lgst1394 -lgstaasink -lgstaccurip -lgstcoreelements \
-L"/home/odroid/Desktop/Gstreamer-Test/bin/linux/gst-plugins" -lgst-overlay
SOURCES += \
../Gstreamer-Test/src/gstinit.cpp \
../Gstreamer-Test/src/gstplugin.cpp \
../Gstreamer-Test/src/gstplugin_impl.cpp \
../Gstreamer-Test/src/GstSource.cpp \
../Gstreamer-Test/src/main.cpp \
../Gstreamer-Test/src/videotestoverlay.cpp
HEADERS += \
../Gstreamer-Test/src/gstplugin.hpp \
../Gstreamer-Test/src/gstplugin_impl.hpp \
../Gstreamer-Test/src/GstSource.hpp \
../Gstreamer-Test/src/videotestoverlay.hpp
and I get 147 error of this type: undefined reference to..... because many function used are declared but not defined. Where are their definition? How I can include their definition?
What about using PKGCONFIG:
in your pro:
CONFIG += pkgconfig
PKGCONFIG += gstreamer-1.0 gstreamer-video-1.0
You can check from shell that you have them:
pkg-config --list-all | grep gst
Checking one package if pointing to correct libraries:
pkg-config --cflags gstreamer-1.0
Should print:
-pthread -I/usr/local/include/gstreamer-1.0 -I/usr/local/lib/gstreamer-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -L/usr/local/lib -lgstreamer-1.0 -lgobject-2.0 -lglib-2.0
If you do not have the .pc files they wont be listed.. You need to install the -dev version of the gstreamer packages.
Also there is env variable which can be used to tell pkg config where to look for .pc files:
PKG_CONFIG_PATH=/home/something/gst/1.6/gst-devtools/validate/pkgconfig
Here someone tried to link opencv that way..
I'm trying to install uwsgi using pip install uwsgi in my Alpine docker image but unfortunately it keeps failing weird no real error message to me:
Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-mEZegv/uwsgi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-c7XA_e-record/install-record.txt --single-version-externally-managed --compile:
running install
using profile: buildconf/default.ini
detected include path: ['/usr/include/fortify', '/usr/include', '/usr/lib/gcc/x86_64-alpine-linux-musl/5.3.0/include']
Patching "bin_name" to properly install_scripts dir
detected CPU cores: 1
configured CFLAGS: -O2 -I. -Wall -Werror -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -DUWSGI_HAS_IFADDRS -DUWSGI_ZLIB -DUWSGI_LOCK_USE_MUTEX -DUWSGI_EVENT_USE_EPOLL -DUWSGI_EVENT_TIMER_USE_TIMERFD -DUWSGI_EVENT_FILEMONITOR_USE_INOTIFY -DUWSGI_VERSION="\"2.0.12\"" -DUWSGI_VERSION_BASE="2" -DUWSGI_VERSION_MAJOR="0" -DUWSGI_VERSION_MINOR="12" -DUWSGI_VERSION_REVISION="0" -DUWSGI_VERSION_CUSTOM="\"\"" -DUWSGI_YAML -DUWSGI_PLUGIN_DIR="\".\"" -DUWSGI_DECLARE_EMBEDDED_PLUGINS="UDEP(python);UDEP(gevent);UDEP(ping);UDEP(cache);UDEP(nagios);UDEP(rrdtool);UDEP(carbon);UDEP(rpc);UDEP(corerouter);UDEP(fastrouter);UDEP(http);UDEP(ugreen);UDEP(signal);UDEP(syslog);UDEP(rsyslog);UDEP(logsocket);UDEP(router_uwsgi);UDEP(router_redirect);UDEP(router_basicauth);UDEP(zergpool);UDEP(redislog);UDEP(mongodblog);UDEP(router_rewrite);UDEP(router_http);UDEP(logfile);UDEP(router_cache);UDEP(rawrouter);UDEP(router_static);UDEP(sslrouter);UDEP(spooler);UDEP(cheaper_busyness);UDEP(symcall);UDEP(transformation_tofile);UDEP(transformation_gzip);UDEP(transformation_chunked);UDEP(transformation_offload);UDEP(router_memcached);UDEP(router_redis);UDEP(router_hash);UDEP(router_expires);UDEP(router_metrics);UDEP(transformation_template);UDEP(stats_pusher_socket);" -DUWSGI_LOAD_EMBEDDED_PLUGINS="ULEP(python);ULEP(gevent);ULEP(ping);ULEP(cache);ULEP(nagios);ULEP(rrdtool);ULEP(carbon);ULEP(rpc);ULEP(corerouter);ULEP(fastrouter);ULEP(http);ULEP(ugreen);ULEP(signal);ULEP(syslog);ULEP(rsyslog);ULEP(logsocket);ULEP(router_uwsgi);ULEP(router_redirect);ULEP(router_basicauth);ULEP(zergpool);ULEP(redislog);ULEP(mongodblog);ULEP(router_rewrite);ULEP(router_http);ULEP(logfile);ULEP(router_cache);ULEP(rawrouter);ULEP(router_static);ULEP(sslrouter);ULEP(spooler);ULEP(cheaper_busyness);ULEP(symcall);ULEP(transformation_tofile);ULEP(transformation_gzip);ULEP(transformation_chunked);ULEP(transformation_offload);ULEP(router_memcached);ULEP(router_redis);ULEP(router_hash);ULEP(router_expires);ULEP(router_metrics);ULEP(transformation_template);ULEP(stats_pusher_socket);"core/utils.c: In function 'uwsgi_as_root':
core/utils.c:344:7: error: implicit declaration of function 'unshare' [-Werror=implicit-function-declaration]
if (unshare(uwsgi.unshare)) {
^
core/utils.c:564:5: error: implicit declaration of function 'sigfillset' [-Werror=implicit-function-declaration]
sigfillset(&smask);
^
core/utils.c:565:5: error: implicit declaration of function 'sigprocmask' [-Werror=implicit-function-declaration]
sigprocmask(SIG_BLOCK, &smask, NULL);
^
core/utils.c:565:17: error: 'SIG_BLOCK' undeclared (first use in this function)
sigprocmask(SIG_BLOCK, &smask, NULL);
^
core/utils.c:565:17: note: each undeclared identifier is reported only once for each function it appears in
core/utils.c:586:7: error: implicit declaration of function 'chroot' [-Werror=implicit-function-declaration]
if (chroot(uwsgi.chroot)) {
^
core/utils.c:791:5: error: unknown type name 'ushort'
ushort *array;
^
core/utils.c:833:8: error: implicit declaration of function 'setgroups' [-Werror=implicit-function-declaration]
if (setgroups(0, NULL)) {
^
core/utils.c:848:8: error: implicit declaration of function 'initgroups' [-Werror=implicit-function-declaration]
if (initgroups(uidname, uwsgi.gid)) {
^
core/utils.c: In function 'uwsgi_close_request':
core/utils.c:1145:18: error: 'WAIT_ANY' undeclared (first use in this function)
while (waitpid(WAIT_ANY, &waitpid_status, WNOHANG) > 0);
^
core/utils.c: In function 'uwsgi_resolve_ip':
core/utils.c:1802:7: error: implicit declaration of function 'gethostbyname' [-Werror=implicit-function-declaration]
he = gethostbyname(domain);
^
core/utils.c:1802:5: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
he = gethostbyname(domain);
^
core/utils.c: In function 'uwsgi_unix_signal':
core/utils.c:1936:19: error: storage size of 'sa' isn't known
struct sigaction sa;
^
core/utils.c:1938:24: error: invalid application of 'sizeof' to incomplete type 'struct sigaction'
memset(&sa, 0, sizeof(struct sigaction));
^
core/utils.c:1942:2: error: implicit declaration of function 'sigemptyset' [-Werror=implicit-function-declaration]
sigemptyset(&sa.sa_mask);
^
core/utils.c:1944:6: error: implicit declaration of function 'sigaction' [-Werror=implicit-function-declaration]
if (sigaction(signum, &sa, NULL) < 0) {
^
core/utils.c:1936:19: error: unused variable 'sa' [-Werror=unused-variable]
struct sigaction sa;
^
In file included from core/utils.c:1:0:
core/utils.c: In function 'uwsgi_list_has_num':
./uwsgi.h:140:47: error: implicit declaration of function 'strtok_r' [-Werror=implicit-function-declaration]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:1953:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list2, ",", p, ctx) {
^
./uwsgi.h:140:46: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:1953:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list2, ",", p, ctx) {
^
./uwsgi.h:140:70: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:1953:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list2, ",", p, ctx) {
^
core/utils.c: In function 'uwsgi_list_has_str':
./uwsgi.h:140:46: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:1968:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list2, " ", p, ctx) {
^
./uwsgi.h:140:70: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:1968:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list2, " ", p, ctx) {
^
core/utils.c:1969:8: error: implicit declaration of function 'strcasecmp' [-Werror=implicit-function-declaration]
if (!strcasecmp(p, str)) {
^
core/utils.c: In function 'uwsgi_sig_pause':
core/utils.c:2361:2: error: implicit declaration of function 'sigsuspend' [-Werror=implicit-function-declaration]
sigsuspend(&mask);
^
core/utils.c: In function 'uwsgi_run_command_putenv_and_wait':
core/utils.c:2453:7: error: implicit declaration of function 'putenv' [-Werror=implicit-function-declaration]
if (putenv(envs[i])) {
^
In file included from core/utils.c:1:0:
core/utils.c: In function 'uwsgi_build_unshare':
./uwsgi.h:140:46: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:2855:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list, ",", p, ctx) {
^
./uwsgi.h:140:70: error: assignment makes pointer from integer without a cast [-Werror=int-conversion]
#define uwsgi_foreach_token(x, y, z, w) for(z=strtok_r(x, y, &w);z;z = strtok_r(NULL, y, &w))
^
core/utils.c:2855:2: note: in expansion of macro 'uwsgi_foreach_token'
uwsgi_foreach_token(list, ",", p, ctx) {
^
core/utils.c: In function 'uwsgi_tmpfd':
core/utils.c:3533:7: error: implicit declaration of function 'mkstemp' [-Werror=implicit-function-declaration]
fd = mkstemp(template);
^
core/utils.c: In function 'uwsgi_expand_path':
core/utils.c:3615:7: error: implicit declaration of function 'realpath' [-Werror=implicit-function-declaration]
if (!realpath(src, dst)) {
^
core/utils.c: In function 'uwsgi_set_cpu_affinity':
core/utils.c:3641:3: error: unknown type name 'cpu_set_t'
cpu_set_t cpuset;
^
core/utils.c:3646:3: error: implicit declaration of function 'CPU_ZERO' [-Werror=implicit-function-declaration]
CPU_ZERO(&cpuset);
^
core/utils.c:3651:4: error: implicit declaration of function 'CPU_SET' [-Werror=implicit-function-declaration]
CPU_SET(base_cpu, &cpuset);
^
core/utils.c:3662:7: error: implicit declaration of function 'sched_setaffinity' [-Werror=implicit-function-declaration]
if (sched_setaffinity(0, sizeof(cpu_set_t), &cpuset)) {
^
core/utils.c:3662:35: error: 'cpu_set_t' undeclared (first use in this function)
if (sched_setaffinity(0, sizeof(cpu_set_t), &cpuset)) {
^
core/utils.c: In function 'uwsgi_thread_run':
core/utils.c:3782:2: error: implicit declaration of function 'pthread_sigmask' [-Werror=implicit-function-declaration]
pthread_sigmask(SIG_BLOCK, &smask, NULL);
^
core/utils.c:3782:18: error: 'SIG_BLOCK' undeclared (first use in this function)
pthread_sigmask(SIG_BLOCK, &smask, NULL);
^
core/utils.c: In function 'uwsgi_envdir':
core/utils.c:4349:8: error: implicit declaration of function 'unsetenv' [-Werror=implicit-function-declaration]
if (unsetenv(de->d_name)) {
^
core/utils.c:4380:7: error: implicit declaration of function 'setenv' [-Werror=implicit-function-declaration]
if (setenv(de->d_name, content, 1)) {
^
cc1: all warnings being treated as errors
*** uWSGI compiling server core ***
Any idea what could cause this? I'm installing the following dependencies beforehand:
RUN apk --update add \
bash \
python \
python-dev \
py-pip \
gcc \
zlib-dev \
git \
linux-headers \
build-base \
musl \
musl-dev \
memcached \
libmemcached-dev
I found this on a GitHub thread. Modified it a bit and works perfectly fine for me on Python 3.5
apk add python3-dev build-base linux-headers pcre-dev
pip install uwsgi
Unfortunately the latest release of uwsgi does not support musl, a glibc alternative that alpine and a couple other distros use. Uwsgi will not build with musl when the ugreen plugin is included (see https://github.com/unbit/uwsgi/pull/522), so you still cannot pip install uwsgi. However, if you build uwsgi with the environment variable UWSGI_PROFILE=corethe build should succeed; but if will fail at runtime due to the issues solved here (https://github.com/unbit/uwsgi/pull/1210). This probably grim news -- I know it was for me -- but at least it looks like the uwsgi team is taking time to address its issues running on musl. Hopefully it will work in the next release.
This is a bit old and this was not exactly the case of the OP. In my case upgrading the version on requirements.txt to uwsgi==2.0.17.1 worked, as I found here.
have you tried
http://github.com/unbit/uwsgi/archive/uwsgi-2.0.zip
in your requirements.txt ?
you'll need the pcre-dev package installed
Upgrading uWSGI from 2.0.14 to 2.0.19.1 did the trick for me.
I'm using Amazon Linux AMI and I'm trying to run my bundle install with this error:
Installing therubyracer 0.12.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/bin/ruby2.0 -r ./siteconf20150914-12081-ne1jzf.rb extconf.rb
checking for main() in -lpthread... yes
* extconf.rb failed *
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
...
...
Gem files will remain installed in //gems/therubyracer-0.12.2 for inspection.
Results logged to //.gem/ruby/2.0/extensions/x86_64-linux/2.0/therubyracer-0.12.2/gem_make.out
An error occurred while installing therubyracer (0.12.2), and Bundler cannot continue.
Make sure that gem install therubyracer -v '0.12.2' succeeds before bundling.
But the 'gem install therubyracer -v '0.12.2' is not working neither (the same error).
In the file: .gem/ruby/2.0/extensions/x86_64-linux/2.0/therubyracer-0.12.2/mkmf.log
have_library: checking for main() in -lpthread... -------------------- yes
"gcc -o conftest -I/usr/include/ruby/2.0 -I/usr/include/ruby/2.0/ruby/backward -I/usr/include/ruby/2.0 -I. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC conftest.c -L. -L/usr/lib64 -L. -fstack-protector -rdynamic -Wl,-export-dynamic -m64 -L/usr/lib64/ruby/2.0 -lruby -lpthread -lrt -ldl -lcrypt -lm -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"gcc -o conftest -I/usr/include/ruby/2.0 -I/usr/include/ruby/2.0/ruby/backward -I/usr/include/ruby/2.0 -I. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC conftest.c -L. -L/usr/lib64 -L. -fstack-protector -rdynamic -Wl,-export-dynamic -m64 -L/usr/lib64/ruby/2.0 -lruby -lpthread -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:5:57: error: ‘main’ undeclared (first use in this function)
int t(void) { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
^
conftest.c:5:57: note: each undeclared identifier is reported only once for each function it appears in
conftest.c:5:32: warning: variable ‘p’ set but not used [-Wunused-but-set-variable]
int t(void) { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
^
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: extern int t(void);
5: int t(void) { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
6: int main(int argc, char **argv)
7: {
8: if (argc > 1000000) {
9: printf("%p", &t);
10: }
11:
12: return 0;
13: }
/* end */
"gcc -o conftest -I/usr/include/ruby/2.0 -I/usr/include/ruby/2.0/ruby/backward -I/usr/include/ruby/2.0 -I. -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -mtune=generic -fPIC conftest.c -L. -L/usr/lib64 -L. -fstack-protector -rdynamic -Wl,-export-dynamic -m64 -L/usr/lib64/ruby/2.0 -lruby -lpthread -lpthread -lrt -ldl -lcrypt -lm -lc"
conftest.c: In function ‘t’:
conftest.c:5:1: warning: implicit declaration of function ‘main’ [-Wimplicit-function-declaration]
int t(void) { main(); return 0; }
^
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: /*top*/
4: extern int t(void);
5: int t(void) { main(); return 0; }
6: int main(int argc, char **argv)
7: {
8: if (argc > 1000000) {
9: printf("%p", &t);
10: }
11:
12: return 0;
13: }
/* end */
My versions:
gem -v
2.4.8
rails -v
Rails 4.2.4
ruby -v
ruby 2.0.0p647 (2015-08-18) [x86_64-linux]
Any ideas?
Thanks guys
/Cris