Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang: error: linker command failed with exit code 1 (use -vto see invocation #16986

Closed
MuzafarWani opened this issue Aug 30, 2021 · 15 comments
Closed
Assignees
Labels
reviewed Issue has been reviewed and labeled by a developer

Comments

@MuzafarWani
Copy link

I am using the visit_libsim_mandelbrot_example for the purpose of in situ visualtion with LibSim+ Visit. The code is present on the below page of VisIt tutorial page
http://visitusers.org/index.php?title=VisIt-tutorial-in-situ#Building_the_example
I am using the Makefile with my changes included below:

Makefile for building mandelbrot simulation using libsim.

###############################################################################

############################## USER EDIT SECTION ################################

Fill in the Path to the VisIt installation. This is the directory that contains

VisIt's 2.13.0 directory. Mac users may want to

use /path/to/VisIt.app/Contents/Resources to locate the "visit" directory

within an app bundle.

VISITHOME=/home/muzafar/Downloads/installations

Set this to the version of VisIt that you use

VISITVERSION=3.1.4

Choose one, depending on your system architecture

#VISITARCH=darwin-x86_64
VISITARCH=linux-x86_64

Edit your compiler and its settings

CXX=clang++
CPPFLAGS=
CXXFLAGS=-O3
LDFLAGS=
LIBS=

#################################################################################
SIMDIR=$(VISITHOME)/$(VISITVERSION)/$(VISITARCH)/libsim/V2

SIM_CXXFLAGS=-I$(SIMDIR)/include
SIM_LDFLAGS=-L$(SIMDIR)/lib
SIM_LIBS=-lsimV2 -ldl

SRC=mandelbrot.C patch.C
OBJ=$(SRC:.C=.o)

SRC_BATCH=mandelbrot_batch.C patch.C
OBJ_BATCH=$(SRC_BATCH:.C=.o)

all: mandelbrot mandelbrot_batch

clean:
rm -f mandelbrot mandelbrot_batch $(OBJ)

mandelbrot: $(OBJ)
$(CXX) -o mandelbrot $(OBJ) $(LDFLAGS) $(SIM_LDFLAGS) $(SIM_LIBS) $(LIBS)

mandelbrot_batch: $(OBJ_BATCH)
$(CXX) -o mandelbrot_batch $(OBJ_BATCH) $(LDFLAGS) $(SIM_LDFLAGS) $(SIM_LIBS) $(LIBS)

.C.o:
$(CXX) $(CXXFLAGS) $(SIM_CXXFLAGS) $(CPPFLAGS) -c $<

and the Error I am getting is described as below. I am not able to figure out what the issue is

muzafar@MUZI:~/Downloads/visit_libsim_mandelbrot_example$ make
clang++ -o mandelbrot mandelbrot.o patch.o -L/home/muzafar/Downloads/installations/3.1.4/linux-x86_64/libsim/V2/lib -lsimV2 -ldl
patch.o: file not recognized: file format not recognized
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:47: mandelbrot] Error 1

Can anyone let me know what I have done wrong

@brugger1 brugger1 added the reviewed Issue has been reviewed and labeled by a developer label Aug 31, 2021
@brugger1 brugger1 self-assigned this Aug 31, 2021
@markcmiller86
Copy link
Member

We chatted a bit about this issue and suspect that you have inadvertently wound up mixing different versions of stuff which may be hanging around on different sites and/or that maybe you've done this example at some point in the distant past (producing patch.o with whatever tools you had then) and upon re-trying it now (after possibly updates to tools), you are encountering an issue.

Best thing is to start from a clean slate...

This example is tested in our nightly testing...

@biagas and @brugger1 and @BradWhitlock I worry that perhaps in #4503 I removed instances of Makefile.in that I thought were obsoleted by transition to CMake but which were actually there to facilitate stand-alone builds of these examples without requiring anyone to have CMake. Can you have a look?

@markcmiller86
Copy link
Member

