Opened 9 years ago

Closed 7 years ago

Last modified 7 years ago

#3618 closed defect (fixed)

Compiling From Source Fedora 23

Reported by: r.trevor.clark@… Owned by: somebody
Priority: high Milestone: 1.12.0
Component: Installation program Version:
Keywords: Fedora Cc:

Description

Hi I have compiled OpenModelica from the latest Git Source. However, I ran into a few issues compiling on Fedora 23. I don't have too much experience so I could have made some mistakes. I have the project in ~/OM/OpenModelica_12_27

On Thing is that the $QTDIR on my system points to /usr/lib64/qt-3.3 and not /usr/lib64/qt4 so I had to pass the argument QTDIR=/usr/lib64/qt4 in the ./configure step

I started the super project by using the configure options as shown on the website

$ autoconf
$ ./configure CC=clang CXX=clang++ QTDIR=/usr/lib64/qt4
$ make -j8

This compiled the OMCompiler, but the rest of the sub projects OMEdit, OMNotebook etc did not compile automatically, though I don't know if they are supposed to.

OMPlot and OMEdit compiled fine after that.

However when I compiled OMNotebook, OMShell, and OMOptim I got some errors.

OMNotebook:

I was able to get it to compile by changing from clang to gcc and then back to clang. Here is the process I followed.

cd OMNotebook
autoconf
./configure --with-ombuilddir=/home/tclark/OM/OpenModelica_12_27/build/ --prefix=/home/tclark/OM/OpenModelica_12_27/build/ CXX=clang++ QTDIR=/usr/lib64/qt4

make

This gave the error:

textcell.cpp:446:15: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]

qDebug( text.toStdString().c_str() );

~

1 error generated.
Makefile:745: recipe for target 'textcell.o' failed

then I configure again without specifying clang.

./configure --with-ombuilddir=/home/tclark/OM/OpenModelica_12_27/build/ --prefix=/home/tclark/OM/OpenModelica_12_27/build/ QTDIR=/usr/lib64/qt4

make

This resulted in this error:

/usr/bin/ld: cellapplication.o: relocation R_X86_64_32S against `_ZTVN4IAEX15CellApplicationE' can not be used when making a shared object; recompile with -fPIC
cellapplication.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:248: recipe for target '../bin/OMNotebook' failed
make[2]: * bin/OMNotebook Error 1
make[2]: Leaving directory '/home/tclark/OM/OpenModelica_12_27/OMNotebook/OMNotebook/OMNotebookGUI'
Makefile.unix:19: recipe for target 'OMNotebook' failed
make[1]:
* [OMNotebook] Error 2
make[1]: Leaving directory '/home/tclark/OM/OpenModelica_12_27/OMNotebook/OMNotebook/OMNotebookGUI'
Makefile:25: recipe for target 'omnotebook' failed
make: * [omnotebook] Error 2

Then after re configuring with clang again:

./configure --with-ombuilddir=/home/tclark/OM/OpenModelica_12_27/build/ --prefix=/home/tclark/OM/OpenModelica_12_27/build/ CXX=clang++ QTDIR=/usr/lib64/qt4

make

This then seemed to have finished compiling without error and the program seems to work.

I followed the same process for OMShell clang -> gcc -> clang and it also now seems to work.
The two respective errors for the first two attempts at make are :

clang

DQT_CORE_LIB -DQT_SHARED -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtXml -I/usr/include -I../generatedfiles/moc -o omc_communicator.o omc_communicator.cpp
omc_communicator.cpp:219:15: error: format string is not a string literal (potentially insecure) [-Werror,-Wformat-security]

qWarning( tmp.c_str() );


1 error generated.
Makefile:264: recipe for target 'omc_communicator.o' failed
make[2]: * [omc_communicator.o] Error 1
make[2]: Leaving directory '/home/tclark/OM/OpenModelica_12_27/OMShell/OMShell/OMShellGUI'
Makefile.unix:20: recipe for target 'OMShell' failed
make[1]:
* [OMShell] Error 2
make[1]: Leaving directory '/home/tclark/OM/OpenModelica_12_27/OMShell/OMShell/OMShellGUI'
Makefile:24: recipe for target 'omshell' failed
make: * [omshell] Error 2

gcc

mnithread -lQtXml -lQtGui -lQtCore -lpthread
/usr/bin/ld: commandcompletion.o: relocation R_X86_64_32S against `_ZTVN4IAEX17CommandCompletionE' can not be used when making a shared object; recompile with -fPIC
commandcompletion.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:120: recipe for target '../bin/OMShell' failed
make[2]: * bin/OMShell Error 1
make[2]: Leaving directory '/home/tclark/OM/OpenModelica_12_27/OMShell/OMShell/OMShellGUI'
Makefile.unix:20: recipe for target 'OMShell' failed
make[1]:
* [OMShell] Error 2
make[1]: Leaving directory '/home/tclark/OM/OpenModelica_12_27/OMShell/OMShell/OMShellGUI'
Makefile:24: recipe for target 'omshell' failed
make: * [omshell] Error 2

