XCode can't find j2objc jre_emul library - xcode

I import j2objc to my project, but I still get error like Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_Test (public class Test in java source). I found something about wrong linking static library to project (libjre_emul.a). I found possible official solution add to Other Linker Flags flag "-l jre_emul".
Problem is I get error ld: library not found for -l jre_emul what does it mean? How can I fix this?
I tried extended command:
"-l jre_emul -ObjC -force_load ${PROJECT_DIR}/lib/libjre_emul.a"
Error library not found still remains. Any idea?
Thanks.

I think you have a spelling error in your other linker flags. Try to use something like:
-l"jre_emul"

The -force_load flag is no longer necessary. The issue is that the linker can't find the library because the path to it is not defined in your project (it's probably not in ${PROJECT_DIR}/lib, unless you explicitly put it there). The Update the Build Settings wiki section describes how to add the J2ObjC distribution path to your project's Library Search Paths build setting.

Related

Cargo builds fails: ld framework not found Security

Trying to run a simple program and it fails with the issue
note: ld: framework not found Security
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I tried to do some investigation and I see that chrono 0.4.19 in cargo.toml points to that. Once I remove that dependency, it stays building. I am new to the mac world and have seen various suggestion but I am very much clueless about the issue.
I tried to dockerise it and it works fine then on container, but doesn't on my mac. Can anyone please point me to the correct direction?
Have you tried adding "-framework Security" to the command line arguments when building? "-framework" is an argument that causes the linker (ld) to see out Dylibs in /System/Library/Frameworks defined as "frameworks". They're technically just dynamic libraries, but require this switch since they're put into a versioned bundle (framework_name.framework/framework_name).

About graphics.h, winbgim.h and libbgi.a libraries in codeblock

I added the full library graphic.h, winbgim.h, libbgi.a and its path in linker setting and other linker but it didn't work and it showed an error:
ld.exe cannot find -lbgi
ld will give you that error if it can't find libbgi.a for static builds or libbgi.dll.a shared builds.
Make sure the path containing libbgi.a is set it the linker paths as in this screenshot:
Another thing you could try is to build a static version of your project in order to avoid using a missing shared library.

Boost logging - getting unresolved symbol

I am a novice to cmake and boost so this question might be missing something obvious:
I am building a project with cmake on linux (ubuntu) and I am trying to use boost logging in that project. Here is what I do to generate the Makefile:
rm CMakeCache.txt
cmake ../ -DCMAKE_EXE_LINKER_FLAGS="-lboost_log -lboost_log_setup -lpthread -std=c++11" -DCMAKE_SHARED_LINKER_FLAGS="-lboost_log_setup -lboost_log -lpthread" -DCMAKE_MODULE_LINKER_FLAGS="-lboost_log_setup -lboost_log -lpthread" -DCMAKE_CXX_FLAGS="-DBOOST_LOG_DYN_LINK -std=c++11"
Compile goes through fine. (Some of these flags may be overkill -- I should only need the CMAKE_EXE_LINKER_FLAGS).
When I run the executable, I get the following unresolved reference:
-- ImportError: /home/mranga/gr-msod-sensor/gr-msod_sensor/build/lib/libgnuradio-msod_sensor.so: undefined symbol: _ZN5boost3log11v2_mt_posix3aux25unhandled_exception_countEv
What flags am I missing? My boost library is set up and LD_LIBRARY_PATH points to the right location.
When I manually built a test program using the same linker flags, it compiles and runs fine so boost is installed correctly. I hope I have not missed the obvious.
(Moved question from the GNU Radio mailing list -- sorry if you are reading this post for a second time).
I believe the order of libraries in the linker command line in -DCMAKE_EXE_LINKER_FLAGS is incorrect. boost_log_setup depends on boost_log, so boost_log_setup should go first.
You seem to be linking against the non-multithreaded version:
-lboost_log
but the run-time linker seems to explicitely look for the multithreaded variant (the Boost doc site on that):
_ZN5boost3log11v2_mt_posix3aux25unhandled_exception_countEv
^^
My guess hence is that you should try linking with
-lboost_log_mt
but the question whether that is right or not depends too much on your individual project to make it possible for me to clearly answer this.

Integrate a prebuilt .a into my Xcode 5

I'm trying to integrate a prebuilt a static c library (a .a library )into my Xcode 5 project. But it failed and returned tons of Apple Mach-O linker errors. What I did is I added the Library Search Path to correct path and added the Other C flags, Other C++ flags as something like -lmylib ( the lib file name is libmylib.a). I remembered it worked in my previous Xcode which using GCC.
Can anybody advise what I should do to fix the problem. Thanks.
Edit:
By adding these flags to Linker flag solved the problem. But I have another issue. The .a built for normal simulator doesn't work for the one with 64 bit. How should I solve this problem?
My bad. Add the flag to the wrong place. Should add to Other Linker Flag.

How to compile my code and link with Trilinos libraries

I've just installed trilinos 11.0.3 and now I'm trying to compile my first application using cmake.
The file I'm trying to compile is here
http://code.google.com/p/trilinos/wiki/EpetraSimpleVector
The first command cmake seems to work although I get the following warnings (just in case its relevant) for each trilinos package:
CMake Warning (dev) at /home/giorgos/Documents/TRILINOS/lib/cmake/Trilinos/
TrilinosTargets.cmake:208 (ADD_LIBRARY):
ADD_LIBRARY called with SHARED option but the target platform does not
support dynamic linking. Building a STATIC library instead. This may lead
to problems.
Other than that it seems that the location of trilinos includes and libraries have been found correctly
However the make command produce a list of similar errors such as :
/home/giorgos/Documents/mpi_tests/trilinos_test/test1/src/teuchos_test.cpp:11:
undefined reference to `Epetra_SerialComm::Epetra_SerialComm()'
/home/giorgos/Documents/mpi_tests/trilinos_test/test1/src/teuchos_test.cpp:16:
undefined reference to `Epetra_Map::Epetra_Map(int, int, Epetra_Comm const&)'
/home/giorgos/Documents/mpi_tests/trilinos_test/test1/src/teuchos_test.cpp:19:
undefined reference to `Epetra_Vector::Epetra_Vector(Epetra_BlockMap const&, bool)'
/home/giorgos/Documents/mpi_tests/trilinos_test/test1/src/teuchos_test.cpp:20:
undefined reference to `Epetra_Vector::Epetra_Vector(Epetra_BlockMap const&, bool)'
Any idea what's going on here?
(I named the source file teuchos_test.cpp because first I tried to compile some code from the teuchos package, However I was receiving similar errors as above)
Thank you
Giorgos
You can use cmake or make to build your program with Trilinos. I refer you to the official tutorial website here, which provides detailed explanations for both methods.
I haven't been able to compile the trilinos examples with cmake but I was able to do so by linking everything my self. For the example that gives me the above errors I did the following
g++ -o teuchos_test teuchos_test.cpp \
-I/home/giorgos/Documents/TRILINOS/include \
-L/home/giorgos/Documents/TRILINOS/lib -lepetra
since it depends on the epetra package only (I still have to change the name :))
However if anyone knows how to compile trilinos with cmake I'd appreciate the input here

Resources