-1

I am trying to compile a C++ project containing 10 FORTRAN files via Eclipse Juno IDE in Ubuntu 16.04.

The project got compiled and .o files have been generated, while linking throws the message:

Vc3ded.o(fortran obj file) relocation R_X86_64_32S against '.rodata' cannot be used when making a shared object: recompile with -fPIC

I have tried and compiled the project with -fPIC via the Eclipse IDE settings and cross-verified the path of the shared object .so files.

The Makefile is shown below:

-include ../makefile.init

RM := rm -rf

-include sources.mk
-include src/simgear/xml/subdir.mk

-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif

-include ../makefile.defs

all: OWI_SIM

OWI_SIM: $(OBJS) $(USER_OBJS)
    @echo 'Building target: $@'
    @echo 'Invoking: GCC C++ Linker'
    g++ -L/usr/lib -L/usr/local/include -L/usr/local/lib64 -L/usr/lib/x86_64-linux-gnu -o "OWI_SIM" $(OBJS) $(USER_OBJS) $(LIBS)
    @echo 'Finished building target: $@'
    @echo ' '

clean:
    -$(RM) $(CC_DEPS)$(C++_DEPS)$(EXECUTABLES)$(C_UPPER_DEPS)$(CXX_DEPS)$(OBJS)$(CPP_DEPS)$(C_DEPS) OWI_SIM
    -@echo ' '

.PHONY: all clean dependents
.SECONDARY:

-include ../makefile.targets
XavierStuvw
  • 1,294
  • 2
  • 15
  • 30
sdef Lab
  • 31
  • 1
  • 2
  • Can you extract a [mcve] from your project? One C++ and Fortran file each plus the commandline used for compiling them should do the job. The makefile containing a bunch of undefined variable references isn't helpful to the case. As a new user, also take the [tour] and read [ask]. – Ulrich Eckhardt Dec 27 '18 at 08:54

1 Answers1

2

I fixed it by compiling with -fPIC in eclipse settings

sdef Lab
  • 31
  • 1
  • 2