@biagas ... might you know how to run this example outside of any dependence on the test suite or other developer-related stuff? I think that might be the key issue for this user...how to make this work stand-alone...with a version of VisIt maybe which is a binary download and maybe vanilla make.

@biagas
Copy link
Contributor

biagas commented Aug 31, 2021

@markcmiller86 not offhand. Might be good to download the example referenced above from visit-users and see what may need to be tweaked in the Makefile provided there. Also, see if the actual source has changed any.

@markcmiller86
Copy link
Member

Ok, found the problem. The tarball dataset is http://portal.nersc.gov/project/visit/cyrush/2018_02_ecp/visit_libsim_mandelbrot_example.tar.gz and when I download it, I find there is a patch.o file inside it already....

cleanup.sh
go_mandelbrot_batch.sh
go_mandelbrot.sh
Makefile
mandelbrot_batch.C
mandelbrot.C
mandelbrot.ui
patch.C
patch.h
patch.o
SimulationExample.h

So, the tarball that got downloaded isn't clean and when the user went to rebuild, patch.o is for a different architecture. @MuzafarWani try removing ALL the .o files there and remaking and see if you get further.

@MuzafarWani
Copy link
Author

@markcmiller86 It did work after removing the ALL .o files.
I tried to follow all the steps for running the simulation and accessing the data using visit but it is not working.
trace.txt

Once I start running the simulation in one terminal with the command
./mandelbrot -trace trace.txt
On another terminal I run the visit but after the step

There should be a file ######.mandelbrot.sim2 that you'll want to open. If there are multiple files that match that pattern then open the most recent one.
the terminal one which is running the simulation shows "VisIt did not connect: Failed to open the VisIt library: (null)"
and I am not able to access anything using the UI of VISIT. I have attached the trace file. What am I missing here. Please let me know.

@markcmiller86
Copy link
Member

@MuzafarWani thanks for the trace file. That helps.

The key issue I see in that trace file I think is this...

Calling dlopen(libsimV2runtime_ser.so)
Failed to open the VisIt library: libsimV2runtime_ser.so: cannot open shared object file: No such file or directory

I have tried repeating your steps and was experiencing similar problems with a binary download install. However, I had a little more success using my own build of develop. Did you try the -dir <path-to-visit-home> command-line argument to the ./mandelbrot? That made the difference for me. I think it would be...

./mandelbrot -trace trace.txt -dir /home/muzafar/Downloads/installations/3.1.4/linux-x86_64

@markcmiller86
Copy link
Member

@biagas and @brugger1 FYI...this example does work with develop. I did run into a few things though and will put those issues in #16989

@MuzafarWani
Copy link
Author

@markcmiller86 Thanks for the prompt reply. I did run with ur suggestion

./mandelbrot -trace trace.txt -dir /home/muzafar/Downloads/installations/3.1.4/linux-x86_64
trace.txt
I have attached the trace file again.
I am still not able to access any data from the simulation using visIt. I have recorded a vedio my screen during the run, link is below

https://drive.google.com/file/d/1qGCQUCJak0VRMs-5ditQfhe8q1wrxvzn/view?usp=sharing

Can you please let me know how to complete all the steps mentioned in

http://visitusers.org/index.php?title=VisIt-tutorial-in-situ#Building_the_example

@markcmiller86
Copy link
Member

If you take a look at trace.txt does anything stand out for you?

I see there...

LoadVisItLibrary
Calling dlopen(libsimV2runtime_ser.so)
Failed to open the VisIt library: libsimV2runtime_ser.so: cannot open shared object file: No such file or directory

Calling getenv(LD_LIBRARY_PATH)
LoadVisItLibrary Failed to open the VisIt library: (null)

That hints at something.

Can you confirm libsimV2runtime_ser.so exists in your VisIt installation?

find /home/muzafar/Downloads/installations/3.1.4/linux-x86_64 -name libsimV2runtime_ser.so

