Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » Can forte be compile under macos?
Can forte be compile under macos? [message #1821014] Tue, 04 February 2020 15:04 Go to next message
joy woo is currently offline joy wooFriend
Messages: 198
Registered: May 2019
Senior Member
I compile the forte under macos, but when compling it with Xcode, it seems part of the source still point to poxis architecture
Re: Can forte be compile under macos? [message #1821015 is a reply to message #1821014] Tue, 04 February 2020 15:05 Go to previous messageGo to next message
Martin Melik Merkumians is currently offline Martin Melik MerkumiansFriend
Messages: 117
Registered: March 2016
Senior Member
It does, because MacOS is POSIX compliant for the larger part.
Re: Can forte be compile under macos? [message #1821122 is a reply to message #1821015] Thu, 06 February 2020 03:10 Go to previous messageGo to next message
joy woo is currently offline joy wooFriend
Messages: 198
Registered: May 2019
Senior Member
but when i complie the latest version of forte, it failed

Undefined symbols for architecture x86_64:

"timespecAdd(timespec const*, timespec const*, timespec*)", referenced from:

CPCTimerHandler::run() in pctimeha.o

"timespecSub(timespec const*, timespec const*, timespec*)", referenced from:

CPCTimerHandler::run() in pctimeha.o

"timespecLessThan(timespec const*, timespec const*)", referenced from:

CPCTimerHandler::run() in pctimeha.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)







Showing Recent Issues

: "timespecAdd(timespec const*, timespec const*, timespec*)", referenced from:

Re: Can forte be compile under macos? [message #1821152 is a reply to message #1821122] Thu, 06 February 2020 11:31 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 199
Registered: February 2016
Senior Member
maybe adding forte_add_sourcefile_hcpp(../utils/timespec_utils) in src/arch/macos/CMakeLists.txt could help

Re: Can forte be compile under macos? [message #1821480 is a reply to message #1821152] Thu, 13 February 2020 14:14 Go to previous messageGo to next message
Martin Melik Merkumians is currently offline Martin Melik MerkumiansFriend
Messages: 117
Registered: March 2016
Senior Member
oh yeah, thanks Jose.
Seems that I missed adding this to the MacOS build back then
Re: Can forte be compile under macos? [message #1821496 is a reply to message #1821480] Thu, 13 February 2020 15:35 Go to previous messageGo to next message
joy woo is currently offline joy wooFriend
Messages: 198
Registered: May 2019
Senior Member
sorry for late reponse, that did work, thank you very much,both!
Re: Can forte be compile under macos? [message #1841415 is a reply to message #1821014] Sat, 15 May 2021 01:21 Go to previous messageGo to next message
Alexander La Spina is currently offline Alexander La SpinaFriend
Messages: 5
Registered: May 2021
Junior Member
Joy, Martin,

If you don't mind could you please post what versions of OS X and Xcode your using to compile Forte Runtime on MacOS and possibly your folder structure and CMake generate options.

I have tried both Cmake methods of using Xcode and unix makefile + command line tools but encounter numerous errors during build/make.

I have tried Xcode 10.3 on OS X 10.14.6 (Mojave) as well as Xcode 12.5 on OS X 11.3 (Bigsur).

To name a few compile errors:

FORTE_LITE
fortenew.h
'Replacement function operator new cannot be declared inline'

threadbase.h
'non-type template argument does not refer to any declaration'

forte_thread.h
'unknown type name 'TThreadHandleType'

fdselecthand.h
'use of undeclared identifier start'

Your feedback would be much appreciated.
Re: Can forte be compile under macos? [message #1841430 is a reply to message #1841415] Sun, 16 May 2021 14:38 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1584
Registered: January 2014
Senior Member

Hi,

can you provide us the full compile output. I tried to google a bit with what you posted above and I can not find a cause. Most probably there are some compiler switches that need to be changed. But without more information I have a hard time finding these.

Has anybody tried compiling 4diac FORTE with llvm/clang recently?
Re: Can forte be compile under macos? [message #1841450 is a reply to message #1841430] Mon, 17 May 2021 09:41 Go to previous messageGo to next message
Alexander La Spina is currently offline Alexander La SpinaFriend
Messages: 5
Registered: May 2021
Junior Member
Hi Prof. Zoitl,

Thank you very much for your response to my post.

I have attached the output of both an Xcode compile and Command Line 'make' compile using unix make files. I have uploaded them as .pdf as to keep the formatting and colours. For the Xcode output I issued the Xcode build command from the terminal so i could easily capture the output, errors are displayed in a project tree format within Xcode - hard to copy to text, but the build errors/warnings are identical. I could post some screen captures from inside Xcode if needed.

Both times the only CMake options I adjusted were:

FORTE_ARCHITECTURE = MacOS
FORTE_MODULE_CONVERT = TRUE
FORTE_MODULE_IEC61131 = TRUE
FORTE_MODULE_UTILS = TRUE

For Generator [Unix Makefiles] i also added
CMAKE_BUILD_TYPE = Debug

I did not add/adjust CMake_build_type for Generator [Xcode].

Both of the attached outputs are from an x86 Mac, so as to not confuse the issue between apple architecture changes and new options in Xcode now that Apple Silicon (M1 cpu) is supported.

Currently I am successfully running the 4diac IDE on both x86 MacOS and Apple M1 aarch64 MacOS. I am running FORTE (forte.exe windows binary) using CrossOver for Mac (commercial WINE style emulator) on Apple M1... it all works perfectly but being able to compile a native (x86 or aarch64) would be so much better.

On a side note, keep up the amazing work you are doing in the industrial automation sector and your open source and platform neutral approach :)

Thanks again. Alex.
Re: Can forte be compile under macos? [message #1841452 is a reply to message #1841450] Mon, 17 May 2021 12:48 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1584
Registered: January 2014
Senior Member

thanks for the full output. It could be that pthread_t is defined differently on MacOS. Could you try changing the line 31 of src/arch/posix/forte_thread.h to

class CPosixThread : public forte::arch::CThreadBase<pthread_t, 0, forte::arch::EmptyThreadDeletePolicy> {


And thanks for your kind words.
Re: Can forte be compile under macos? [message #1841529 is a reply to message #1841452] Thu, 20 May 2021 07:52 Go to previous messageGo to next message
Alexander La Spina is currently offline Alexander La SpinaFriend
Messages: 5
Registered: May 2021
Junior Member
Hi Alois,

I made the changes to line 31 in src/arch/posix/forte_thread.h and tried to compile again under Xcode and by Unix Make Files in the terminal. I have attached the full Xcode output, with similar errors.

In the meantime I will do more research on the use of Posix Threads in macOS, I did see some unrelated posts about needing to provide -pthread flags to the Clang compiler.

:)
Re: Can forte be compile under macos? [message #1843374 is a reply to message #1841529] Mon, 26 July 2021 20:19 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1584
Registered: January 2014
Senior Member

Hi Alexander,

sorry for being silent for so long I really had no clue what was going on. It seems that Jose found a solution over the weekend [1]. As I just merged it I thought you may want to give it a try.

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=575013

[Updated on: Mon, 26 July 2021 20:20]

Report message to a moderator

Re: Can forte be compile under macos? [message #1843426 is a reply to message #1843374] Thu, 29 July 2021 01:43 Go to previous messageGo to next message
Alexander La Spina is currently offline Alexander La SpinaFriend
Messages: 5
Registered: May 2021
Junior Member
Hi Alois, no problems at all. In the meantime I went down the track of investigating how posix compliant pthreads are implemented on MacOS and made some edits but to no avail.

I have made the compiler flag changes to a clean Xcode 'forte 1.14.0' project to std++11 as recommended by Jose (screenshot pictured) and I was able to reproduce the 'CEventSourceFB **' with an rvalue of type 'long' error. The pthread issue is gone.

However using the latest org.eclipse.4diac.forte.git commit, I still have to manually change the compiler flags in Xcode, but on build a similar build error occurs but this time the datatype is 'int' instead of 'long' (screenshot pictured).

Have I missed something when running CMake to avoid the Dnullptr issue?

Alex.
Re: Can forte be compile under macos? [message #1843500 is a reply to message #1843426] Mon, 02 August 2021 18:39 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1584
Registered: January 2014
Senior Member

Hi Alex,
Jose added an advanced CMake configuration flag called FORTE_USE_STD_11. You need to turn this on to solve the mentioned issues.
Alois
Re: Can forte be compile under macos? [message #1843758 is a reply to message #1843500] Tue, 17 August 2021 03:40 Go to previous messageGo to next message
Jose Maria Jesus Cabral Lassalle is currently offline Jose Maria Jesus Cabral LassalleFriend
Messages: 16
Registered: January 2021
Junior Member
Hi,

try setting the CMake variable FORTE_TEST_NEEDED_COMPILER_FEATURES to False if you have problems related to NULL. I'd recommend to update the develop branch, since there's a new patch fixing some problems in the semaphore of macOS https://git.eclipse.org/r/c/4diac/org.eclipse.4diac.forte/+/184052

Regards,
Jose
Re: Can forte be compile under macos? [message #1843864 is a reply to message #1843758] Sat, 21 August 2021 08:59 Go to previous messageGo to next message
Alexander La Spina is currently offline Alexander La SpinaFriend
Messages: 5
Registered: May 2021
Junior Member
Hi Jose, Alois,

I have good news, I have been able to successfully compile Forte in Xcode on both macOS Mojave (Xcode 10.3 Intel X64) and macOS BigSur (Xcode 12.5.1 Apple M1 ARM64).

The following is a summary of the CMake and Xcode options just in case anyone else reading this thread is having trouble:

CMake:

FORTE_ARCHITECTURE = MacOS
FORTE_MODULE_CONVERT = TRUE
FORTE_MODULE_IEC61131 = TRUE
FORTE_MODULE_UTILS = FALSE (when this is selected TRUE as per the documentation guide to building forte, the compile fails due to partial_access_type is a protected member of 'ciec_any_bit' in forte_array_at.h, so I have omitted UTILS from the build)
FORTE_TEST_NEEDED_COMPILER_FEATURES = FALSE
FORTE_USE_STD_11 = TRUE

Xcode:

Double Click FORTE in the top of the Project Navigator and Select Build Settings. The following need to be changed from defaults:

Apple Clang - Language; C Language Dialect = C11
Apple Clang - Language - C++; C++ Language Dialect = C++[-std=c++11]
C++ Standard Library = libc++ (LLVM c++ standard library with c++11 support]

with ALL_BUILD > My Mac selected, select Build -> Build For -> Running.

the Forte executable will build and can be found in Products - forte

Some Screenshots attached.

Thanks for your help Alois and Jose. When I get a chance I will investigate the UTILS compile errors.

Alex.
Re: Can forte be compile under macos? [message #1843899 is a reply to message #1843864] Mon, 23 August 2021 16:05 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1584
Registered: January 2014
Senior Member

hi Alex,

thanks for the feedback and great that it code better. Jose also noticed the problem with the partial_access_type [1]. I asked the original developer to have a look and he came up with a first patch [2] if you want to try it.

Cheers,
Alois

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=575442
[2] https://git.eclipse.org/r/c/4diac/org.eclipse.4diac.forte/+/184313
Re: Can forte be compile under macos? [message #1847067 is a reply to message #1843899] Wed, 13 October 2021 12:48 Go to previous message
Pmjkq Bhlpwt is currently offline Pmjkq BhlpwtFriend
Messages: 1
Registered: October 2021
Junior Member
Hey thanks for the super helpful reply. I'm not sure how I missed that thread. I haven't quite mastered the search function on here. The Information you shared above is great. I have been reading all you shared here. In this you explained everything very well. Thanks I am going to bookmark this https://www.eclipse.org/forums/index.php/t/1102278/
Previous Topic:Questions: readPin() implementation && OPC UA I/Os integration
Next Topic:Layout from application after upgrade
Goto Forum:
  


Current Time: Tue Apr 23 07:05:39 GMT 2024

Powered by FUDForum. Page generated in 0.04632 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top