• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Linker-fu
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Linker-fu


  • Subject: Linker-fu
  • From: "Mathieu BĂ©liveau" <email@hidden>
  • Date: Sun, 17 Feb 2008 18:09:44 -0500

Hi. I'm trying to port a general unix application (multimatlab) to osX
where there is the folliwing error libmpich.dylib is input for the
dynamic linke editor, is not relocatable by the static link editor
again

The application I'm trying to compile uses several librairies, most
from mpich and matlab. Libmpich.dylib is supplied by matlab and file
states it's a ppc bundle.

As the provided makefile didn't took osX in account, I had to
explicitly set the libs path and set the proper architecture.
Concerning the different linker flags, unfortunately, the usual
-bundle -flat_namespace, etc. won't change a thing, I still get the
same error message.

Any help would greatly be appreciated!

Here is the make output showing the full compiler options passed to gcc:

-> mexopts.sh sourced from directory (DIR = $MATLAB/bin)
   FILE = /Applications/matlab-new/bin/mexopts.sh
----------------------------------------------------------------
->    MATLAB                = /Applications/matlab-new
->    CC                    = gcc-4.0
->    CC flags:
         CFLAGS             = -fno-common -no-cpp-precomp -fexceptions
         CDEBUGFLAGS        = -g
         COPTIMFLAGS        = -O3 -fno-loop-optimize -DNDEBUG
         CLIBS              = -L/Applications/matlab-new/bin/mac -lmx
-lmex -lmat -lstdc++
         arguments          =  -DMX_COMPAT_32
->    CXX                   = g++-4.0
->    CXX flags:
         CXXFLAGS           = -fno-common -no-cpp-precomp -fexceptions -arch ppc
         CXXDEBUGFLAGS      = -g
         CXXOPTIMFLAGS      = -O3 -fno-loop-optimize -DNDEBUG
         CXXLIBS            = -L/Applications/matlab-new/bin/mac -lmx
-lmex -lmat -lstdc++
         arguments          =  -DMX_COMPAT_32
->    FC                    = g95
->    FC flags:
         FFLAGS             = -fexceptions
         FDEBUGFLAGS        = -g
         FOPTIMFLAGS        = -O
         FLIBS              = -L/Applications/matlab-new/bin/mac -lmx
-lmex -lmat -L -lf95
         arguments          =  -DMX_COMPAT_32
->    LD                    = gcc-4.0
->    Link flags:
         LDFLAGS            = -bundle -Wl,-flat_namespace -undefined
suppress -Wl,-exported_symbols_list,/Applications/matlab-new/extern/lib/mac/mexFunction.map
         LDDEBUGFLAGS       = -g
         LDOPTIMFLAGS       = -O
         LDEXTENSION        = .mexmac
         arguments          =  -L/usr/local/mpich/lib/ -lmpich -lm
->    LDCXX                 =
->    Link flags:
         LDCXXFLAGS         =
         LDCXXDEBUGFLAGS    =
         LDCXXOPTIMFLAGS    =
         LDCXXEXTENSION     =
         arguments          =  -L/usr/local/mpich/lib/ -lmpich -lm
----------------------------------------------------------------

-> gcc-4.0 -c  -I/usr/local/mpich -I/usr/local/mpich/include
-I/usr/local/mpich/mpid/ch_p4/p4
-I/usr/local/mpich/mpid/ch_p4/p4/include
-I/Applications/matlab-new/extern/include -DMATLAB_MEX_FILE
-fno-common -no-cpp-precomp -fexceptions  -DMX_COMPAT_32 -O3
-fno-loop-optimize -DNDEBUG MMAT.c

MMAT.c:9: warning: initialization makes integer from pointer without a cast
MMAT.c:9: warning: initialization makes integer from pointer without a cast
MMAT.c:9: warning: initialization makes integer from pointer without a cast
MMAT.c:9: warning: initialization makes integer from pointer without a cast
-> gcc-4.0 -c  -I/usr/local/mpich -I/usr/local/mpich/include
-I/usr/local/mpich/mpid/ch_p4/p4
-I/usr/local/mpich/mpid/ch_p4/p4/include
-I/Applications/matlab-new/extern/include -DMATLAB_MEX_FILE
-fno-common -no-cpp-precomp -fexceptions  -DMX_COMPAT_32 -O3
-fno-loop-optimize -DNDEBUG
/Applications/matlab-new/extern/src/mexversion.c