You should see something like this after running that command (below is from my mac and things are named a little differently there but its the same idea...

find /Applications/VisIt.app/Contents/Resources/ -name libsimV2runtime_ser.dylib
/Applications/VisIt.app/Contents/Resources//3.2.0/darwin-x86_64/lib/libsimV2runtime_ser.dylib

If libsimV2runtime_ser.so is there try setting LD_LIBRARY_PATH to the directory containing it before running mandelbrot. For example...

env LD_LIBRARY_PATH/home/muzafar/Downloads/installations/3.1.4/linux-x86_64/lib ./mandelbrot -trace trace.txt -dir /home/muzafar/Downloads/installations/3.1.4/linux-x86_64

or, if your env. already has LD_LIBRARY_PATH set to some value...

env LD_LIBRARY_PATH=/home/muzafar/Downloads/installations/3.1.4/linux-x86_64/lib:$LD_LIBRARY_PATH ./mandelbrot -trace trace.txt -dir /home/muzafar/Downloads/installations/3.1.4/linux-x86_64

If none of these ideas work, I think we are out of options.

@markcmiller86
Copy link
Member

FYI...I've tried similar steps but on a Linux system instead of my macOS system...I have been UNable to get it to work on Linux and I've tried a lot of different things.

I suspect that we haven't tested running a libsim example from outside of our regular development environments in quite some time (like myabe before we updated osmesa) and we're hitting some new issues.

@ARSanderson you use libsim quite a bit. Does any of this sound familiar?

@MuzafarWani
Copy link
Author

@markcmiller86 Thanks for you replies
**Can you confirm libsimV2runtime_ser.so exists in your VisIt installation?**_

Yes it is in visit. It exists in two locations one is /home/muzafar/Downloads/installations/3.1.4/linux-x86_64/lib and second one is
/home/muzafar/Downloads/installations/current/linux-x86_64/lib. I set LD_LIBRARY_PATH varaiable to both of the locations but it is still showing

LoadVisItLibrary
Calling dlopen(libsimV2runtime_ser.so)
Failed to open the VisIt library: libsimV2runtime_ser.so: cannot open shared object file: No such file or directory

Calling getenv(LD_LIBRARY_PATH)
LoadVisItLibrary Failed to open the VisIt library: (null)

Will the example work on windows system.

Also there are few other links mentioned on page

One is: https://github.com/visit-dav/visit/tree/develop/src/tools/data/DataManualExamples/Simulations

Another one is : https://github.com/visit-dav/visit/tree/develop/src/tools/data/DataManualExamples/Simulations/contrib/pjacobi/

Another Link is: https://github.com/visit-dav/visit/tree/develop/src/tools/data/DataManualExamples/Simulations

Will any of the above work on linux system. I want to run one example and then follow the same procedure for the application:

https://github.com/mrnorman/miniWeather

@MuzafarWani
Copy link
Author

@markcmiller86 I resolved the issue. the code worked on a different version of ubuntu os. Thank you for your help.
The source code of mandelbrot simulation contains code which calls visit. I tried to find the code of mandelbrot simulation without the visit code so that I can understand the changes needed to be done to make a simulation work with visit. Can you please point me where the source code of mandelbrot is without visit code.

@markcmiller86
Copy link
Member

@MuzafarWani I worry that the mandelbrot example may not have been written as a stand-alone simulation into which libsim has been integrated. Instead, I think mandelbrot is merely trying to exercise and show the power of the libsim interface and so there likely isn't a version of mandelbrot without the libsim and just the simulation.

@markcmiller86
Copy link
Member

@MuzafarWani you might find the progression of examples shown in the sim*.c examples here helpful. The first, sim1.c has no VisIt stuff in it. The next several, sim2.c, sim3.c, ... have progressively more VisIt stuff.

Also, there are a number of other examples in that directory that might be helpful.

@MuzafarWani
Copy link
Author

@markcmiller86 Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reviewed Issue has been reviewed and labeled by a developer
Projects
None yet
Development

No branches or pull requests

4 participants