Building an NPAPI browser plugin on Linux x86 and x86_64, how do I ensure that it loads the correct version of its dependent libraries? - cmake

I'm attempting to build a Linux browser plugin using Firebreath that runs on 32bit and 64bit Linux.
In my X11/projectDef.cmake I have
target_link_libraries(${PROJECT_NAME}
${PLUGIN_INTERNAL_DEPS}
"${CMAKE_CURRENT_SOURCE_DIR}/lib/libOIS-1.4.0_32.so"
)
Currently I'm just manually changing that line switching 32 to 64 when I want to do a different build, so that's probably wrong. But my issue is that even when I build with the 32bit library and it compiles successfully, I get the following error when trying to load the plugin in Firefox:
$ firefox
LoadPlugin: failed to initialize shared library /home/daniel/.mozilla/plugins/npBoomstickJavaScriptJoystickSupport.so [libOIS-1.4.0.so: wrong ELF class: ELFCLASS64]
How do I set up my cmake to automatically include the correct library depending on the architecture? Is there a way to build both x86 and x86_64 simultaneously on the same machine? How do I get the plugin to load correctly or is there a way to further debug this problem?

As far as I know the only way to do a build for 32 bit on a 64 bit machine is to use cross compiling: http://www.vtk.org/Wiki/CMake_Cross_Compiling
I've never actually tried this, but inside CMake you can probably use the CMAKE_SIZEOF_VOID_P which will be 4 in 32 bit mode, 8 in 64 bit. You could add an if to your cmake script to set the correct binaries depending on the size of that.

Related

Error when running a 32 bit .dll on a 64 bit JVM Inteliij

I am getting the below error when I try to execute the below line of code in my project. I added a 64 bit JDK to my project properties . I am using Intellij as my IDE
System.loadibrary(smsjavaagentapi)
Fatal Error: Exception from System.loadibrary(smsjavaagentapi) java.lang.unsatisfiedLinkError smsjavaagentapi.dll: Can't load IA 32 bit .dll on an AMD 64-bit platform
I think the problem is that I am using a 64 bit JVM and I am trying to run a 32 bit .dll. I don't have an option to install 32 bit JDK on my machine and add it to my project properties nor I can port the .dll to 64 bit . Is there a work around for this?
There is a limitation at the OS level which prevents a 32-bit shared library being loaded by a 64 bit process, so your options are
modify the OS to allow this (not easy)
migrate the DLL to 64-bit by recompiling it.
install a 32-bit JVM (easier)
download a 32-bit JVM and unpack it without install it. (doesn't require any special permission)
You might find you can get a version of IntelliJ which ships with a 32-bit JVM, or install another program which installs a 32-bit JVM and use just the JVM.

Latest CMake and LLVM on Windows 10

All
latest LLVM is 7.0 and it is working quite well on Windows 10 x64, building native executables etc.
latest CMake is 3.12.x.
I have VS 2017 Pro installed as well.
Downloaded them both and tried to make simple project with it on Windows, and it didn't work, even if I set CC/CXX, linker pointing to lld, failing on compiling test problem, not finding rc (resource compiler).
Tried targeting GNU make as well as Ninja as build system.
Is this a supported configuration? If yes, how to make it work?
Basically, I would like to use CMake/LLVM with editor/terminal like I'm doing it on Linux
Run CMake from Developer Command Prompt.
That should make rc available in your PATH, and then CMake should be able to find it.

Salesforce IDE starting error

I have installed the standalone IDE for salesforce force.com platform. On trying to start the ide i am getting "JVM terminated. Exit Code=-1" error. Any idea what this error code means ?
This is a common loading error for force.com IDE.
There are different solutions. Try anyone of these:
A) Change the workspace location.
OR
B) (i). Install Eclipse 3.6 for Java Developers (Helios) from the link http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/heliossr2
Click your operating system from the window on your right.
(ii). Using the below link, follow the instructions to install Force.com IDE plugin for Eclipse 3.6 http://wiki.developerforce.com/page/Force.com_IDE_Installation_for_Eclipse_3.6
OR
C) In the default Force.com IDE install directory:
C:\Program Files\salesforce.com\Force.com IDE
Locate the config file:
forceide
And comment out the following at the end of the file (note the leading #):
#-vmargs
#-Dfile.encoding=UTF-8
#-Xms256m
#-Xmx1024m
#-XX:PermSize=128M
#-XX:MaxPermSize=512M
I hope it works now.
Cheers!
This could be because of various reasons. Say, if you do not have enough memory (RAM) as specified in config file(forceide.ini). As said in this link Force.com IDE – JVM terminated , probably reduce MaxPermSize in config file to say 256M and check.
This exact thing happened to me a few days ago.
My setup is:
Windows 7 64 bit
jre7 64 bit
Force.com IDE 64 bit
When I ran the java auto update to update my jre it installed the 32 bit version (a whole other gripe). So I manually downloaded the 64 bit version of the jre installed it over the top of the 32 bit version and the IDE started working again.

cmake on Solaris 10 Sparc: Configured not to use shared libraries?

I'm trying to port some software over to Solaris 10 Sparc, using GCC 3.4.6, and the software's build system uses cmake. When I run the command cmake CMakeLists.txt, I get a lot of output like this:
ADD_LIBRARY for library <library_name> is used with the SHARED
option, but the target platform supports only STATIC libraries.
Building it STATIC instead. This may lead to problems.
Obviously Solaris 10 Sparc supports shared libraries, and I have built this software on x86 Solaris 10 before.
Anyone run into this or can provide direction? I'm about to dive into the cmake source to figure out if it has issues with Sparc Solaris.
Thanks.
After fighting with this a couple hours, and making little headway, I decided to install cmake-2.8.6 from OpenCSW using pkgutil, and this issue cleared up.
Also asked this question in #cmake#irc.freenode.net before I fixed it, looks to be an issue with cmake 2.6.4 on Sparc Solaris 10.

g++ cant compile 32 bit with mudflap

I have a project that for the time being has to be compiled in 32 bit mode. I'm on Ubuntu 11.04 -64 bit and it works fine with the -m32 switch.
Now I wanted to debug with the -fmudflap option, but I get a series of undefined functions (__real_malloc, __real_calloc, __real_free, etc.).
I tested with a trivial hello world program and it works fine in a 64bit compile, but not in 32bit mode.
Is there a different library to link besides -lmudflap ?
It sounds like you need to install the 32-bit version of mudflap.