-> gcc-4.0 -O -bundle -Wl,-flat_namespace -undefined suppress
-Wl,-exported_symbols_list,/Applications/matlab-new/extern/lib/mac/mexFunction.map
-o MMAT.mexmac  MMAT.o mexversion.o  -L/usr/local/mpich/lib/ -lmpich
-lm -L/Applications/matlab-new/bin/mac -lmx -lmex -lmat -lstdc++

/usr/bin/ld: /usr/local/mpich/lib//libmpich.dylib is input for the
dynamic link editor, is not relocatable by the static link editor
again
collect2: ld returned 1 exit status

    mex: link of 'MMAT.mexmac' failed.

make: *** [MMAT.] Error 1

Below, is the content of my make file:

SHELL       = /bin/sh

###################################################
#
# NOTE:
#
# Currently MultiMATLAB only works with MATLAB 6.x
#
###################################################

#
# ACMC setup
#

MPI_HOME    = /usr/local/mpich
MATLAB_DIR  := /Applications/matlab-new

#
# Griffith setup
#

#MPI_HOME    = /usr/local/mpich-1.2.7
#MATLAB_DIR  := /usr/local/matlab.6.5.1

#
# JCU setup
#
#MPI_HOME   := /sw/applications/mpich-1.2.5.2
#MATLAB_DIR := /sw/applications/matlab6.2/


#
# All the needs changing should be above.
# That is, don't touch below here unless
# you know what you are doing.
#
MM_SRC     := $(shell pwd)
MM_HOME    = $(patsubst %/src,%, $(MM_SRC))

COMM        = $(MPI_HOME)/mpid/ch_p4/p4
CC          = $(MATLAB_DIR)/bin/mex
CLINKER     = $(MATLAB_DIR)/bin/mex
LIB_PATH    = -L$(MPI_HOME)/lib/
LIB_LIST    = -lmpich
MPILIB	    = $(MPI_HOME)/lib/libmpich.a
INCLUDE_DIR =  -I$(MPI_HOME) -I$(MPI_HOME)/include -I$(COMM) -I$(COMM)/include

MKDIR = mkdir
RM = rm
MV = mv
CP = cp

DOL = "$$"

PLATFORM = $(shell uname -s)

ifeq ($(findstring IRIX, $(PLATFORM)), IRIX)
	# ARCH is the matlab mex format.  Type help mex in matlab to get the
list of formats.
	ARCH = mexsg
	CFLAGS =  -v -D_BSD_TYPES $(INCLUDE_DIR)
endif


ifeq ($(PLATFORM), Linux)
	ARCH = mexglx
	CFLAGS =  -v -D_XOPEN_SOURCE=600 $(INCLUDE_DIR)
endif

ifeq ($(PLATFORM), SunOS)
	ARCH = mexsol
	CFLAGS =  -v $(INCLUDE_DIR)
endif
CFLAGS =  -v $(INCLUDE_DIR)
MMAT_BASE = $(MM_HOME)

SPMD_OBJS = Init.m \
	ID.m \
	Nproc.m \
	Send.m \
	Recv.m \
	Probe.m \
	Coord.m \
	Gridsize.m \
	Reduce.m \
	Allreduce.m \
	Barrier.m \
	multimatlab.m \
	Multimatlab.m \
	MultiMATLAB.m \
	Graphics.m \
	PerformShift.m \
	MMgrid.m \
	MMwindow.m \
	MMresetwindow.m \
	MMsum.m \
	MMmax.m \
	MMmin.m \
	MMprod.m \
	MMbcast.m

INTERACTIVE_OBJS = Eval.$(ARCH) \
	Eval.m \
	Quit.m \
	Close.m \
	Put.m \
	Get.m \
	pid.$(ARCH) \
	Start.m \
	Nproc.m \
	multimatlab.m \
	Multimatlab.m \
	MultiMATLAB.m \
        Graphics.m \
	Init.m \
	Max.m\
	Min.m \
	Window.m \
	ResetWindow.m \
	Prod.m \
	Sum.m \
	Grid.m \
	Refresh.m \
	Bcast.m \
	mmchecknodes.m \
	Distribute.m \
	Shift.m \
	DistributeMap.m \
	Gather.m \
	Collect.m

REMOTE_OBJS = startup.m
ERR_OBJS = Interrupt.m Abort.m

.SUFFIXES: .$(ARCH) .c

all: 	clean dirs mmat common interactive remote err cshrc

dirs:
	mkdir $(MMAT_BASE)/common
	chmod 755 $(MMAT_BASE)/common
	mkdir $(MMAT_BASE)/interactive
	chmod 755 $(MMAT_BASE)/interactive
	mkdir $(MMAT_BASE)/remote
	chmod 755 $(MMAT_BASE)/remote