So everything up to then now works.

However, I was unable to get OMOptim to compile at all.
Here are the two errors I got when trying to compile with clang then gcc.

clang

/usr/bin/ld: cellapplication.o: relocation R_X86_64_32S against `_ZTVN4IAEX15CellApplicationE' can not be used when making a shared object; recompile with -fPIC
cellapplication.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:248: recipe for target '../bin/OMNotebook' failed
make[2]: * bin/OMNotebook Error 1
make[2]: Leaving directory '/home/tclark/OM/OpenModelica_12_27/OMNotebook/OMNotebook/OMNotebookGUI'
Makefile.unix:19: recipe for target 'OMNotebook' failed
make[1]:
* [OMNotebook] Error 2
make[1]: Leaving directory '/home/tclark/OM/OpenModelica_12_27/OMNotebook/OMNotebook/OMNotebookGUI'
Makefile:25: recipe for target 'omnotebook' failed
make: * [omnotebook] Error 2

gcc

/usr/bin/ld: ../../ParadisEO-2.0.1/build/moeo/lib/libmoeo.a(moeoObjectiveVectorTraits.cpp.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
../../ParadisEO-2.0.1/build/moeo/lib/libmoeo.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
Makefile:104: recipe for target '../bin/OMOptim' failed
make[2]: * bin/OMOptim Error 1
make[2]: Leaving directory '/home/tclark/OM/OpenModelica_12_27/OMOptim/OMOptim/build'
Makefile.unix:16: recipe for target 'OMOptim' failed
make[1]:
* [OMOptim] Error 2
make[1]: Leaving directory '/home/tclark/OM/OpenModelica_12_27/OMOptim/OMOptim/build'
Makefile:35: recipe for target 'omoptim' failed
make: * [omoptim] Error 2

Again I don't have very much experience and may have missed something obvious or misunderstood directions, but I am looking for some help to understand and be able to get this working as far as compilation (everything appears to work aside from OMOptim).

Thank You!

Attachments (2)

failed tests (9.4 KB ) - added by Trevor Clark <r.trevor.clark@…> 9 years ago.
failed tests
clockedTest.mos.fail_log (10.5 KB ) - added by r.trevor.clark@… 9 years ago.
fail log

Download all attachments as: .zip

Change History (19)

comment:1 by Martin Sjölund, 9 years ago

I would not mix clang++ and g++ as you get really weird errors. Also, the initial error you got with clang was due to using -Werror as a default flag. I assume this comes from a Fedora customization. Likely there are customizations for cmake/qmake that set -Werror and do not use -fPIC as it should...

comment:2 by Trevor Clark <r.trevor.clark@…>, 9 years ago

Thanks for the reply. I realize that mixing them is not a good idea. That was just how I got them to compile. I have very little experience compiling programs. Luckily OMCompiler, OMPlot, and OMEdit compiled normally, so at least those work. Do you have any suggestions for fixing the -Werror to -fPIC flag? I will see if I can figure it out as well. Thank You!

comment:3 by Martin Sjölund, 9 years ago

Perhaps adding some CFLAGS and CXXFLAGS:

./configure CFLAGS="-Wno-error -fPIC -Os" CXXFLAGS="-Wno-error -fPIC -Os"

comment:4 by Trevor Clark <r.trevor.clark@…>, 9 years ago

I'll give that a try later this week. Thanks again.

comment:5 by Trevor Clark <r.trevor.clark@…>, 9 years ago

Thanks for your help. I was able to get it to compile using your suggestion.

I found a couple places in the source files for OMNotebook and OMShell that needed to be changed in order for me to compile. Even though I used the -Wno-error flag, the environment in fedora uses -Werror=format-security flag and causes the compilation to fail. It is a really quick fix that I think should be implemented as per this webpage: https://fedoraproject.org/wiki/Format-Security-FAQ

The change is just specifying a string in print statements, adding "%s".

OMNotebook

textcell.cpp:446 -> qDebug( "%s", text.toStdString().c_str() );

notebook.cpp:145 -> qDebug( "%s", filename_.toStdString().c_str() )

OMShell

omc_communicator.cpp:219 -> qWarning( "%s", tmp.c_str() );

After that the everything seems to have compiled and works.

When I run the testsuite there are a number of failed tests, any advice on how to resolve them? I attached a file with a list of all the failed tests.
This is on omc version: v1.9.4-dev.729+ga646bc7

by Trevor Clark <r.trevor.clark@…>, 9 years ago

Attachment: failed tests added

failed tests

comment:6 by Martin Sjölund, 9 years ago

My guess is:
make runtimeCPPinstall (in OMCompiler directory for the optional C++ runtime)
./configure ... OMPCC="gcc -fopenmp"

The MetaModelica tests I can't see what is going wrong. Perhaps some extra stack-smashing options added by Fedora? Or some additional flags that need to be passed to the other CFLAGS...

comment:7 by Trevor Clark <r.trevor.clark@…>, 9 years ago

I resolved the MetaModelica tests. in the super project using CFLAGS="-Wno-error -fPIC -Os" CXXFLAGS="-Wno-error -fPIC -Os" caused the MetaModelica test errors. After changing the source files for OMNotebook and OMShell I do not need to pass those flags to compile the project.

However even when using ./configure ... --with-cppruntime OMPCC="gcc -fopenmp"
the ./openmodelica/cppruntime/ tests fail.

Anymore ideas for resolving this? Sorry to have so many problems. All the tests pass except for the cppruntime ones, so maybe I should just not use the optiona C++ runtime.

Failed tests:

./openmodelica/cppruntime/BouncingBall.mos
./openmodelica/cppruntime/WhenStatement1.mos
./openmodelica/cppruntime/clockedTest.mos
./openmodelica/cppruntime/clockedTypesTest.mos
./openmodelica/cppruntime/functionPointerTest.mos
./openmodelica/cppruntime/genDebugSymbols/Modelica.Fluid.Examples.BranchingDynamicPipes_genDebugSymbols.mos
./openmodelica/cppruntime/hardcodedStartValues/Modelica.Fluid.Examples.BranchingDynamicPipes_hardcodedStartValues.mos
./openmodelica/cppruntime/hpcom/Modelica.Electrical.Analog.Examples.CauerLowPassSC_level_omp_measureTime.mos
./openmodelica/cppruntime/hpcom/Modelica.Electrical.Analog.Examples.CauerLowPassSC_levelfix_pthreads_memory.mos
./openmodelica/cppruntime/hpcom/Modelica.Electrical.Spice3.Examples.CoupledInductors_level_omp.mos
./openmodelica/cppruntime/hpcom/Modelica.Electrical.Spice3.Examples.CoupledInductors_list_pthreads_spin.mos
./openmodelica/cppruntime/hpcom/Modelica.Thermal.HeatTransfer.Examples.Motor_mcp_omp.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Blocks.Examples.BooleanNetwork1.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Blocks.Examples.Filter.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Electrical.Analog.Examples.CauerLowPassSC.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Electrical.Analog.Examples.ShowSaturatingInductor.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Electrical.Digital.Examples.Counter.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Electrical.QuasiStationary.SinglePhase.Examples.ParallelResonance.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Electrical.Spice3.Examples.CoupledInductors.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Mechanics.MultiBody.Examples.Elementary.DoublePendulum.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Mechanics.MultiBody.Examples.Elementary.RollingWheelSetDriving.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Mechanics.MultiBody.Examples.Elementary.SpringWithMass.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Mechanics.Rotational.Examples.Backlash.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Mechanics.Rotational.Examples.RollingWheel.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Mechanics.Translational.Examples.Accelerate.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Mechanics.Translational.Examples.InitialConditions.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Media.Examples.IdealGasH2O.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Media.Examples.TestOnly.IdealGasN2.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Media.Examples.Tests.MediaTestModels.Air.DryAirNasa.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Media.Examples.WaterIF97.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.StateGraph.Examples.FirstExample.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Thermal.HeatTransfer.Examples.ControlledTemperature.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Thermal.HeatTransfer.Examples.TwoMasses.mos
./openmodelica/cppruntime/libraries/msl32/Modelica.Utilities.Examples.readRealParameterModel.mos
./openmodelica/cppruntime/mathFunctionsTest.mos
./openmodelica/cppruntime/omedit/BouncingBall_OMEdit_flags.mos
./openmodelica/cppruntime/recordTupleReturnTest.mos
./openmodelica/cppruntime/solveTest.mos
./openmodelica/cppruntime/staticLinking/Modelica.Electrical.Analog.Examples.CauerLowPassSC_cpp_static.mos
./openmodelica/cppruntime/tearnonlin1.mos
./openmodelica/cppruntime/umfpack/Modelica.Electrical.Analog.Examples.CauerLowPassSC.mos

comment:8 by r.trevor.clark@…, 9 years ago

I noticed when building the test that this warning comes up up when compiling the /openmodelica/cppruntime tests. Which may be related to why the tests fail?

warning: -jN forced in submake: disabling jobserver mode.

Any ideas on that?

comment:9 by Martin Sjölund, 9 years ago

Usually on Linux we run cd testsuite/partest and ./runtests.pl

It's possible that running the makefiles in parallel is a problem, but I doubt so.

You can see what the error is by doing:

cd ./openmodelica/cppruntime
../../rtest solveTest.mos

comment:10 by Trevor Clark <r.trevor.clark@…>, 9 years ago

I tried to compile on Ubuntu 15.10 for comparison and the exact same tests failed. So I think I am missing something.

I was wondering if you have a script for when you compile and a list of package names that you use to compile on ubuntu so that I can compare and see if I am missing anything?

comment:11 by Martin Sjölund, 9 years ago

You could do:

sudo apt-get build-dep openmodelica
sudo apt-get install libsundials-kinsol1 libqtwebkit-dev # Might be needed depending on platform
apt-get -b source openmodelica

The Hudson job builds using:

cd OpenModelica-clang

if test ! -z "$REVISION"; then
  git checkout master || exit 1
  test `git rev-parse HEAD` = "$REVISION" || exit 1
  git reset --hard || exit 1
else
  git reset --hard origin/master && git checkout master && git pull && git submodule update --init --force --recursive && git fetch --tags || exit 1
fi

# Do not remove the svn and git directories in the libraries directory
git submodule foreach --recursive  "git fetch --tags && git clean -fdxq -e /git -e /svn" || exit 1
git clean -fdxq || exit 1
git submodule foreach --recursive "git describe --dirty --always"
git describe --dirty --always --match "v*.*" || exit 1

autoconf
NPROC=`nproc`
./configure --with-omniORB --enable-modelica3d CC=clang CXX=clang++ OMPCC="gcc-4.8 -fopenmp" CFLAGS='-O2 -march=native' --without-omc --with-cppruntime --with-omniORB

time make -j$NPROC

by r.trevor.clark@…, 9 years ago

Attachment: clockedTest.mos.fail_log added

fail log

comment:12 by r.trevor.clark@…, 9 years ago

So I installed the dependencies on a clean install of ubuntu 15.10 using:

sudo apt-get build-dep openmodelica

when running the make file i found that I needed flex and the options provided above use OMPCC="gcc-4.8 -fopenmp" so I also installed the following deps

sudo apt-get install gcc-4.8 libgcc-4.8-dev flex

Then download the source from git-hub

git clone --recursive https://github.com/OpenModelica/OpenModelica.git

cd OpenModelica

autoconf

configured using the following options:

./configure --with-omniORB --enable-modelica3d CC=clang CXX=clang++ OMPCC="gcc-4.8 -fopenmp" CFLAGS='-O2 -march=native' --without-omc --with-cppruntime --with-omniORB

then ran the make command:

make -j8

then ran the testsuite

(cd testsuite/partest && ./runtests.pl)

and again the cppruntime tests failed.

I uploaded one of the fail logs.

I am kind of at a loss. I don't want to take up too much more of your time, but if you see anything I am obviously missing let me know.

comment:13 by Martin Sjölund, 9 years ago

Ah, this one I think I know what the problem is. You use CXX=g++ in that log for compiling the simulation, and g++ uses a new std::string type in 15.10... So you get boost problems since the cppruntime developers did not update everything correctly.

You could just ignore it and skip the cppruntime :)

comment:14 by Trevor Clark <r.trevor.clark@…>, 9 years ago

Should I compile it without the --with-cppruntime flag? or just leave it as is and know that the cppruntime options don't work?

comment:15 by r.trevor.clark@…, 9 years ago

Looks like that was the same problem I had in fedora 23. Thanks for all you help. I really appreciate it.

comment:16 by Francesco Casella, 7 years ago

Resolution: fixed
Status: newclosed

Fedora 25 has been officially supported for several months now. RPM packages are available, see https://openmodelica.org/download/download-linux

comment:17 by Martin Sjölund, 7 years ago

Component: *unknown*Installation program
Milestone: Future1.12.0
Note: See TracTickets for help on using tickets.