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

MQTT Linux library dependencies should be recompiled with -fPIC #306

Closed
bernhard-thiele opened this issue Mar 24, 2020 · 8 comments · Fixed by #307
Closed

MQTT Linux library dependencies should be recompiled with -fPIC #306

bernhard-thiele opened this issue Mar 24, 2020 · 8 comments · Fixed by #307
Assignees
Milestone

Comments

@bernhard-thiele
Copy link
Collaborator

This is an issue reported to me which popped up when trying to translate an FMU using Dymola:

translateModelFMU("Modelica_DeviceDrivers.Blocks.Examples.TestSerialPackager_MQTT annotation(experiment(StopTime=5, __Dymola_Algorithm=\"Dassl\"))", false, "", "2", "all", false, 0);
= ""
 
…
/usr/lib64/gcc/x86_64-suse-linux/5/../../../../x86_64-suse-linux/bin/ld: /home/zpf/dymoladists/dymolaR423/Modelica/Library/Modelica_DeviceDrivers 1.8.1/Resources/Library/linux64/libssl.a(s23_clnt.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with –fPIC
…
/usr/lib64/gcc/x86_64-suse-linux/5/../../../../x86_64-suse-linux/bin/ld: /home/zpf/dymoladists/dymolaR423/Modelica/Library/Modelica_DeviceDrivers 1.8.1/Resources/Library/linux64/libcrypto.a(mem_dbg.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with –fPIC
…

So to work with FMI, the libraries (only listed a few above) under Resources/Library/linux64 need to be compiled with the -fPIC flag.

@beutlich beutlich self-assigned this Mar 24, 2020
@beutlich
Copy link
Contributor

Right, can do. Any deadlines?

@bernhard-thiele
Copy link
Collaborator Author

No, would be good to have it in the next release, but there is no milestone planned, yet. If it is done earlier I would create an intermediate bug fix release, so that it has a chance to be shipped with the next Dymola release.

@beutlich
Copy link
Contributor

This applies to libcrypto.a and libssl.a. Also to libpaho-mqtt3cs.a?

@sjoelund
Copy link
Contributor

That one should be fine.

$ rm *.o
$ ar x ~/Downloads/libpaho-mqtt3cs.a
$ clang -o test.so -shared *.o
$ ar x ~/Downloads/libssl.a
$ clang -o test.so -shared *.o
/usr/bin/ld: bio_ssl.o: relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: d1_both.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC

@tbeu
Copy link
Collaborator

tbeu commented Mar 24, 2020

Also to libpaho-mqtt3cs.a?

libpaho-mqtt3cs.a is built with -fPiC already.

https://github.com/tbeu/paho.mqtt.c/blob/6c8f6346e442f2ed35e13b5b7db06196b42eebfb/.travis.yml#L56-L57

@tbeu
Copy link
Collaborator

tbeu commented Mar 24, 2020

I wonder if this requires to build openssl libs as shared libs.

@tbeu
Copy link
Collaborator

tbeu commented Mar 24, 2020

@bernhard-thiele In the spirit of TDD can you please add a unit test, where we compile a shared library (instead of an executable).

@bernhard-thiele
Copy link
Collaborator Author

Yes, will do.

bernhard-thiele added a commit to bernhard-thiele/Modelica_DeviceDrivers that referenced this issue Mar 25, 2020
The goal is to ensure that the shipped MQTT libraries can be used for building
shared libraries which might be needed for building FMUs, see modelica-3rdparty#306.
bernhard-thiele added a commit that referenced this issue Mar 25, 2020
The goal is to ensure that the shipped MQTT libraries can be used for building
shared libraries which might be needed for building FMUs, see #306.
@bernhard-thiele bernhard-thiele added this to the v1.8.2 milestone Mar 25, 2020
@bernhard-thiele bernhard-thiele changed the title MQTT Linux library dependencies should be recompiled with -fpic MQTT Linux library dependencies should be recompiled with -fPIC Mar 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

4 participants