mmat: MMAT.$(ARCH)
	cp MMAT.$(ARCH) $(MMAT_BASE)/common
	cp MMAT.$(ARCH) $(MMAT_BASE)/interactive
	chmod 555 $(MMAT_BASE)/common/MMAT.$(ARCH)
	chmod 555 $(MMAT_BASE)/interactive/MMAT.$(ARCH)

common: $(SPMD_OBJS)
	cp $(SPMD_OBJS) $(MMAT_BASE)/common
	chmod a+r $(MMAT_BASE)/common/*

interactive:	$(INTERACTIVE_OBJS)
	cp $(INTERACTIVE_OBJS) $(MMAT_BASE)/interactive
	chmod a+r $(MMAT_BASE)/interactive/*


remote:	$(REMOTE_OBJS)
	cp $(REMOTE_OBJS) $(MMAT_BASE)/remote
	chmod a+r $(MMAT_BASE)/remote/*

err:  $(ERR_OBJS)
	cp $(ERR_OBJS) $(MMAT_BASE)/interactive
	chmod a+r $(MMAT_BASE)/interactive/*

cshrc:
	@echo "Creating $(MM_HOME)/cshrc.mm"
	@echo "#"
>> $(MM_HOME)/cshrc.mm
	@echo "# This file is machine made.  Do not edit."
>> $(MM_HOME)/cshrc.mm
	@echo "# Users should include this file in their .cshrc"
>> $(MM_HOME)/cshrc.mm
	@echo "#"
>> $(MM_HOME)/cshrc.mm
	@echo
>> $(MM_HOME)/cshrc.mm

	@echo "setenv MPI_HOME $(MPI_HOME)"
>> $(MM_HOME)/cshrc.mm
	@echo "if (! "$(DOL)"?LD_LIBRARY_PATH) then"
>> $(MM_HOME)/cshrc.mm
	@echo "  setenv LD_LIBRARY_PATH" $(DOL)"MPI_HOME/lib"
>> $(MM_HOME)/cshrc.mm
	@echo "else"
>> $(MM_HOME)/cshrc.mm
	@echo "  setenv LD_LIBRARY_PATH
"$(DOL)"{LD_LIBRARY_PATH}:"$(DOL)"MPI_HOME/lib" >> $(MM_HOME)/cshrc.mm
	@echo "endif"
>> $(MM_HOME)/cshrc.mm
	@echo
>> $(MM_HOME)/cshrc.mm

	@echo "setenv MATLAB_DIR $(MATLAB_DIR)"
>> $(MM_HOME)/cshrc.mm
	@echo "alias multimatlab "$(DOL)"MATLAB_DIR/bin/matlab -nojvm
-nosplash"  >> $(MM_HOME)/cshrc.mm
	@echo
>> $(MM_HOME)/cshrc.mm

	@echo "setenv MM_HOME $(MM_HOME)"
>> $(MM_HOME)/cshrc.mm
	@echo "setenv MATLABPATH
"$(DOL)"MM_HOME/interactive:"$(DOL)"MM_HOME/common:"$(DOL)"MM_HOME/example:"$(DOL)"MM_HOME/example/Demo:"$(DOL)"MM_HOME/example/financial"
     >> $(MM_HOME)/cshrc.mm
	@echo
>> $(MM_HOME)/cshrc.mm
	chmod 644 $(MM_HOME)/cshrc.mm

#patch:
#	cp $(MM_HOME)/mpich_patch/*.o .

#.c.o:	mm.h $(MPI_HOME)/include/MPI.h $(MPILIB)
#

.c.$(ARCH):	mm.h $(MPI_HOME)/include/mpi.h $(MPILIB)
		$(CLINKER) $(CFLAGS) $*.c  $(LIB_PATH) $(LIB_LIST) -lm

clean:
	$(RM) -f $(MMAT_BASE)/cshrc.mm
	$(RM) -f *.o *~ PI* *.$(ARCH) $(EXECS)
	$(RM) -f $(MMAT_BASE)/common/* $(MMAT_BASE)/interactive/* $(MMAT_BASE)/remote/*
	$(RM) -rf $(MMAT_BASE)/common $(MMAT_BASE)/interactive $(MMAT_BASE)/remote
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Linker-fu
      • From: Martin Costabel <email@hidden>
  • Prev by Date: Re: Darwin 9.2 Sources
  • Next by Date: Re: Linker-fu
  • Previous by thread: Re: How to pick which architecture to launch?
  • Next by thread: Re: Linker-fu
  • Index(es):
    • Date
    • Thread