ld

GCJ Linking Error: Says error: undefined reference to 'main' collect2: error: ld returned 1 exit status

二次信任 提交于 2019-12-11 04:35:44
问题 The code is this: public class Thingy { public static void main(String[] args) { System.out.println(Math.random()); } } So, absolutely NOT an unusual case, just a basic example. When I try to use GCJ's javac implementation to make bytecode instead of the OpenJDK one, it works fine. neil@neil-Inspiron-M5030:~/javastuff$ javac Thingy.java neil@neil-Inspiron-M5030:~/javastuff$ java Thingy 0.2794511843566371 But when I try to get GCJ to make native code, I get that linker error. If you want, I

GMP with MinGW on Windows

坚强是说给别人听的谎言 提交于 2019-12-11 04:33:39
问题 I managed to build the GMP library successfully on my Windows 7 (64-bit computer). The steps I followed were: ./configure --enable_cxx --disable-static --enable-shared --prefix="/c/MinGW" make make install make check All of the tests pass successfully. Clearly, I'm at the point where it's possible to compile and run GMP programs. But, when I try to compile the following program: #include <stdlib.h> #include <string.h> #include <stdio.h> #include <gmp.h> char *progname; void print_usage_and

load script to load a section at the top of a memory region

房东的猫 提交于 2019-12-11 03:38:51
问题 I'm working on a project for an embedded system, using an ARM M0. A ROM application has to be created, whose sole purpose is to store stuff in rom, and initialize the data and bss sections whenever needed. The loadscript so far is this: MEMORY { rom (rx): ORIGIN = 0, LENGTH = 32K ; ram (!rx): ORIGIN = 0x10000, LENGTH = 8K ; } SECTION { . = ORIGIN(rom) ; .text: { KEEP(*(.text)) ; } >. .data: { KEEP(*(.data)) ; } >ram AT>. .bss: { KEEP(*(.bss)) ; } > ram = 0x00 } I want to change the loadscript

cross compiling why cant ld find shared library / how to debug further?

霸气de小男生 提交于 2019-12-11 03:16:03
问题 Im trying to cross-compile and link aggregate on ubuntu for my arm-router and I get the following error. In the past I think I have been able to workaround this by setting the appropriate environment variable but this time is not working . Can anyone help me figure out why this might not work: /home/ubuntu/Downloads/toolchain-arm_cortex-a9_gcc-4.9-linaro_musl-1.1.2_eabi/bin/../lib64/gcc/arm-openwrt-linux-muslgnueabi/4.9.1/../../../../arm-openwrt-linux-muslgnueabi/bin/ld: cannot find -lpopt

Object code relocation and Intel Pin interaction

混江龙づ霸主 提交于 2019-12-11 02:55:12
问题 I am working on a multiprocessor architectural simulator that uses Intel Pin to instrument C++ executable binaries and report interesting events (e.g., some function calls, thread create/finish, etc.). Basically, I build an instruction-decode cache of all instructions when their images are loaded and analyze instruction execution afterwards. So it is important for instruction addresses at image-load time to be the same as (or at least get updated synchronously with) instruction addresses at

How to load a program in memory at a different address than it is intended for?

狂风中的少年 提交于 2019-12-11 02:42:07
问题 Generally the user program binaries will be loaded in low address (usually around 0x400000 ) in the programs address space which will be specified in the elf binary (in the case of linux). Can we force a user binary to load at a high address, possibly within the 2GB range of addresses where libc or other such libraries are loaded? I have tried finding a solution on the net but could not find any concrete solution for this. (I am working on Ubuntu 12.10 64bit OS) Thanks 回答1: Unless the binary

Getting undefined reference error but nm shows symbol present

会有一股神秘感。 提交于 2019-12-11 01:50:06
问题 I am building a large application using libkml. I am using the cmake port of libkml from here: https://github.com/rashadkm/libkml I am getting a stranged undefined reference to symbol error even thought the symbol appears to be referenced and defined. This is the make command: /usr/bin/c++ -fPIC -Werror=return-type -Werror=return-type -Wall -Werror=parentheses -Werror=uninitialized -Werror=missing-braces -fPIC -O0 -Wall -fPIC -fvisibility=hidden -fno-strict-aliasing -Wno-long-long -m64 -g -D

profile linking times with gcc/g++ and ld

三世轮回 提交于 2019-12-11 00:07:36
问题 I'm using g++ to compile and link a project consisting of about 15 c++ source files and 4 shared object files. Recently the linking time more than doubled, but I don't have the history of the makefile available to me. Is there any way to profile g++ to see what part of the linking is taking a long time? Edit: After I noticed that the makefile was using -O3 optimizations all the time, I managed to halve the linking time just by removing that switch. Is there any good way I could have found

Makefile error causes undefined reference to symbol 'GOMP_parallel@@GOMP_4.0'

放肆的年华 提交于 2019-12-10 22:32:16
问题 Warning: Newbie Ubuntu/g++/makefile user I'm trying to build a C++ app (C++11, OpenMP, OpenCV3, experimental filesystem) that works if I build directly, but fails if I use a makefile with a linker error. This works: g++ \ -std=c++11 -std=c++1y -fopenmp -DNDEBUG \ -O3 -fprofile-generate -march=native -fomit-frame-pointer \ docproc.cpp \ -flto -L/usr/local/lib -lstdc++fs \ -lpthread -lboost_thread -lboost_system \ -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_calib3d -lopencv

What does SEGMENT_START(“text-segment”, 0x400000) represent?

丶灬走出姿态 提交于 2019-12-10 20:18:56
问题 I'm learning about the layout of executable binaries. My end goal is to analyze a specific executable for things that could be refactored (in its source) to reduce the compiled output size. I've been using https://www.embeddedrelated.com/showarticle/900.php and https://www.geeksforgeeks.org/memory-layout-of-c-program/ as references for this initial learning. From what I've learned, a linker script specifies the addresses where sections of compiled binaries are placed. E.g. > ld --verbose |